This class stores and manipulates a bitmap, providing more advanced drawing tools than BaseBitmap. Just like for bitmaps x = y = 0 is the top left corner. Be sure to call GeClipMap.Init(), GeClipMap.InitWith() or GeClipMap.InitWithBitmap() before you attempt to use a newly allocated clip map.
Note
Though clip maps support other bit depths than 32, the functionality is severly limited. It is recommended that the clip map class is only used for 32 bit bitmaps. (Please note that the default bit depth for BaseBitmap is 24. You need to manually set it to 32 if you use Init to initialize the clip map.)
- c4d.bitmaps.GeClipMap
Creates a new instance of GeClipMap.
Return type: | GeClipMap |
---|---|
Returns: | The new clipmap. |
Initializes the clip map bitmap to the given dimensions and depth. Any previous data is lost.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the initialization was successfull. |
Loads the clip map bitmap from the file specified by name. The file can be either a movie or a picture. The file format is automatically detected. Any previous data is lost:
result, ismovie = clmap.InitWith(path)
if result==c4d.IMAGERESULT_OK: #int check
# picture loaded
if ismovie==True: #bool check
pass # file is a movie
else:
pass # file is no movie
Parameters: |
|
---|---|
Return type: |
tuple(int, bool) |
Returns: |
Return the image result and a boolean value if the file is a movie. |
Loads the clip map bitmap from bm. Any previous data is lost.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the clip map was initialized, otherwise False. |
Resets the clip map to its initial state and frees allocated memory. Requires a new call to Init() before the clip map can be used again.
Returns the internal bitmap object.
Note
The clip map alpha channel won’t be encoded in this bitmap. This is a limitation.
Return type: | BaseBitmap |
---|---|
Returns: | The bitmap. |
Must be called before any drawing commands. After you called a sequence of drawing commands you should call GeClipMap.EndDraw().
Must be called after any drawing commands. Before you called a sequence of drawing commands you should call GeClipMap.BeginDraw().
Retrieves the pixel dimensions of the clip map:
x, y = clmap.GetDim()
Retrieves the pixel width of the clip map.
Return type: | int |
---|---|
Returns: | The width. |
Retrieves the pixel height of the clip map.
Return type: | int |
---|---|
Returns: | The height. |
Blits from s_dp to this clip map. The region (sx1, sy1) to (sx2, sy2) from the source will be copied into the region with the top left corner at (dx, dy) in the destination. Additionally you can specify a raster operation with rop.
Parameters: |
|
---|
Checks if the draw operation mode is initialized.
Note
Call BeginDraw() before
Parameters: |
|
---|
Offsets all the following draw commands by this amount.
Note
The clip region isn’t offset.
Parameters: |
|
---|
Sets the draw mode for the following drawing operations.
Parameters: |
|
---|
Sets the pixel at (x,y) to the draw color.
Note
Currently this method does no range check of x and y. This might be added in the future. Please do the check on your own.
Parameters: |
|
---|
Draws a line from (x1,y1) to (x2,y2) with the draw color.
Parameters: |
|
---|
Draws the outline of a rectangle from (x1,y1) to (x2,y2) with the draw color.
Parameters: |
|
---|
Fills a rectangle from (x1,y1) to (x2,y2) with the draw color.
Parameters: |
|
---|
Fills a rectangle from (x1,y1) to (x2,y2) with the draw color.
Parameters: |
|
---|
Draws an arc within the rectangle from (x1,y1) to (x2,y2) with the draw color.
Parameters: |
|
---|
Draws an ellipse within the rectangle from (x1,y1) to (x2,y2) with the draw color.
Parameters: |
|
---|
Fills an ellipse within the rectangle from (x1,y1) to (x2,y2) with the draw color.
Parameters: |
|
---|
Sets the pixel at (x,y) to the specified color.
Note
Currently this method does no range check of x and y. This might be added in the future. Please do the check on your own.
Parameters: |
|
---|
Retrieves the color of the pixel at (x,y):
r, g, b, a = clmap.GetPixelRGBA(5, 5)
Note
Currently this method does no range check of x and y. This might be added in the future. Please do the check on your own.
Parameters: |
|
---|---|
Return type: |
list of int |
Returns: |
The color. |
Prints the string txt with the top left corner at (x,y) in the current draw color.
Parameters: |
|
---|
Calculates the width of the string txt in the current font.
Parameters: | txt (str) – The string. |
---|---|
Return type: | int |
Returns: | Calculates the maximum height of a string in the current font. |
Calculates the maximum height of a string in the current font.
Calculates the ascent in the current font. This is the distance from the baseline to the ascender line and usually represents the the height of capital letters.
Checks if a point is inside the clip region.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the point is inside the region, otherwise False. |
Checks if a rectangle is inside the clip region.
Parameters: |
|
||||||
---|---|---|---|---|---|---|---|
Return type: |
int |
||||||
Returns: |
The result:
|
New in version R13.029.
Sets the current font.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False. |
New in version R13.029.
Returns the current font description.
Parameters: | font_description (BaseContainer) – Assigned the current font description. |
---|---|
Return type: | float |
Returns: | The font size. |