[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LGWorld



Description:

LGWorld is a PowerPlant class that is used for creating GWorlds for offscreen drawing.

Methods :

The methods in this class are:

 

LGWorld()  
~LGWorld()  
BeginDrawing()  
CopyImage()  
EndDrawing()  
GetBounds()  
GetMacGWorld()  
SetBounds()  

Data Members:

The data members in this class are:

 

mMacGWorld  
mBounds  
mSavePort  
mSaveDevice  

Source files:

(Pane Classes)

UGWorld.h

UGWorld.cp

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.

LGWorld()

Purpose:

The constructor creates an object from the passed-in parameters.

Access:

Public

Prototype:

LGWorld( const Rect &inBounds,
SInt16 inPixelDepth = 0,
GWorldFlags inFlags = 0 ,
CTabHandle inCTableH = nil,
GDHandle inGDeviceH = nil );
Parameters:

The parameters for this constructor are:

 

const Rect&  
inBounds  
The bounds Rect for the drawing area.  
SInt16  
inPixelDepth  
The pixel depth, the default is 0.  
GWorldFlags  
inFlags  
The flags, the default is 0.  
CTabHandle  
inCTableH  
Handle to a color table, default is nil.  
GDHandle  
inGDeviceH  
Handle to the GDevice, default is nil.  

~LGWorld()

Purpose:

The destructor destroys the object.

Access:

Virtual, Public

Prototype:

virtual ~LGWorld();

BeginDrawing()

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:

Public

Prototype:

Boolean BeginDrawing();
Parameters:

None

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().

CopyImage()

Purpose:

Copies an image from the offscreen GWorld to the specified port.

Access:

Public

Prototype:

void CopyImage(
GrafPtr inDestPort,
const Rect &inDestRect,
SInt16 inXferMode,
RgnHandle inMaskRgn );
Parameters:

The parameters for this constructor are:

 

GrafPtr  
inDestPort  
The destination port.  
const Rect&  
inDestRect  
The destination port Rect.  
SInt16  
inXferMode  
The transfer mode, see QuickDraw.h.  
RgnHandle  
inMaskRgn  
The handle to the mask region.  

Return:

None

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).

EndDrawing()

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:

Public

Prototype:

void EndDrawing();
Parameters:

None

Return:

None

GetBounds()

Purpose:

Returns the value of the mBounds data member in the passed-in parameter.

Access:

Inline, Public

Prototype:

void GetBounds( Rect &outBounds );
Parameters:

The parameters for this method is:

 

Rect&  
outBounds  
The bounds Rect.  

Return:

None

GetMacGWorld()

Purpose:

This method retrieves a pointer to a Mac OS GWorld.

Access:

Inline, Public

Prototype:

GWorldPtr GetMacGWorld();
Parameters:

None

Return:

Pointer to a Mac OS GWorld.

SetBounds()

Purpose:

Used to adjust the bounds of an offscreen world.

Access:

Public

Prototype:

void SetBounds( const Rect &inBounds );
Parameters:

The parameters for this method is:

 

Rect&  
outBounds  
The bounds Rect.  

Return:

None

mMacGWorld

Purpose:

Storage for the Mac OS Gworld.

Access:

Protected

Prototype:

GWorldPtr mMacGWorld;

mBounds

Purpose:

Storage for the bounds Rect.

Access:

Protected

Prototype:

Rect mBounds;

mSavePort

Purpose:

Storage to save the port.

Access:

Protected

Prototype:

CGrafPtr mSavePort;

mSaveDevice

Purpose:

Storage to save the handle to the device.

Access:

Protected

Prototype:

GDHandle mSaveDevice;

[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000