BfxPixelOp Class Reference

#include <bfxpixop.h>

Inheritance diagram for BfxPixelOp:

CCObject SimpleCCObject BfxPixelOp24 BfxPixelOp32 BfxPixelOpPseudo BfxColourThresholdPixelOp BfxPositivePixelOp BfxThresholdPixelOp BfxColourThresholdPixelOpPseudo BfxPositivePixelOpPseudo BfxThresholdPixelOpPseudo List of all members.

Public Member Functions

 BfxPixelOp ()
 Default constructor for pixel op.
virtual ~BfxPixelOp ()
 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.
virtual BOOL IsInRegion (INT32 x, INT32 y)
virtual BOOL ClearCachedArea ()
virtual BOOL ClearEntireCache ()
virtual BOOL SetAuxilliaryBitmaps (KernelBitmap *pProposed, KernelBitmap *pCurrent, KernelBitmap *pOriginal, INT32 Threshold, DWORD theColour)
 To be overriden by derived classes Sets up auxilliary bitmaps for derived classes.
virtual BOOL CheckMinimumArea (INT32 MinimumArea, INT32 InitialX, INT32 InitialY, BOOL *FoundRegion)
virtual DWORD ReadPixel (void *Image, INT32 p)
virtual void TranslateToRGB (DWORD Colour, KernelBitmap *pKB, INT32 *R, INT32 *G, INT32 *B)
DWORD ReadOriginalPixel (INT32 x, INT32 y)
virtual DWORD ReadBPixel (INT32 x, INT32 y)
DWORD ReadPixel (void *Image, INT32 x, INT32 y)
virtual void WritePixel (void *Image, INT32 p, DWORD Value)
virtual DWORD TranslateToDWORD (KernelBitmap *pKB, INT32 R, INT32 G, INT32 B)
void WriteOriginalPixel (INT32 x, INT32 y, DWORD Value)
void WritePixel (void *Image, INT32 x, INT32 y, DWORD Value)

Protected Member Functions

virtual BOOL IsPixelReallyInRegion (INT32 x, INT32 y)
 To be overriden by derived classes.

Protected Attributes

DWORDBase
INT32 Height
INT32 Width
INT32 WidthRounded
DWORD Size
BOOL DefaultValue
INT32 BPP
DWORDpA
DWORDpB
DWORDpT
DWORD Colour
INT32 Value

Private Member Functions

 CC_DECLARE_DYNCREATE (BfxPixelOp)

Detailed Description

Definition at line 135 of file bfxpixop.h.


Constructor & Destructor Documentation

BfxPixelOp::BfxPixelOp  ) 
 

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 149 of file bfxpixop.cpp.

00150 {
00151     Base=NULL;
00152     Height=0;
00153     Width=WidthRounded=0;
00154     Size=0;
00155     DefaultValue=FALSE;
00156     Reset();
00157     pA=NULL;
00158     pB=NULL;
00159     pT=NULL;
00160     Value=0;
00161     BPP=32;
00162 }

BfxPixelOp::~BfxPixelOp  )  [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 179 of file bfxpixop.cpp.

00180 {
00181 }


Member Function Documentation

BfxPixelOp::CC_DECLARE_DYNCREATE BfxPixelOp   )  [private]
 

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

Reimplemented in BfxPixelOp32, and BfxPixelOpPseudo.

Definition at line 155 of file bfxpixop.h.

00156                             {*FoundRegion = FALSE; return TRUE;};

virtual BOOL BfxPixelOp::ClearCachedArea  )  [inline, virtual]
 

Reimplemented in BfxPixelOp32.

Definition at line 150 of file bfxpixop.h.

00150 {return TRUE;};

virtual BOOL BfxPixelOp::ClearEntireCache  )  [inline, virtual]
 

Reimplemented in BfxPixelOp32.

Definition at line 151 of file bfxpixop.h.

00151 {return TRUE;};

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

Reimplemented in BfxPixelOp32, and BfxPixelOpPseudo.

Definition at line 148 of file bfxpixop.h.

00148 {return DefaultValue;}

BOOL BfxPixelOp::IsPixelReallyInRegion INT32  x,
INT32  y
[protected, virtual]
 

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.

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

See also:
BfxPixelOp::IsInRegion()
Outisiders should used the cached version BfxPixelOp::IsInRegion()

Reimplemented in BfxPositivePixelOp, BfxThresholdPixelOp, BfxColourThresholdPixelOp, BfxPositivePixelOpPseudo, BfxThresholdPixelOpPseudo, and BfxColourThresholdPixelOpPseudo.

Definition at line 280 of file bfxpixop.cpp.

00281 {
00282     ERROR3("How come base class BfxPixelOp::IsPixelReallyInRegion has got called?");
00283     return DefaultValue;
00284 }

virtual DWORD BfxPixelOp::ReadBPixel INT32  x,
INT32  y
[inline, virtual]
 

Reimplemented in BfxPixelOp24.

Definition at line 165 of file bfxpixop.h.

00166         { return ReadPixel((void *)pB, x+y*WidthRounded); };

DWORD BfxPixelOp::ReadOriginalPixel INT32  x,
INT32  y
[inline]
 

Definition at line 162 of file bfxpixop.h.

00163         { return ReadPixel((void *)pT, x+y*WidthRounded); };

DWORD BfxPixelOp::ReadPixel void *  Image,
INT32  x,
INT32  y
[inline]
 

Definition at line 168 of file bfxpixop.h.

00168 { return ReadPixel(Image, x+y*WidthRounded); };

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

Reimplemented in BfxPixelOp32, and BfxPixelOpPseudo.

Definition at line 158 of file bfxpixop.h.

00158 { return 0; }

BOOL BfxPixelOp::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 in BfxPixelOp32, and BfxPixelOpPseudo.

Definition at line 200 of file bfxpixop.cpp.

00201 {
00202     return TRUE;
00203 }

BOOL BfxPixelOp::SetAuxilliaryBitmaps KernelBitmap pProposed,
KernelBitmap pCurrent,
KernelBitmap pOriginal,
INT32  Threshold,
DWORD  theColour
[virtual]
 

To be overriden by derived classes Sets up auxilliary bitmaps for derived classes.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
pProposed = the proposed bitmap (with new proposed grad fill) [INPUTS] pCurrent = the current bitmap (as built up) pOriginal = the original image (to trace) Threshold = new threshold theColour = Colour to look for
None [OUTPUTS]
Returns:
TRUE on success else FALSE & error set

Errors: Several Scope: Public

See also:
BfxPixelOp::IsPixelReallyInRegion()
The bitmaps may be NULL if you don't want to use them

Definition at line 328 of file bfxpixop.cpp.

00330 {
00331     if (pProposed)
00332     {
00333         ERROR2IF( (pProposed->ActualBitmap==NULL) ,FALSE,"BfxPixelOp can't find OIL bitmap");
00334         ERROR3IF( (!(pProposed->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxPixelOp Oil layer inconsistency");
00335         
00336         BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pProposed->ActualBitmap))->BMInfo->bmiHeader);
00337         
00338         ERROR2IF( ((pBMI->biHeight != Height) || (pBMI->biWidth != Width) || (BPP && pBMI->biBitCount !=BPP)), FALSE,
00339               "Incompatible bitmaps for BfxPixelOp::SetAuxilliaryBitmap");
00340         pA = (DWORD *)(void *)(((CWxBitmap *)(pProposed->ActualBitmap))->BMBytes);
00341     }
00342     else
00343     {
00344         pA = NULL;
00345     }
00346 
00347     if (pOriginal)
00348     {
00349         ERROR2IF( (pOriginal->ActualBitmap==NULL) ,FALSE,"BfxPixelOp can't find OIL bitmap");
00350         ERROR3IF( (!(pOriginal->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxPixelOp Oil layer inconsistency");
00351         
00352         BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pOriginal->ActualBitmap))->BMInfo->bmiHeader);
00353         
00354         ERROR2IF( ((pBMI->biHeight != Height) || (pBMI->biWidth != Width) || (BPP && pBMI->biBitCount !=BPP)), FALSE,
00355               "Incompatible bitmaps for BfxPixelOp::SetAuxilliaryBitmap");
00356         pT = (DWORD *)(void *)(((CWxBitmap *)(pOriginal->ActualBitmap))->BMBytes);
00357     }
00358     else
00359     {
00360         pT = NULL;
00361     }
00362 
00363     if (pCurrent)
00364     {
00365         ERROR2IF( (pCurrent->ActualBitmap==NULL) ,FALSE,"BfxPixelOp can't find OIL bitmap");
00366         ERROR3IF( (!(pCurrent->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxPixelOp Oil layer inconsistency");
00367         
00368         BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pCurrent->ActualBitmap))->BMInfo->bmiHeader);
00369         
00370         ERROR2IF( ((pBMI->biHeight != Height) || (pBMI->biWidth != Width) || (BPP && pBMI->biBitCount !=BPP)), FALSE,
00371               "Incompatible bitmaps for BfxPixelOp::SetAuxilliaryBitmap");
00372         pB = (DWORD *)(void *)(((CWxBitmap *)(pCurrent->ActualBitmap))->BMBytes);
00373     }
00374     else
00375     {
00376         pB = NULL;
00377     }
00378 
00379     
00380     Value = Threshold;
00381     Colour = theColour;
00382     return TRUE;
00383 }

BOOL BfxPixelOp::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 in BfxPixelOp32, and BfxPixelOpPseudo.

Definition at line 229 of file bfxpixop.cpp.

00231 {
00232     Base = NULL;
00233     ERROR2IF( ((!pKB) || (pKB->ActualBitmap==NULL)) ,FALSE,"BfxALU can't find OIL bitmap");
00234     ERROR3IF( (!(pKB->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxALU Oil layer inconsistency");
00235 
00236     BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pKB->ActualBitmap))->BMInfo->bmiHeader);
00237 
00238     ERROR2IF( (BPP && pBMI->biBitCount != BPP), FALSE, "BfxPixelOp called with incorrect BPP");
00239 
00240     Base = (DWORD *)(void *)(((CWxBitmap *)(pKB->ActualBitmap))->BMBytes);
00241     Width = pBMI->biWidth;
00242     INT32 Bits = pBMI->biBitCount;
00243     switch (Bits)
00244     {
00245         case 1 : WidthRounded = (Width+31) &~31; break;
00246         case 2 : WidthRounded = (Width+15) &~15; break;
00247         case 4 : WidthRounded = (Width+7) &~7; break;
00248         case 8 : WidthRounded = (Width+3) &~3; break;
00249         case 16: WidthRounded = (Width+1) &~1; break;
00250         case 32:
00251         default:
00252                  WidthRounded = Width; break;
00253     }
00254 
00255     Height = pBMI->biHeight;
00256     Size = (pBMI->biSizeImage)>>2;
00257 
00258     return TRUE;
00259 }

virtual DWORD BfxPixelOp::TranslateToDWORD KernelBitmap pKB,
INT32  R,
INT32  G,
INT32  B
[inline, virtual]
 

Definition at line 171 of file bfxpixop.h.

00172         { return ((R & 0xFF)<<16) | ((G & 0xFF)<<8) | (B & 0xFF); };

virtual void BfxPixelOp::TranslateToRGB DWORD  Colour,
KernelBitmap pKB,
INT32 *  R,
INT32 *  G,
INT32 *  B
[inline, virtual]
 

Reimplemented in BfxPixelOpPseudo.

Definition at line 159 of file bfxpixop.h.

00160         { *R = (INT32)(Colour >>16) & 0x0FF; *G = (INT32)(Colour>>8) & 0x0FF; *B = (INT32)(Colour/*>>0*/) & 0x0FF;return;};

void BfxPixelOp::WriteOriginalPixel INT32  x,
INT32  y,
DWORD  Value
[inline]
 

Definition at line 174 of file bfxpixop.h.

00175         { WritePixel((void *)pT, x+y*WidthRounded, Value); return; };

void BfxPixelOp::WritePixel void *  Image,
INT32  x,
INT32  y,
DWORD  Value
[inline]
 

Definition at line 177 of file bfxpixop.h.

00177 { WritePixel(Image, x+y*WidthRounded, Value); return;};

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

Reimplemented in BfxPixelOp32, and BfxPixelOpPseudo.

Definition at line 170 of file bfxpixop.h.

00170 { return; }


Member Data Documentation

DWORD* BfxPixelOp::Base [protected]
 

Definition at line 183 of file bfxpixop.h.

INT32 BfxPixelOp::BPP [protected]
 

Definition at line 190 of file bfxpixop.h.

DWORD BfxPixelOp::Colour [protected]
 

Definition at line 195 of file bfxpixop.h.

BOOL BfxPixelOp::DefaultValue [protected]
 

Definition at line 188 of file bfxpixop.h.

INT32 BfxPixelOp::Height [protected]
 

Definition at line 184 of file bfxpixop.h.

DWORD* BfxPixelOp::pA [protected]
 

Definition at line 192 of file bfxpixop.h.

DWORD* BfxPixelOp::pB [protected]
 

Definition at line 193 of file bfxpixop.h.

DWORD* BfxPixelOp::pT [protected]
 

Definition at line 194 of file bfxpixop.h.

DWORD BfxPixelOp::Size [protected]
 

Definition at line 187 of file bfxpixop.h.

INT32 BfxPixelOp::Value [protected]
 

Definition at line 196 of file bfxpixop.h.

INT32 BfxPixelOp::Width [protected]
 

Definition at line 185 of file bfxpixop.h.

INT32 BfxPixelOp::WidthRounded [protected]
 

Definition at line 186 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