c4d.bitmaps.GeClipMap
¶
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
¶
GeClipMap.Blit()
GeClipMap.SetPixel()
GeClipMap.Line()
GeClipMap.Rect()
GeClipMap.FillRect()
GeClipMap.Arc()
GeClipMap.FillArc()
GeClipMap.Ellipse()
GeClipMap.FillEllipse()
GeClipMap.GetFontName()
GeClipMap.GetFontDescription()
GeClipMap.EnumerateFonts()
GeClipMap.GetDefaultFont()
GeClipMap.GetFontSize()
GeClipMap.SetFontSize()
GeClipMap.
__init__
(
)
¶
Creates a new instance of
GeClipMap
.
Return type: | c4d.bitmaps.GeClipMap |
---|---|
Returns: | The new clipmap. |
GeClipMap.
Init
(
w
,
h
[
,
bits=32
]
)
¶
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. |
GeClipMap.
InitWith
(
name
,
frame
)
¶
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: |
The image result and a boolean value if the file is a movie. |
GeClipMap.
InitWithBitmap
(
bm
[
,
alpha_channel=None
]
)
¶
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 . |
GeClipMap.
Destroy
(
)
¶
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.
GeClipMap.
GetBitmap
(
)
¶
Returns the internal bitmap object.
Note
The clip map alpha channel won’t be encoded in this bitmap. This is a limitation.
Return type: | c4d.bitmaps.BaseBitmap |
---|---|
Returns: | The bitmap. |
GeClipMap.
BeginDraw
(
)
¶
Must be called before any drawing commands.
Note
After you call a sequence of drawing commands you should call
GeClipMap.EndDraw()
.
GeClipMap.
EndDraw
(
)
¶
Must be called after any drawing commands.
Note
Before you call a sequence of drawing commands you should call
GeClipMap.BeginDraw()
.
GeClipMap.
GetDim
(
)
¶
Retrieves the pixel dimensions of the clip map:
w, h = clmap.GetDim()
Return type: | tuple of int |
---|---|
Returns: | The width and height dimensions of the clip map. |
GeClipMap.
GetBw
(
)
¶
Retrieves the pixel width of the clip map.
Return type: | int |
---|---|
Returns: | The width. |
GeClipMap.
GetBh
(
)
¶
Retrieves the pixel height of the clip map.
Return type: | int |
---|---|
Returns: | The height. |
GeClipMap.
Blit
(
dx
,
dy
,
s_dp
,
sx1
,
sy1
,
sx2
,
sy2
,
rop
)
¶
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: |
|
---|
GeClipMap.
SetColor
(
r
,
g
,
b
[
,
alpha=255
]
)
¶
Sets the draw color.
Parameters: |
|
---|
GeClipMap.
SetOffset
(
off_x
,
off_y
)
¶
Offsets all the following draw commands by this amount.
Note
The clip region is not offset.
Parameters: |
|
---|
GeClipMap.
SetDrawMode
(
mode
,
par
)
¶
Sets the draw mode for the following drawing operations.
Parameters: |
|
---|
GeClipMap.
SetPixel
(
x
,
y
)
¶
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: |
|
---|
GeClipMap.
Line
(
x1
,
y1
,
x2
,
y2
)
¶
Draws a line from ( x1,y1 ) to ( x2,y2 ) with the draw color.
Parameters: |
|
---|
GeClipMap.
Rect
(
x1
,
y1
,
x2
,
y2
)
¶
Draws the outline of a rectangle from ( x1,y1 ) to ( x2,y2 ) with the draw color.
Parameters: |
|
---|
GeClipMap.
FillRect
(
x1
,
y1
,
x2
,
y2
)
¶
Fills a rectangle from ( x1,y1 ) to ( x2,y2 ) with the draw color.
Parameters: |
|
---|
GeClipMap.
Arc
(
x1
,
y1
,
x2
,
y2
,
seg
)
¶
Fills a rectangle from ( x1,y1 ) to ( x2,y2 ) with the draw color.
Parameters: |
|
---|
GeClipMap.
FillArc
(
x1
,
y1
,
x2
,
y2
,
seg
)
¶
Draws an arc within the rectangle from ( x1,y1 ) to ( x2,y2 ) with the draw color.
Parameters: |
|
---|
GeClipMap.
Ellipse
(
x1
,
y1
,
x2
,
y2
)
¶
Draws an ellipse within the rectangle from ( x1,y1 ) to ( x2,y2 ) with the draw color.
Parameters: |
|
---|
GeClipMap.
FillEllipse
(
x1
,
y1
,
x2
,
y2
)
¶
Fills an ellipse within the rectangle from ( x1,y1 ) to ( x2,y2 ) with the draw color.
Parameters: |
|
---|
GeClipMap.
SetPixelRGBA
(
x
,
y
,
r
,
g
,
b
[
,
a=255
]
)
¶
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: |
|
---|
GeClipMap.
GetPixelRGBA
(
x
,
y
)
¶
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 of the pixel. |
GeClipMap.
TextAt
(
x
,
y
,
txt
)
¶
Prints the string txt with the top left corner at ( x,y ) in the current draw color.
Parameters: |
|
---|
GeClipMap.
TextWidth
(
txt
)
¶
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. |
GeClipMap.
TextHeight
(
)
¶
Calculates the maximum height of a string in the current font.
GeClipMap.
TextAscent
(
)
¶
Calculates the ascent in the current font. This is the distance from the baseline to the ascender line and usually represents the height of capital letters.
GeClipMap.
ClipPoint
(
x
,
y
)
¶
Checks if a point is inside the clip region.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the point is inside the region, otherwise False . |
GeClipMap.
ClipArea
(
x1
,
y1
,
x2
,
y2
)
¶
Checks if a rectangle is inside the clip region.
Parameters: |
|
||||||
---|---|---|---|---|---|---|---|
Return type: |
int |
||||||
Returns: |
The result:
|
GeClipMap.
SetFont
(
font_description
,
font_size
)
¶
Sets the current font.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
GeClipMap.
GetFont
(
font_description
)
¶
Returns the current font description.
Parameters: | font_description ( c4d.BaseContainer ) – Assigned the current font description. |
---|---|
Return type: | float |
Returns: | The font size. |
GeClipMap.
GetFontName
(
font_description
,
type
)
¶
New in version R17.032.
Retrieves the font name from a font description.
Parameters: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
Return type: |
str |
||||||||
Returns: |
The font name. |
GeClipMap.
GetFontDescription
(
name
,
type
)
¶
New in version R17.032.
Retrieves a font description.
Parameters: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
Return type: | |||||||||
Returns: |
The font description. |
GeClipMap.
EnumerateFonts
(
sort_mode
)
¶
New in version R17.032.
Enumerates all fonts and returns them in a container. For each font a container (font description) will be inserted. They can be used for
SetFont()
and
GetFontName()
.
Parameters: |
sort_mode
(
str
) –
The sort mode:
|
||||
---|---|---|---|---|---|
Return type: | c4d.BaseContainer | ||||
Returns: | The font list. |
GeClipMap.
GetDefaultFont
(
type
)
¶
New in version R17.032.
Retrieves Cinema 4D’s default font.
Parameters: |
type
(
int
) –
The default font type:
|
||||
---|---|---|---|---|---|
Return type: | c4d.BaseContainer | ||||
Returns: | The default font description. |
GeClipMap.
GetFontSize
(
font_description
,
type
)
¶
New in version R17.032.
Retrieves the font size for a given font.
Parameters: |
|
||
---|---|---|---|
Return type: |
float |
||
Returns: |
The font size. |
GeClipMap.
SetFontSize
(
font_description
,
type
,
size
)
¶
New in version R17.032.
Sets the font size for a given font.
Parameters: |
|
||
---|---|---|---|
Return type: |
bool |
||
Returns: |
True if successful, otherwise False . |