#include <bfxpixop.h>
Inheritance diagram for BfxPixelOp32:
Public Member Functions | |
BfxPixelOp32 () | |
Default constructor for pixel op. | |
virtual | ~BfxPixelOp32 () |
Default destructor for pixel op. | |
virtual BOOL | Reset () |
Resets all parameters associated with the cache. | |
virtual BOOL | SetBitmap (KernelBitmap *pKB, DWORD theCacheStateMask, DWORD theCacheValueMask, BOOL theDefaultValue) |
Class set up to use bitmap passed in. | |
BOOL | IsCached (INT32 x, INT32 y) |
virtual BOOL | IsInRegion (INT32 x, INT32 y) |
virtual BOOL | ClearCachedArea () |
Clears the caching information from the area in which it's been stored. | |
virtual BOOL | ClearEntireCache () |
Clears the entire bitmap of caching information. | |
virtual DWORD | ReadPixel (void *Image, INT32 p) |
virtual void | WritePixel (void *Image, INT32 p, DWORD Value) |
INT32 | GetCacheMarks () |
virtual BOOL | CheckMinimumArea (INT32 MinimumArea, INT32 InitialX, INT32 InitialY, BOOL *FoundRegion) |
Determines whether atleast (MinimumArea) pixels are within the region. | |
Protected Member Functions | |
virtual BOOL | GetValueAdjustCache (INT32 x, INT32 y) |
To be overriden by derived classes To be overriden by derived classes. | |
virtual BOOL | FloodSearch (INT32 x, INT32 y, INT32 MinimumArea) |
Recursively flood fills an area until >=MinimumArea pixels are found. | |
Protected Attributes | |
DWORD | CacheStateMask |
DWORD | CacheValueMask |
INT32 | CacheMarks |
INT32 | MinX |
INT32 | MinY |
INT32 | MaxX |
INT32 | MaxY |
Private Member Functions | |
CC_DECLARE_DYNCREATE (BfxPixelOp32) |
Definition at line 214 of file bfxpixop.h.
|
Default constructor for pixel op.
Definition at line 400 of file bfxpixop.cpp. 00400 : BfxPixelOp() 00401 { 00402 CacheStateMask=0; 00403 CacheValueMask=0; 00404 CacheMarks=0; 00405 BPP=32; 00406 }
|
|
Default destructor for pixel op.
Definition at line 423 of file bfxpixop.cpp.
|
|
|
|
Determines whether atleast (MinimumArea) pixels are within the region.
This call *must* be done immediately (yes, immediately) after the cache is cleared. If not you lose all your caching. Har har. Reimplemented from BfxPixelOp. Definition at line 624 of file bfxpixop.cpp. 00625 { 00626 if (!ClearCachedArea()) return FALSE; 00627 if (!FloodSearch(InitialX, InitialY, MinimumArea)) return FALSE; 00628 *FoundRegion = (GetCacheMarks() >= MinimumArea); 00629 return TRUE; 00630 }
|
|
Clears the caching information from the area in which it's been stored.
Reimplemented from BfxPixelOp. Definition at line 543 of file bfxpixop.cpp. 00544 { 00545 ERROR2IF(!Base,FALSE,"BfxPixelOp32::SetBitmap not called"); 00546 if ((MaxX<MinX) || (MaxY<MinY)) return TRUE; 00547 INT32 x; 00548 INT32 y; 00549 DWORD v=~(CacheValueMask | CacheStateMask); 00550 for (y=MinY; y<=MaxY; y++) for (x=MinX; x<=MaxX; x++) __bfxpixop_xy(x,y)&=v; 00551 Reset(); 00552 return TRUE; 00553 }
|
|
Clears the entire bitmap of caching information.
Reimplemented from BfxPixelOp. Definition at line 516 of file bfxpixop.cpp. 00517 { 00518 MinX=0; 00519 MinY=0; 00520 MaxX=Width-1; 00521 MaxY=Height-1; 00522 return ClearCachedArea(); 00523 }
|
|
Recursively flood fills an area until >=MinimumArea pixels are found.
Definition at line 652 of file bfxpixop.cpp. 00653 { 00654 if (IsCached(x,y) // We've been here before 00655 || GetCacheMarks()>=MinimumArea) // We've got enough 00656 return TRUE; 00657 if (IsInRegion(x,y)) 00658 { 00659 if (!( FloodSearch(x-1, y-1, MinimumArea) && 00660 FloodSearch(x , y-1, MinimumArea) && 00661 FloodSearch(x+1, y-1, MinimumArea) && 00662 FloodSearch(x-1, y , MinimumArea) && 00663 FloodSearch(x+1, y , MinimumArea) && 00664 FloodSearch(x-1, y+1, MinimumArea) && 00665 FloodSearch(x , y+1, MinimumArea) && 00666 FloodSearch(x+1, y+1, MinimumArea) && 00667 TRUE)) return TRUE; 00668 } 00669 return TRUE; 00670 }
|
|
Definition at line 260 of file bfxpixop.h. 00260 { return CacheMarks; };
|
|
To be overriden by derived classes To be overriden by derived classes.
Definition at line 590 of file bfxpixop.cpp. 00591 { 00592 if (x<MinX) MinX=x; 00593 if (x>MaxX) MaxX=x; 00594 if (y<MinY) MinY=y; 00595 if (y>MaxY) MaxY=y; 00596 BOOL state; 00597 // The following is disgusting but is time critical. Increment CacheMarks where we find 00598 // a previously undiscovered newly marked pixel 00599 CacheMarks+= (state = /*assign*/ IsPixelReallyInRegion(x,y)); 00600 return state; 00601 }
|
|
Definition at line 227 of file bfxpixop.h. 00227 { return (( (DWORD)x>=(DWORD)Width ) || ( (DWORD)y>=(DWORD)Height ) || (!Base))? 00228 DefaultValue:((__bfxpixop_xy(x,y) & CacheStateMask)!=0); };
|
|
Reimplemented from BfxPixelOp. Definition at line 229 of file bfxpixop.h. 00229 { 00230 if (( (DWORD)x>=(DWORD)Width ) || ( (DWORD)y>=(DWORD)Height ) || (!Base)) return DefaultValue; 00231 DWORD *pix = &__bfxpixop_xy(x,y); 00232 BOOL val; 00233 return (((*pix) & CacheStateMask)!=0)?(((*pix) & CacheValueMask)!=0): 00234 (val=GetValueAdjustCache(x,y),(*pix)=((*pix)&~CacheValueMask) | CacheStateMask | (val?CacheValueMask:0),val); 00235 };
|
|
Reimplemented from BfxPixelOp. Definition at line 239 of file bfxpixop.h. 00240 { 00241 if ((((DWORD)p)>=Size)||!Image) 00242 { 00243 ERROR3("Out of range BfxPixOp::ReadPixel()"); 00244 return 0; 00245 } 00246 return ((DWORD *) Image)[p]; 00247 };
|
|
Resets all parameters associated with the cache.
Reimplemented from BfxPixelOp. Definition at line 444 of file bfxpixop.cpp. 00445 { 00446 MinX=(1<<30); 00447 MinY=(1<<30); 00448 MaxX=0; 00449 MaxY=0; 00450 CacheMarks = 0; 00451 return BfxPixelOp::Reset(); 00452 }
|
|
Class set up to use bitmap passed in.
Reimplemented from BfxPixelOp. Definition at line 478 of file bfxpixop.cpp. 00480 { 00481 Base = NULL; 00482 ERROR2IF( ((!pKB) || (pKB->ActualBitmap==NULL)) ,FALSE,"BfxALU can't find OIL bitmap"); 00483 ERROR3IF( (!(pKB->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxALU Oil layer inconsistency"); 00484 00485 BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pKB->ActualBitmap))->BMInfo->bmiHeader); 00486 00487 ERROR2IF((pBMI->biBitCount !=32), FALSE,"Bad BfxALU A reg"); 00488 00489 if (!BfxPixelOp::SetBitmap(pKB, theCacheStateMask,theCacheValueMask, theDefaultValue)) return FALSE; 00490 00491 CacheStateMask = theCacheStateMask; 00492 CacheValueMask = theCacheValueMask; 00493 DefaultValue = theDefaultValue; 00494 00495 return TRUE; 00496 }
|
|
Reimplemented from BfxPixelOp. Definition at line 249 of file bfxpixop.h. 00250 { 00251 if ((((DWORD)p)>=Size)||!Image) 00252 { 00253 ERROR3("Out of range BfxPixOp::WritePixel()"); 00254 return; 00255 } 00256 ((DWORD *) Image)[p]=Value; 00257 return; 00258 };
|
|
Definition at line 271 of file bfxpixop.h. |
|
Definition at line 269 of file bfxpixop.h. |
|
Definition at line 270 of file bfxpixop.h. |
|
Definition at line 275 of file bfxpixop.h. |
|
Definition at line 276 of file bfxpixop.h. |
|
Definition at line 273 of file bfxpixop.h. |
|
Definition at line 274 of file bfxpixop.h. |