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

CP_ImageList Class Reference

Inheritance diagram for CP_ImageList:

CP_M_RefCounted List of all members.

Public Member Functions

Constructor / Destructor
 CP_ImageList ()
 Constructor.
 CP_ImageList (SInt16 inNumImages, SInt16 inImageWidth=0, SInt16 inImageHeight=0, bool inIsMasked=true)
virtual ~CP_ImageList ()
 Destructor.
Getters
OSImageList GetPlatformImageList ()
SInt16 GetWidth ()
SInt16 GetHeight ()
UInt16 GetSlopValue ()
SInt16 GetNumberImages ()
SInt32 GetTransferMode ()
Images
void Add (SInt16 inImageID)
void AddMasked (SInt16 inImageID, CP_RGBColor &inMaskColor, bool inUseZeroPixelColor=false)
void AddIconImage (SInt16 inImageID)
void AddIconImage (CP_OSIcon *inImage)
void Remove (SInt16 inImageIndex)
void RemoveAll ()
Drawing
void CopyImageTo (CP_Canvas &inCanvas, SInt16 inImageIndex, const CP_Point &inDestLocation, bool inShowSelected=false, bool isActive=true)
Setters
void SetImageSize (SInt16 inHorSize, SInt16 inVerSize)
void SetSlopValue (UInt16 inSlopValue)
void SetTransferMode (SInt16 inMode)
Images
void AddImage (CP_OffscreenCanvas *inCanvas, const CP_Rect &inSourceArea)
void AddMasked_Mac (PicHandle inPicture, CP_RGBColor &inMaskColor, bool inUseZeroPixelColor)
void LoadImages (SInt16 inResourceID)
Storage
virtual void GrowBitmapStorage ()

Protected Attributes

OSImageList fImages
OSImageList fMasks
SInt16 fImageWidth
SInt16 fImageHeight
SInt16 fNumberImages
SInt16 fMaxNumberImages
SInt16 fImageGrowAmt
bool fIsMasked
UInt16 fSlopValue
SInt32 fTransferMode
GWorldPtr fSavedPort
GDHandle fSavedDevice

Private Member Functions

Initialization
void Init (SInt16 inNumImages=0, SInt16 inImageWidth=0, SInt16 inImageHeight=0, bool inIsMasked=true)
Misc
void AllocGWorlds (SInt16 inNumImages, SInt16 inImageWidth, SInt16 inImageHeight)
Images
void AddPictImage_Mac (SInt16 inImageID)
void AddMasked_Mac (SInt16 inImageID, CP_RGBColor &inMaskColor, bool inUseZeroPixelColor=false)
void AddIconImage_Mac (SInt16 inImageID)
void AddIconImage_Mac (CP_OSIcon *inImage)
void CopyIconData_Mac (OSColorIcon inIconData)
void CopyIconData_Mac_IconSuite (IconSuiteRef inIconData)
void CopyIconData_Mac_IconReference (IconRef inIconData)
void CopyImageTo_Mac (CP_Canvas &inCanvas, SInt16 inImageIndex, const CP_Point &inDestLocation, bool inShowSelected=false, bool isActive=true)
void CreateRGBMask_Mac (CP_RGBColor &inMaskColor, const CP_Rect &inImageArea, bool inUseZeroPixelColor=false)

Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_ImageList::CP_ImageList  ) 
 

Constructor.

Exceptions:
none 

CP_ImageList::CP_ImageList SInt16  inNumImages,
SInt16  inImageWidth = 0,
SInt16  inImageHeight = 0,
bool  isInMasked = true
 

Constructor. This version is used to create an empty image list capable of holding inNumImages of the passed in size.

Parameters:
inNumImages The number of images to store.
inImageWidth The width in pixels of each image.
inImageHeight The height in pixels of each image.
isInMasked A flag to indicate if we want to mask our images.
Exceptions:
none 

CP_ImageList::~CP_ImageList  )  [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

OSImageList CP_ImageList::GetPlatformImageList  ) 
 

Returns the platforms OS image list.

Exceptions:
none 
Returns:
OSImageList The platforms OS image list.

SInt16 CP_ImageList::GetWidth  ) 
 

Returns the width of an image.

Exceptions:
none 
Returns:
SInt16 Width of a single image.

SInt16 CP_ImageList::GetHeight  ) 
 

Returns the height of an image.

Exceptions:
none 
Returns:
SInt16 Height of a single image.

UInt16 CP_ImageList::GetSlopValue  ) 
 

Return the slop value used to determine if a color is close enough. Used in calculating masks.

Exceptions:
none 
Returns:
UInt16 Value used to determine how close a color has to be to be considered equal in generating mask data.

SInt16 CP_ImageList::GetNumberImages  ) 
 

Return the actual number of images in the image list.

Exceptions:
none 
Returns:
SInt16 The actual number of images in the image list.

SInt32 CP_ImageList::GetTransferMode  ) 
 

Return the transfer mode used to copy images back to the destination canvas.

Exceptions:
none 
Returns:
SInt32 The transfer mode.

void CP_ImageList::Add SInt16  inImageID  ) 
 

Add a new picture / bitmap image to our list with the specified resource id.

Parameters:
inImageID Resource id of the image to add.
Exceptions:
none 
Returns:
void

void CP_ImageList::AddMasked SInt16  inImageID,
CP_RGBColor inMaskColor,
bool  inUseZeroPixelColor = false
 

Add a new picture / bitmap image to our list with the specified resource id. This version will also try to create a mask using the passed in inMaskColor, or if inUseZeroPixelColor is true, then the color at pixel 0, 0 will be used as the mask color.

Parameters:
inImageID Resource id of the image to add.
inMaskColor Contains the color we create the mask from. All matching colors in the image will become part of the mask.
inUseZeroPixelColor If true, then the color at pixel 0, 0 will be used as the color to create the mask from.
Exceptions:
none 
Returns:
void

void CP_ImageList::AddIconImage SInt16  inImageID  ) 
 

Add a new image to our list. The inImageID specifies an icon resource to use.

Parameters:
inImageID Resource id of the icon to add.
Exceptions:
none 
Returns:
void

void CP_ImageList::AddIconImage CP_OSIcon inImage  ) 
 

Add a new image from the passed in CP_OSIcon object.

Parameters:
inImage A CP_OSIcon to use as the image.
Exceptions:
none 
Returns:
void

void CP_ImageList::Remove SInt16  inImageIndex  ) 
 

Remove an image from our image list.

NOTE: If we pass an index of -1 for the inImageIndex we want to remove all images.

Parameters:
inImageIndex Index of the image to remove.
Exceptions:
none 
Returns:
void

void CP_ImageList::RemoveAll  ) 
 

Remove all image from the image list.

Exceptions:
none 
Returns:
void

void CP_ImageList::CopyImageTo CP_Canvas inCanvas,
SInt16  inImageIndex,
const CP_Point inDestLocation,
bool  inShowSelected = false,
bool  isActive = true
 

Copy an image onto the dest canvas object at inDestLocation. Passing in -1 for the image index indicates we don't want anything drawn.

Parameters:
inCanvas The destination CP_Canvas object to receive this image.
inImageIndex Index of the image to draw.
inDestLocation CP_Point object specifing the hor and ver coords to draw the image.
inShowSelected If true the image is drawn in a selected state.
isActive If true the image is drawn normally, if false, the image is drawn in an inactive state.
Exceptions:
none 
Returns:
void

void CP_ImageList::SetImageSize SInt16  inHorSize,
SInt16  inVerSize
 

Set the image size for all images in the list. This method will reallocate the bitmap for the image list, destroying any previous images in the list. So make sure you make this call before you add images.

Parameters:
inHorSize Horizontal size of the images.
inVerSize Vertical size of the images.
Exceptions:
none 
Returns:
void

void CP_ImageList::SetSlopValue UInt16  inSlopValue  ) 
 

Sets the slop value which is used in determining how close a color must be to be considered a match when generating the masks for an image.

Parameters:
inSlopValue The value to add to each side of a color when comparing.
Exceptions:
none 
Returns:
void

void CP_ImageList::SetTransferMode SInt16  inMode  ) 
 

Return the transfer mode used to copy images back to the destination canvas.

Parameters:
inMode The mode used to copy image.
Exceptions:
none 
Returns:
void

void CP_ImageList::Init SInt16  inNumImages = 0,
SInt16  inImageWidth = 0,
SInt16  inImageHeight = 0,
bool  isInMasked = true
[private]
 

Initialize the image list.

Parameters:
inNumImages The number of images to store.
inImageWidth The width in pixels of each image.
inImageHeight The height in pixels of each image.
isInMasked A flag to indicate if we want to mask our images.
Exceptions:
none 
Returns:
void

void CP_ImageList::AddImage CP_OffscreenCanvas inCanvas,
const CP_Rect inSourceArea
 

MacOS saved GDHandle when drawing into our image list.

void CP_ImageList::AddMasked_Mac PicHandle  inPicture,
CP_RGBColor inMaskColor,
bool  inUseZeroPixelColor
 

Add a new picture contained in the passed in PicHandle. This version will also try to create a mask using the passed in inMaskColor, or if inUseZeroPixelColor is true, then the color at pixel 0, 0 will be used as the mask color.

Parameters:
inPicture Contains a MacOS PicHandle image to be added.
inMaskColor Contains the color we create the mask from. All matching colors in the image will become part of the mask.
inUseZeroPixelColor If true, then the color at pixel 0, 0 will be used as the color to create the mask from.
Exceptions:
none 
Returns:
void

void CP_ImageList::LoadImages SInt16  inResourceID  ) 
 

Load our image list from the information in a 'CPil' resource.

Parameters:
inResourceID Resource id of the image list 'CPil' resource.
Exceptions:
none 
Returns:
void

void CP_ImageList::GrowBitmapStorage  )  [virtual]
 

Increase the space for storing images.

Exceptions:
none 
Returns:
void

void CP_ImageList::AllocGWorlds SInt16  inNumImages,
SInt16  inImageWidth,
SInt16  inImageHeight
[private]
 

Allocate the GWorlds used to hold the images.

Parameters:
inNumImages The number of images to store.
inImageWidth The width in pixels of each image.
inImageHeight The height in pixels of each image.
Exceptions:
none 
Returns:
void

void CP_ImageList::AddPictImage_Mac SInt16  inImageID  )  [private]
 

Add the image from a picture resource of inImageID.

Parameters:
inImageID Resource id of a 'PICT' resource.
Exceptions:
none 
Returns:
void

void CP_ImageList::AddMasked_Mac SInt16  inImageID,
CP_RGBColor inMaskColor,
bool  inUseZeroPixelColor = false
[private]
 

Add a new picture image to our list with the specified resource id. This version will also try to create a mask using the passed in inMaskColor, or if inUseZeroPixelColor is true, then the color at pixel 0, 0 will be used as the mask color.

Parameters:
inImageID Resource id of the 'PICT' image to add.
inMaskColor Contains the color we create the mask from. All matching colors in the image will become part of the mask.
inUseZeroPixelColor If true, then the color at pixel 0, 0 will be used as the color to create the mask from.
Exceptions:
none 
Returns:
void

void CP_ImageList::AddIconImage_Mac SInt16  inImageID  )  [private]
 

Add a new image to our list. inImageID should be the resource id of a 'cicn'.

Parameters:
inImageID Resource id of the icon image to add.
Exceptions:
none 
Returns:
void

void CP_ImageList::AddIconImage_Mac CP_OSIcon inImage  )  [private]
 

Add the image from a passed in CP_OSIcon object to our list. The image in the icon can be of any type supported by a CP_OSIcon.

Parameters:
inImage A CP_OSIcon containing the image to add.
Exceptions:
none 
Returns:
void

void CP_ImageList::CopyIconData_Mac OSColorIcon  inIconData  )  [private]
 

Copy the icon data from a passed in CIconHandle to the last image in the list.

Parameters:
inIconData A CIconHandle containing the icons image, both image and mask.
Exceptions:
none 
Returns:
void

void CP_ImageList::CopyIconData_Mac_IconSuite IconSuiteRef  inIconData  )  [private]
 

Copy the icon data from a passed in IconSuiteRef to the last image in the list.

Parameters:
inIconData An IconSuiteRef containing the icons image.
Exceptions:
none 
Returns:
void

void CP_ImageList::CopyIconData_Mac_IconReference IconRef  inIconData  )  [private]
 

Copy the icon data from a passed in IconRef to the last image in the list.

Parameters:
inIconData An IconRef containing the icons image.
Exceptions:
none 
Returns:
void

void CP_ImageList::CopyImageTo_Mac CP_Canvas inCanvas,
SInt16  inImageIndex,
const CP_Point inDestLocation,
bool  inShowSelected = false,
bool  isActive = true
[private]
 

Copy an image onto the destination CP_Canvas object.

Parameters:
inCanvas A CP_Canvas we draw onto.
inImageIndex The index of the image in the list.
inDestLocation The location of the image we are drawing.
inShowSelected If true, the image is drawn in a selected state.
isActive If true, the image is drawn in an active state.
Exceptions:
none 
Returns:
void

void CP_ImageList::CreateRGBMask_Mac CP_RGBColor inMaskColor,
const CP_Rect inImageArea,
bool  inUseZeroPixelColor = false
[private]
 

Create the mask for our image based on the passed in inMaskColor or inUseZeroPixelColor flag.

Parameters:
inMaskColor The CP_RGBColor specifying the color to use for the mask.
inImageArea The source image area to calculate the mask from.
inUseZeroPixelColor If true, then the color of the pixel at 0, 0 is used instead of the passed in mask color.
Exceptions:
none 
Returns:
void

UInt32 CP_M_RefCounted::AddReference  )  const [inherited]
 

Add a reference to our object, returning the new reference count.

Exceptions:
none 
Returns:
UInt32 const Returns the new reference count.

UInt32 CP_M_RefCounted::RemoveReference  )  const [inherited]
 

Remove a reference to our object, returning the new reference count. If the count is 0, then this object is also deleted, and 0 is returned.

Exceptions:
none 
Returns:
UInt32 const Returns the new reference count.

void CP_M_RefCounted::Autorelease  )  const [inherited]
 

Add the object to the topmost auto-release pool. This will ensure that the object is eventually released.

See also:
CP_AutoReleasePool
Exceptions:
none 
Returns:
void

UInt32 CP_M_RefCounted::GetRefCount  )  const [inherited]
 

Returns the current ref count.

Exceptions:
none 
Returns:
UInt32 The current referencce count.


Member Data Documentation

OSImageList CP_ImageList::fImages [protected]
 

OSImageList CP_ImageList::fMasks [protected]
 

Contains the images arranged in a bitmap imageWidth * numberOfImages horizontally, and imageHeight vertically.

SInt16 CP_ImageList::fImageWidth [protected]
 

Contains the masks for the above images, stored the same way.

SInt16 CP_ImageList::fImageHeight [protected]
 

Width in pixels of a single image.

SInt16 CP_ImageList::fNumberImages [protected]
 

Height in pixels of a single image.

SInt16 CP_ImageList::fMaxNumberImages [protected]
 

Number of images stored in the list.

SInt16 CP_ImageList::fImageGrowAmt [protected]
 

The maximum number of images we can store.

bool CP_ImageList::fIsMasked [protected]
 

Number of images to increase the bitmap, when we resize to accommodate more images.

UInt16 CP_ImageList::fSlopValue [protected]
 

Flag to indicate if the images are masked.

SInt32 CP_ImageList::fTransferMode [protected]
 

Value used to calculate if colors are close enough to use as a mask.

GWorldPtr CP_ImageList::fSavedPort [protected]
 

Transfer mode used to copy the images to the destination canvas.

GDHandle CP_ImageList::fSavedDevice [protected]
 

MacOS saved GWorld when drawing into our image list.


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:21:49 2005 for CPLAT_MacOS by  doxygen 1.4.0