Icon Collection

Detailed Description

Groups

 ICONFLAG
 

Macros

#define LIBRARY_ICON_COLLECTION
 

Functions

Bool RegisterIcon (Int32 iconId, BaseBitmap *bmp, Int32 x=0, Int32 y=0, Int32 w=-1, Int32 h=-1, ICONFLAG flags=ICONFLAG::NONE)
 
Bool RegisterIcon (Int32 iconId, Filename fn, Int32 x=0, Int32 y=0, Int32 w=-1, Int32 h=-1, ICONFLAG flags=ICONFLAG::NONE)
 
Bool GetIcon (Int32 iconId, IconData *data)
 
Bool ColorizeIcon (Int32 iconId, const GeData &color)
 
BaseBitmapGetColorizedIcon (Int32 iconId, const GeData &color)
 
BaseBitmapGetColorizedIconFromCache (Int32 iconId, const GeData &color)
 
Bool UnregisterIcon (Int32 iconId)
 

Macro Definition Documentation

◆ LIBRARY_ICON_COLLECTION

#define LIBRARY_ICON_COLLECTION

Icon collection library ID.

Function Documentation

◆ RegisterIcon() [1/2]

Bool cinema::RegisterIcon ( Int32  iconId,
BaseBitmap bmp,
Int32  x = 0,
Int32  y = 0,
Int32  w = -1,
Int32  h = -1,
ICONFLAG  flags = ICONFLAG::NONE 
)

Registers an icon from a bitmap.
Optionally a sub-icon can be specified within a larger image by giving a rectangle from (x,y) to (x+w, y+h).
If no rectangle is specified the whole bitmap is used.

Warning
Unless ICONFLAG::COPY is set make sure that bmp points to a bitmap that will always be available.
Parameters
[in]iconIdA unique plugin ID. Must be obtained from developers.maxon.net.
[in]bmpThe bitmap to use for the icon. The caller owns the pointed bitmap.
[in]xOptional X coordinate of the top left corner of the sub-icon rectangle.
[in]yOptional Y coordinate of the top left corner of the sub-icon rectangle.
[in]wOptional width of the sub-icon rectangle.
[in]hOptional height of the sub-icon rectangle.
[in]flagsThe flags: ICONFLAG
Returns
true if the icon was registered, otherwise false.

◆ RegisterIcon() [2/2]

Bool cinema::RegisterIcon ( Int32  iconId,
Filename  fn,
Int32  x = 0,
Int32  y = 0,
Int32  w = -1,
Int32  h = -1,
ICONFLAG  flags = ICONFLAG::NONE 
)

Registers an icon from an image file.
Optionally a sub-icon can be specified within a larger image by giving a rectangle from (x,y) to (x+w, y+h).
If no rectangle is specified the whole bitmap is used.

Parameters
[in]iconIdA unique plugin ID. Must be obtained from developers.maxon.net.
[in]fnThe filename of the image file to use for the icon.
[in]xOptional X coordinate of the top left corner of the sub-icon rectangle.
[in]yOptional Y coordinate of the top left corner of the sub-icon rectangle.
[in]wOptional width of the sub-icon rectangle.
[in]hOptional height of the sub-icon rectangle.
[in]flagsThe flags: ICONFLAG. Note that ICONFLAG::COPY is not relevant in this context.
Returns
true if the icon was registered, otherwise false.

◆ GetIcon()

Bool cinema::GetIcon ( Int32  iconId,
IconData data 
)

Retrieves an icon registered with RegisterIcon().

Parameters
[in]iconIdThe ID of the icon.
[in,out]dataFilled with information about the found icon. The caller owns the pointed icon data.
Returns
true if the icon data was retrieved, otherwise false.

◆ ColorizeIcon()

Bool cinema::ColorizeIcon ( Int32  iconId,
const GeData color 
)

Colorizes an icon registered with RegisterIcon() in the given color. If color is empty or not a valid, the icon will be restored (i.e. "de-colorized") to its original state.

Parameters
[in]iconIdThe ID of the icon.
[in]colorThe color. Can be either a valid color ID from c4d_colors.h, e.g. COLOR_BG or a Vector color in range (0.0,1.0) or an empty or invalid data, which will de-colorize the icon.
Returns
true if the icon data was properly colorized, otherwise false.

◆ GetColorizedIcon()

BaseBitmap* cinema::GetColorizedIcon ( Int32  iconId,
const GeData color 
)

Returns a colorized copy of the defined icon. If color is empty or not a valid, the returned copied will be the original non-colorized version of the icon.

Parameters
[in]iconIdThe ID of the icon.
[in]colorThe color. Can be either a valid color ID from c4d_colors.h, e.g. COLOR_BG or a Vector color in range (0.0,1.0) or an empty or invalid data, which will return a non-colorized icon.
Returns
A colorized copy of the icon bitmap. The caller owns the pointed bitmap..

◆ GetColorizedIconFromCache()

BaseBitmap* cinema::GetColorizedIconFromCache ( Int32  iconId,
const GeData color 
)

Returns a colorized copy of the defined icon. The icon is internally cached and shared across the program, therefore if you need to modify the icon further for specific uses, use GetColorizedIcon instead. If color is empty or not a valid, the returned copied will be the original non-colorized version of the icon.

Parameters
[in]iconIdThe ID of the icon.
[in]colorThe color. Can be either a valid color ID from c4d_colors.h, e.g. COLOR_BG or a Vector color in range (0.0,1.0) or an empty or invalid data, which will return a non-colorized icon.
Returns
A cached colorized copy of the icon bitmap. Cinema 4D takes over the ownership of the pointed bitmap.

◆ UnregisterIcon()

Bool cinema::UnregisterIcon ( Int32  iconId)

Unregisters an icon registered with RegisterIcon().

Parameters
[in]iconIdThe ID of the icon.
Returns
true if the icon was unregistered, otherwise false.