Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_OffscreenCanvas Class Reference

A CP_Canvas object for management of drawing offscreen.

Inheritance diagram for CP_OffscreenCanvas:

CP_Canvas List of all members.

Public Member Functions

Colors
void SetForeColor (const CP_RGBColor &inForeColor)
void SetBackColor (const CP_RGBColor &inBackColor)
CP_RGBColor GetForeColor ()
CP_RGBColor GetBackColor ()
Font
CP_FontGetFont ()
void SetFontSpec (CP_FontSpec &inFontSpec)
Getters
SInt16 GetBitDepth ()
bool IsColor ()
OSGraphicsPort
OSGraphicsPort GetOSPort ()
void SetOSPort (OSGraphicsPort inGraphicsPort)
Setters
void SetPenSize (SInt16 inSize)
void SetTextMode (SInt16 inMode)
Testers
bool IsValid () const
ContextRef
virtual bool HasValidContextRef ()
bool UsingQDCoords ()
void SetUsingQDCoords (bool inUsingQDCoords)
virtual CGContextRef GetContextRef (bool inSyncOriginWithPort=true)
void SetContextRef (CGContextRef inContextRef)
Getters
GdkDrawable * GetDrawable ()
GtkWidget * GetGtkWidget ()
Constructor / Destructor
 CP_OffscreenCanvas (const CP_Rect &inBounds, CP_Canvas &inDestCanvas)
 Constructor.
virtual ~CP_OffscreenCanvas () throw ()
 Destructor.
Drawing
bool BeginDraw ()
void EndDraw ()
void CopyImage (CP_Canvas &inDestCanvas, const CP_Rect &inDestBounds)
void CopyImage (OSGraphicsPort inDestPort, const CP_Rect &inDestBounds, SInt32 inTransferMode=CP_E_TransferMode_SrcCopy)
void CopyImage (OSGraphicsPort inDestPort, const CP_Rect &inDestBounds, const CP_Region &inMaskRegion, SInt32 inTransferMode=CP_E_TransferMode_SrcCopy)
void CopyImage (OSGraphicsPort inDestPort, const CP_Rect &inSrcBounds, const CP_Rect &inDestBounds, const CP_Region &inMaskRegion, SInt32 inTransferMode=CP_E_TransferMode_SrcCopy)
void CopyImageWithBlend (OSGraphicsPort inDestPort, const CP_Rect &inSrcArea, const CP_Rect &inDestArea, const CP_Region &inMaskRegion, double inAlphaValue)
void CopyImageWithBlend (CP_Canvas &inDestCanvas, const CP_Rect &inSrcArea, const CP_Rect &inDestArea, const CP_Region &inMaskRegion, double inAlphaValue)
Getters
CP_BitmapGetBitmap ()
CP_Rect GetBounds () const
Getters
void SetTransferMode (SInt32 inTransferMode)
Constructor / Destructor
 CP_OffscreenCanvas (const CP_Rect &inBounds, SInt16 inPixelDepth, CP_Palette *inPalette=NULL, GDHandle inGDevice=NULL, GWorldFlags inFlags=0)
 Constructor.
GWorld
GWorldPtr GetGWorld ()
Setters
void SetCopyBitsColors (const CP_RGBColor &inForeColor, const CP_RGBColor &inBackColor)
Colors
void SetForeColor (const CP_RGBColor &inForeColor)
void SetBackColor (const CP_RGBColor &inBackColor)
CP_RGBColor GetForeColor ()
CP_RGBColor GetBackColor ()
Font
CP_FontGetFont ()
void SetFontSpec (CP_FontSpec &inFontSpec)
Getters
SInt16 GetBitDepth ()
bool IsColor ()
OSGraphicsPort
OSGraphicsPort GetOSPort ()
void SetOSPort (OSGraphicsPort inGraphicsPort)
Setters
void SetPenSize (SInt16 inSize)
void SetTextMode (SInt16 inMode)
Testers
bool IsValid () const
ContextRef
virtual bool HasValidContextRef ()
bool UsingQDCoords ()
void SetUsingQDCoords (bool inUsingQDCoords)
virtual CGContextRef GetContextRef (bool inSyncOriginWithPort=true)
void SetContextRef (CGContextRef inContextRef)
Getters
GdkDrawable * GetDrawable ()
GtkWidget * GetGtkWidget ()

Protected Member Functions

GWorld
void CreateGWorld (SInt16 inPixelDepth, const CP_Rect &inBounds, CTabHandle inColorTable, GDHandle inGDevice, GWorldFlags inFlags)
Cleanup
void Cleanup ()
Cleanup
void Cleanup ()
Cleanup
void Cleanup ()

Protected Attributes

CP_Rect fBounds
SInt32 fTransferMode
GWorldPtr fGWorld
CGrafPtr fSavePort
GDHandle fSaveDevice
CP_RGBColor fCopyBitsForeColor
CP_RGBColor fCopyBitsBackColor
CP_BitmapfCanvasBitmap
OSGraphicsPort fOffscreenPort
HBITMAP fOffscreenBitmap
HBITMAP fPreviousBitmap
OSGraphicsPort fOSGraphicsPort
bool fIsValid
CGContextRef fContextRef
bool fHasValidContextRef
bool fOwnsContext
bool fUsingQDCoords
CP_RGBColor fForeColor
CP_RGBColor fBackColor
HPEN fPen
HPEN fSavedPen
GtkWidget * fDestWidget
GdkDrawable * fGdkDrawable
CP_FontfFont

Private Member Functions

Misc
void PrepCopyBits ()

Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_OffscreenCanvas::CP_OffscreenCanvas const CP_Rect inBounds,
CP_Canvas inDestCanvas
 

Constructor.

CP_OffscreenCanvas::~CP_OffscreenCanvas  )  throw () [virtual]
 

Destructor.

CP_OffscreenCanvas::CP_OffscreenCanvas const CP_Rect inBounds,
SInt16  inPixelDepth,
CP_Palette inPalette = NULL,
GDHandle  inGDevice = NULL,
GWorldFlags  inFlags = 0
 

Constructor.


Member Function Documentation

bool CP_OffscreenCanvas::BeginDraw  ) 
 

void CP_OffscreenCanvas::EndDraw  ) 
 

void CP_OffscreenCanvas::CopyImage CP_Canvas inDestCanvas,
const CP_Rect inDestBounds
 

void CP_OffscreenCanvas::CopyImage OSGraphicsPort  inDestPort,
const CP_Rect inDestBounds,
SInt32  inTransferMode = CP_E_TransferMode_SrcCopy
 

void CP_OffscreenCanvas::CopyImage OSGraphicsPort  inDestPort,
const CP_Rect inDestBounds,
const CP_Region inMaskRegion,
SInt32  inTransferMode = CP_E_TransferMode_SrcCopy
 

void CP_OffscreenCanvas::CopyImage OSGraphicsPort  inDestPort,
const CP_Rect inSrcBounds,
const CP_Rect inDestBounds,
const CP_Region inMaskRegion,
SInt32  inTransferMode = CP_E_TransferMode_SrcCopy
 

void CP_OffscreenCanvas::CopyImageWithBlend OSGraphicsPort  inDestPort,
const CP_Rect inSrcArea,
const CP_Rect inDestArea,
const CP_Region inMaskRegion,
double  inAlphaValue
 

Copy our offscreen image into the passed in inDestPort. This version will blend the source and destination images.

Parameters:
inDestPort - the destination OSs platform port.
inDestArea - the destination area to draw into, if the size of the inSrcArea is not the same size, it will be shrunk or expanded to fit.
inSrcArea - the area of the canvas image to copy.
- inMaskRegion - the region to use as a mask for copying the image.
inAlphaValue - used on the Windows side to control the alpha of the blend. This value should be between 0 and 1, with 1 being 100 percent.

void CP_OffscreenCanvas::CopyImageWithBlend CP_Canvas inDestCanvas,
const CP_Rect inSrcArea,
const CP_Rect inDestArea,
const CP_Region inMaskRegion,
double  inAlphaValue
 

Copy our offscreen image into the passed in inDestPort. This version will blend the source and destination images.

Parameters:
inDestPort - the destination OSs platform port.
inDestArea - the destination area to draw into, if the size of the inSrcArea is not the same size, it will be shrunk or expanded to fit.
inSrcArea - the area of the canvas image to copy.
- inMaskRegion - the region to use as a mask for copying the image.
inAlphaValue - used on the Windows side to control the alpha of the blend. This value should be between 0 and 1, with 1 being 100 percent.

CP_Bitmap * CP_OffscreenCanvas::GetBitmap  ) 
 

CP_Rect CP_OffscreenCanvas::GetBounds  )  const
 

void CP_OffscreenCanvas::SetTransferMode SInt32  inTransferMode  ) 
 

GWorldPtr CP_OffscreenCanvas::GetGWorld  ) 
 

void CP_OffscreenCanvas::SetCopyBitsColors const CP_RGBColor inForeColor,
const CP_RGBColor inBackColor
 

void CP_OffscreenCanvas::CreateGWorld SInt16  inPixelDepth,
const CP_Rect inBounds,
CTabHandle  inColorTable,
GDHandle  inGDevice,
GWorldFlags  inFlags
[protected]
 

void CP_OffscreenCanvas::Cleanup  )  [protected]
 

void CP_OffscreenCanvas::PrepCopyBits  )  [private]
 

Sets up the fore / background colors used to draw the image.

void CP_OffscreenCanvas::Cleanup  )  [protected]
 

void CP_OffscreenCanvas::Cleanup  )  [protected]
 

void CP_Canvas::SetForeColor const CP_RGBColor inForeColor  )  [inherited]
 

Sets the foreground/stroke color for this port.

Parameters:
inForeColor The color to set the foreground to.
Exceptions:
NULL exceptions.
Returns:
void

void CP_Canvas::SetBackColor const CP_RGBColor inBackColor  )  [inherited]
 

Sets the background/fill color for this port.

Parameters:
inBackColor The color to set the background to.
Exceptions:
none 
Returns:
void

CP_RGBColor CP_Canvas::GetForeColor  )  [inherited]
 

Returns the foreground color currently set in this canvas.

Exceptions:
none 
Returns:
CP_RGBColor The current foreground color.

CP_RGBColor CP_Canvas::GetBackColor  )  [inherited]
 

Returns the background color currently set in this canvas.

Exceptions:
none 
Returns:
CP_RGBColor The current background color.

CP_Font * CP_Canvas::GetFont  )  [inherited]
 

Returns a CP_Font object that provides access to the font that is used in this canvas object.

Exceptions:
none 
Returns:
CP_Font CP_Font object describing the font used in this canvas.

void CP_Canvas::SetFontSpec CP_FontSpec inFontSpec  )  [inherited]
 

Sets the current font settings from the passed in CP_FontSpec.

Parameters:
inFontSpec Describes the appearance of the font, and how drawing will take place in the current canvas.
Exceptions:
none 
Returns:
void

SInt16 CP_Canvas::GetBitDepth  )  [inherited]
 

Returns the bit depth of this canvas.

Exceptions:
none 
Returns:
SInt16 The bit depth of the canvas.

bool CP_Canvas::IsColor  )  [inherited]
 

Returns true if the canvas is capable of drawing in color.

Exceptions:
none 
Returns:
bool True if this is a color canvas.

OSGraphicsPort CP_Canvas::GetOSPort  )  [inherited]
 

Returns the platforms native graphics port

Exceptions:
none 
Returns:
OSGraphicsPort A platforms native graphics port.

void CP_Canvas::SetOSPort OSGraphicsPort  inOSGraphicsPort  )  [inherited]
 

Sets the graphics port for this object to that of the passed in platforms graphics port.

Parameters:
inOSGraphicsPort The underlying OS graphics port.
Exceptions:
none 
Returns:
void

void CP_Canvas::SetPenSize SInt16  inSize  )  [inherited]
 

Sets the size of the graphics pen for this canvas.

Parameters:
inSize The size of the pen.
Exceptions:
none 
Returns:
void

void CP_Canvas::SetTextMode SInt16  inMode  )  [inherited]
 

Sets the text transfer mode used to draw text.

Parameters:
inMode The transfer mode used when text is drawn.
Exceptions:
none 
Returns:
void

bool CP_Canvas::IsValid  )  const [inherited]
 

Returns true if this canvas object currently holds a valid platforms graphics port to draw into.

Exceptions:
none 
Returns:
bool const

virtual bool CP_Canvas::HasValidContextRef  )  [virtual, inherited]
 

Flag to indicate if have set the context ref for this object, and it is valid to draw into.

Exceptions:
none 
Returns:
bool True if this canvas has a context ref that is valid, and ready to draw into.

bool CP_Canvas::UsingQDCoords  )  [inherited]
 

Flag to indicate if our content ref is currently using QuickDraw coordinates.

Exceptions:
none 
Returns:
bool True if the context ref is using QuickDraw coordinates.

void CP_Canvas::SetUsingQDCoords bool  inUsingQDCoords  )  [inherited]
 

Sets the lag to indicate if our content ref is currently using QuickDraw coordinates.

Parameters:
inUsingQDCoords True if the context ref is using QuickDraw coordinates.
Exceptions:
none 

CGContextRef CP_Canvas::GetContextRef bool  inSynchOriginWithPort = true  )  [virtual, inherited]
 

Return a CoreGraphics port for our canvas object. NOTE: This only works under OSX.

Parameters:
inSynchOriginWithPort Flag to indicate if the returned CGContextRef should have its coordinates transformed to match QuickDraws.
Exceptions:
none 
Returns:
CGContextRef The returned context ref.

void CP_Canvas::SetContextRef CGContextRef  inContextRef  )  [inherited]
 

Sets the context ref to the passed in one. If the passed in context ref is not NULL, the canvas object is marked as having a valid context ref.

Exceptions:
none 
Returns:
void

GdkDrawable* CP_Canvas::GetDrawable  )  [inherited]
 

Returns the GdkDrawable used to represent this canvas object.

Exceptions:
none 
Returns:
GdkDrawable The GdkDrawable we are representing.

GtkWidget* CP_Canvas::GetGtkWidget  )  [inherited]
 

The GtkWidget that this canvas object is drawing into.

Exceptions:
none 
Returns:
GtkWidget The GtkWidget we are drawing into.


Member Data Documentation

CP_Rect CP_OffscreenCanvas::fBounds [protected]
 

SInt32 CP_OffscreenCanvas::fTransferMode [protected]
 

GWorldPtr CP_OffscreenCanvas::fGWorld [protected]
 

CGrafPtr CP_OffscreenCanvas::fSavePort [protected]
 

GDHandle CP_OffscreenCanvas::fSaveDevice [protected]
 

CP_RGBColor CP_OffscreenCanvas::fCopyBitsForeColor [protected]
 

CP_RGBColor CP_OffscreenCanvas::fCopyBitsBackColor [protected]
 

CP_Bitmap* CP_OffscreenCanvas::fCanvasBitmap [protected]
 

OSGraphicsPort CP_OffscreenCanvas::fOffscreenPort [protected]
 

HBITMAP CP_OffscreenCanvas::fOffscreenBitmap [protected]
 

HBITMAP CP_OffscreenCanvas::fPreviousBitmap [protected]
 

OSGraphicsPort CP_Canvas::fOSGraphicsPort [protected, inherited]
 

bool CP_Canvas::fIsValid [protected, inherited]
 

A typedefed data member that corresponds to the native graphics port for the OS that CPLAT is running on. It is typedefed in CP_Types.h

CGContextRef CP_Canvas::fContextRef [protected, inherited]
 

Flag to indicate if the canvas is currently valid for drawing into.

bool CP_Canvas::fHasValidContextRef [protected, inherited]
 

MacOSX Quartz context ref for this port.

bool CP_Canvas::fOwnsContext [protected, inherited]
 

Flag to indicate if the context ref is valid.

bool CP_Canvas::fUsingQDCoords [protected, inherited]
 

This class created the context ref, and is responsible for its deletion.

CP_RGBColor CP_Canvas::fForeColor [protected, inherited]
 

The context ref is using QuickDraw coordinates.

CP_RGBColor CP_Canvas::fBackColor [protected, inherited]
 

Foreground color of objects.

HPEN CP_Canvas::fPen [protected, inherited]
 

Background or fill color of objects.

HPEN CP_Canvas::fSavedPen [protected, inherited]
 

Windows HPEN used for drawing lines.

GtkWidget* CP_Canvas::fDestWidget [protected, inherited]
 

Saved Windows HPEN to restore if we changed pens.

GdkDrawable* CP_Canvas::fGdkDrawable [protected, inherited]
 

The GtkView that is being drawn into.

CP_Font* CP_Canvas::fFont [protected, inherited]
 

Background or fill color of objects.


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:54 2005 for CPLAT by  doxygen 1.4.0