BfxPixelOp32 Class Reference

#include <bfxpixop.h>

Inheritance diagram for BfxPixelOp32:

BfxPixelOp CCObject SimpleCCObject BfxColourThresholdPixelOp BfxPositivePixelOp BfxThresholdPixelOp List of all members.

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)

Detailed Description

Definition at line 214 of file bfxpixop.h.


Constructor & Destructor Documentation

BfxPixelOp32::BfxPixelOp32  ) 
 

Default constructor for pixel op.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
None [INPUTS]
Constructs object [OUTPUTS]
Returns:
Nothing

Errors: None yet

See also:
-

Definition at line 400 of file bfxpixop.cpp.

00400                            : BfxPixelOp()
00401 {
00402     CacheStateMask=0;
00403     CacheValueMask=0;
00404     CacheMarks=0;
00405     BPP=32;
00406 }

BfxPixelOp32::~BfxPixelOp32  )  [virtual]
 

Default destructor for pixel op.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
None [INPUTS]
Constructs object [OUTPUTS]
Returns:
Nothing

Errors: Error3 if DeInit hasn't been called.

See also:
-

Definition at line 423 of file bfxpixop.cpp.

00424 {
00425 }


Member Function Documentation

BfxPixelOp32::CC_DECLARE_DYNCREATE BfxPixelOp32   )  [private]
 

BOOL BfxPixelOp32::CheckMinimumArea INT32  MinimumArea,
INT32  InitialX,
INT32  InitialY,
BOOL *  FoundRegion
[virtual]
 

Determines whether atleast (MinimumArea) pixels are within the region.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/1/95
Parameters:
MinimumArea = minimum area [INPUTS]
FoundRegion set as per whether it's found a region [OUTPUTS]
Returns:
TRUE on success, FALSE (& error set) on failure

Errors: None yet Scope: Public

See also:
TraceControl::FloodSearch
FoundRegion is set according the the result. The search starts at InitialX/InitialY

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 }

BOOL BfxPixelOp32::ClearCachedArea  )  [virtual]
 

Clears the caching information from the area in which it's been stored.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
TRUE if succeeded, FALSE & error set if not

Errors: Error 2 if init hasn't been called or GDraw fails Error 3 if windows and some other Oil layer are stangely mixed... Scope: Public

See also:
-

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 }

BOOL BfxPixelOp32::ClearEntireCache  )  [virtual]
 

Clears the entire bitmap of caching information.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
TRUE if succeeded, FALSE & error set if not

Errors: Error 2 if init hasn't been called or GDraw fails Error 3 if windows and some other Oil layer are stangely mixed... Scope: Public

See also:
-

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 }

BOOL BfxPixelOp32::FloodSearch INT32  x,
INT32  y,
INT32  MinimumArea
[protected, virtual]
 

Recursively flood fills an area until >=MinimumArea pixels are found.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/1/95
Parameters:
x = start x [INPUTS] y = start y MinimumArea = minimum area
None [OUTPUTS]
Returns:
TRUE on success, FALSE (& error set) on failure

Errors: None yet Scope: Public

See also:
BfxPixelOp32::CheckMinimumArea, TraceControl::CheckMinimumArea
ONLY TO BE USED FROM CheckMinimumArea ***

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 }

INT32 BfxPixelOp32::GetCacheMarks  )  [inline]
 

Definition at line 260 of file bfxpixop.h.

00260 { return CacheMarks; };

BOOL BfxPixelOp32::GetValueAdjustCache INT32  x,
INT32  y
[protected, virtual]
 

To be overriden by derived classes To be overriden by derived classes.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
x,y = coordinates of pixel [INPUTS]
None [OUTPUTS]
Returns:
Whether pixel is in the region or not (and alters cache parameters)

Errors: Always errors. The base class should never be called Scope: Public

See also:
BfxPixelOp32::IsPixelReallyInRegion()

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 }

BOOL BfxPixelOp32::IsCached INT32  x,
INT32  y
[inline]
 

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); };

virtual BOOL BfxPixelOp32::IsInRegion INT32  x,
INT32  y
[inline, virtual]
 

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         };

virtual DWORD BfxPixelOp32::ReadPixel void *  Image,
INT32  p
[inline, virtual]
 

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     };

BOOL BfxPixelOp32::Reset void   )  [virtual]
 

Resets all parameters associated with the cache.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
None [INPUTS]
Resets all parameters associated with the cache [OUTPUTS]
Returns:
TRUE if succeeded, FALSE & error set if not

Errors: Error 2 if init hasn't been called or GDraw fails Error 3 if windows and some other Oil layer are stangely mixed... Scope: Public

See also:
-

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 }

BOOL BfxPixelOp32::SetBitmap KernelBitmap pKB,
DWORD  theCacheStateMask,
DWORD  theCacheValueMask,
BOOL  theDefaultValue
[virtual]
 

Class set up to use bitmap passed in.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
pKB = pointer to the bitmap [INPUTS] theCacheStateMask = bit mask used to show cache information theCacheValueMask = bit mask used to show cache value information theDefaultValue = BOOL value associated with pixels outside the bitmap
None [OUTPUTS]
Returns:
TRUE if succeeded, FALSE & error set if not

Errors: Error 2 if init hasn't been called or GDraw fails Error 3 if windows and some other Oil layer are stangely mixed... Scope: Public

See also:
-

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 }

virtual void BfxPixelOp32::WritePixel void *  Image,
INT32  p,
DWORD  Value
[inline, virtual]
 

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     };


Member Data Documentation

INT32 BfxPixelOp32::CacheMarks [protected]
 

Definition at line 271 of file bfxpixop.h.

DWORD BfxPixelOp32::CacheStateMask [protected]
 

Definition at line 269 of file bfxpixop.h.

DWORD BfxPixelOp32::CacheValueMask [protected]
 

Definition at line 270 of file bfxpixop.h.

INT32 BfxPixelOp32::MaxX [protected]
 

Definition at line 275 of file bfxpixop.h.

INT32 BfxPixelOp32::MaxY [protected]
 

Definition at line 276 of file bfxpixop.h.

INT32 BfxPixelOp32::MinX [protected]
 

Definition at line 273 of file bfxpixop.h.

INT32 BfxPixelOp32::MinY [protected]
 

Definition at line 274 of file bfxpixop.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:10 2007 for Camelot by  doxygen 1.4.4