LGWorld is a PowerPlant class that is used for creating GWorlds for offscreen drawing.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Source files:
Ancestors:
You can use LGWorld to help manage the creation and use of offscreen drawing areas. Refer to The PowerPlant Book for an example on how to use this class.
Purpose:
The constructor creates an object from the passed-in parameters.
Access:
Prototype:
LGWorld( const Rect &inBounds,Parameters:
SInt16 inPixelDepth = 0,
GWorldFlags inFlags = 0 ,
CTabHandle inCTableH = nil,
GDHandle inGDeviceH = nil );
The parameters for this constructor are:
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LGWorld();
Purpose:
Sets the current port to the offscreen GWorld and locks its pixels.
Every BeginDrawing call must be balanced by a corresponding EndDrawing() call.
Access:
Prototype:
Boolean BeginDrawing();Parameters:
Return:
Returns false if the offscreen pixels can't be locked. This will happen if
the pixPurge flag was set and the pixels were purged from memory. If so, you
might want to try to reallocate the pixels by calling the Toolbox
routine UpdateGWorld().
Purpose:
Copies an image from the offscreen GWorld to the specified port.
Access:
Prototype:
void CopyImage(Parameters:
GrafPtr inDestPort,
const Rect &inDestRect,
SInt16 inXferMode,
RgnHandle inMaskRgn );
The parameters for this constructor are:
Return:
Remarks:
You will want to make sure that the foreground color is black
and the background color is white before calling this function.
CopyBits() can be unreliable if this is not the case. This isn't done automatically
here ao that this routine to be fast (that's why you usually use
offscreen drawing).
Purpose:
Unlocks the GWorld's pixels and restores the current port to what
it was before BeginDrawing() was called. Every EndDrawing call must be preceded by a corresponding
BeginDrawing() call.
Access:
Prototype:
void EndDrawing();Parameters:
Return:
Purpose:
Returns the value of the mBounds data member in the passed-in parameter.
Access:
Prototype:
void GetBounds( Rect &outBounds );Parameters:
The parameters for this method is:
Return:
Purpose:
This method retrieves a pointer to a Mac OS GWorld.
Access:
Prototype:
GWorldPtr GetMacGWorld();Parameters:
Return:
Purpose:
Used to adjust the bounds of an offscreen world.
Access:
Prototype:
void SetBounds( const Rect &inBounds );Parameters:
The parameters for this method is:
Return:
Purpose:
Storage for the Mac OS Gworld.
Access:
Prototype:
GWorldPtr mMacGWorld;
Purpose:
Access:
Prototype:
Rect mBounds;
Purpose:
Access:
Prototype:
CGrafPtr mSavePort;
Purpose:
Storage to save the handle to the device.
Access:
Prototype:
GDHandle mSaveDevice;