-
首页
-
C4D R23.110 C++ SDK
GeClipMap Class Reference
Library
»
Clipmap
#include <lib_clipmap.h>
详细描述
This class stores and manipulates a bitmap, providing more advanced drawing tools than
BaseBitmap
.
Be sure to call
Init()
before trying to use a newly allocated clip map.
-
注意
-
Though clip maps support other bit depths than
32
, the functionality is severely 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
).
-
Has to be created with
Alloc()
and destroyed with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
Drawing
|
void
|
SetPixel
(
Int32
x,
Int32
y)
|
void
|
Line
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2)
|
void
|
PolyLine
(
Int32
cnt,
GE_POINT2D
*points)
|
Bool
|
SupportsDrawBezierSegment
() const
|
void
|
DrawBezierSegment
(const
maxon::Vector2d
*p)
|
void
|
FillPolygon
(
Int32
cnt,
GE_POINT2D
*points)
|
void
|
Rect
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2)
|
void
|
FillRect
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2)
|
void
|
Arc
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2,
GE_CM_ARCSEGMENT
seg)
|
void
|
FillArc
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2,
GE_CM_ARCSEGMENT
seg)
|
void
|
Ellipse
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2)
|
void
|
FillEllipse
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2)
|
Get/Set Pixel
|
void
|
GetPixelRGBA
(
Int32
x,
Int32
y,
Int32
*r,
Int32
*g,
Int32
*b,
Int32
*a)
|
void
|
SetPixelRGBA
(
Int32
x,
Int32
y,
Int32
r,
Int32
g,
Int32
b,
Int32
a=255)
|
字体
|
static
Bool
|
GetFontName
(
BaseContainer
const *font_description,
GeFontNameType
type,
String
*dst)
|
static
Bool
|
GetFontDescription
(
String
const &name,
GeFontNameType
type,
BaseContainer
*dst)
|
static void
|
EnumerateFonts
(
BaseContainer
*dst,
GE_CM_FONTSORT
sort_mode)
|
static
Bool
|
GetDefaultFont
(
GeFontDefaultType
type,
BaseContainer
*font_description)
|
static
Bool
|
GetFontSize
(
BaseContainer
const *font_description,
GeFontSizeType
type,
Float
*size)
|
static
Bool
|
SetFontSize
(
BaseContainer
*font_description,
GeFontSizeType
type,
Float
size)
|
Bool
|
SetFont
(
BaseContainer
const *font_description,
Float
font_size=0.0)
|
Float
|
GetFont
(
BaseContainer
*font_description)
|
构造函数 & 析构函数文档编制
◆
GeClipMap()
◆
~GeClipMap()
成员函数文档编制
◆
Alloc()
Allocates a clip map. Destroy the allocated clip map with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
返回
-
The allocated clip map, or
nullptr
if the allocation failed.
◆
Free()
Destructs clip maps allocated with
Alloc()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[in]
|
data
|
The clip map to destruct. If the pointer is
nullptr
nothing happens. The pointer is assigned
nullptr
afterwards.
|
◆
Init()
[1/6]
Initializes the clip map bitmap to the given dimensions and depth. Any previous data is lost.
-
参数
-
[in]
|
w
|
The width in pixels.
|
[in]
|
h
|
The height in pixels.
|
[in]
|
bits
|
The requested bit depth. The possible values are {
1
,
4
,
8
,
16
,
24
,
32}
. On some platforms
32
bits will be used even if
24
is requested, to allow for padding.
|
-
返回
-
The result:
IMAGERESULT
◆
Init()
[2/6]
Loads the clip map bitmap from
bm
. Any previous data is lost.
-
参数
-
[in]
|
bm
|
The bitmap to initialize the clip map with. The caller owns the pointed bitmap.
|
-
返回
-
The result:
IMAGERESULT
◆
Init()
[3/6]
Loads the clip map bitmap from
bm
with the specified alpha channel. Any previous data is lost.
-
参数
-
[in]
|
bm
|
The bitmap to initialize the clip map with. The caller owns the pointed bitmap.
|
[in]
|
alpha_channel
|
The alpha channel to use in
bm
. The caller owns the pointed bitmap.
|
-
返回
-
The result:
IMAGERESULT
◆
Init()
[4/6]
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.
-
参数
-
[in]
|
name
|
A valid filename.
|
[in]
|
frame
|
The frame number to load in a movie.
|
[out]
|
ismovie
|
If not
nullptr
this is assigned
true
if the loaded picture was a movie, and
false
otherwise.
|
-
返回
-
The result:
IMAGERESULT
◆
Init()
[5/6]
Loads the clip map bitmap from
iconData
. Any previous data is lost.
-
参数
-
[in]
|
iconData
|
The icon data to initialize the clip map with.
|
-
返回
-
The result:
IMAGERESULT
◆
Init()
[6/6]
◆
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.
◆
GetDim()
Retrieves the pixel dimensions of the clip map.
-
参数
-
[in]
|
w
|
Assigned the width.
|
[in]
|
h
|
Assigned the height.
|
◆
GetBw()
Retrieves the pixel width of the clip map.
-
返回
-
The width.
◆
GetBh()
Retrieves the pixel height of the clip map.
-
返回
-
The height.
◆
GetBitmap()
[1/2]
Retrieves a pointer to the internal bitmap.
-
警告
-
The clip map alpha channel will not be encoded in this bitmap. This is a limitation.
-
返回
-
The internal bitmap. The clip map owns the pointed bitmap.
◆
GetBitmap()
[2/2]
◆
BeginDraw()
Must be called before any drawing functions.
◆
EndDraw()
Must be called after a sequence of drawing functions to free the memory allocated by
BeginDraw()
.
◆
SetOffset()
Offsets all the following draw commands by the given amount.
-
注意
-
The clip region is not offset.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
off_x
|
The X distance in pixels.
|
[in]
|
off_y
|
The Y distance in pixels.
|
◆
SetDrawMode()
Sets the draw mode.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
mode
|
The draw mode:
GE_CM_DRAWMODE
|
[in]
|
par
|
The parameter, depends on
mode
.
|
◆
SetColor()
Sets the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
r
|
The red value. (Between
0
and
255
.)
|
[in]
|
g
|
The green value. (Between
0
and
255
.)
|
[in]
|
b
|
The blue value. (Between
0
and
255
.)
|
[in]
|
a
|
The alpha value. (Between
0
and
255
.)
|
◆
SetPixel()
Sets the pixel at (
x
,
y
) to the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x
|
The X coordinate.
|
[in]
|
y
|
The Y coordinate.
|
◆
Line()
Draws a line from (
x1
,
y1
) to (
x2
,
y2
) with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x1
|
The first X coordinate.
|
[in]
|
y1
|
The first Y coordinate.
|
[in]
|
x2
|
The second X coordinate.
|
[in]
|
y2
|
The second Y coordinate.
|
◆
PolyLine()
Draws the polygon line specified by the
cnt
points
with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
cnt
|
The number of elements in
points
.
|
[in]
|
points
|
The points in the polygon line. The caller owns the pointed array.
|
◆
SupportsDrawBezierSegment()
Bool
SupportsDrawBezierSegment
|
(
|
|
)
|
const
|
SupportsDrawBezierSegment returns true if the clipmap supports
DrawBezierSegment()
.
-
返回
-
true on success.
◆
DrawBezierSegment()
DrawBezierSegment description.
-
参数
-
[in]
|
p
|
4 points for the bezier segment [p1, c1, c2, p2].
|
◆
FillPolygon()
Fills the polygon line specified by the
cnt
points
with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
cnt
|
The number of elements in
points
.
|
[in]
|
points
|
The points in the polygon. The caller owns the pointed array.
|
◆
Rect()
Draws the outline of a rectangle from (
x1
,
y1
) to (
x2
,
y2
) with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x1
|
The top left X coordinate.
|
[in]
|
y1
|
The top left Y coordinate.
|
[in]
|
x2
|
The bottom right X coordinate.
|
[in]
|
y2
|
The bottom right Y coordinate.
|
◆
FillRect()
Fills a rectangle from (
x1
,
y1
) to (
x2
,
y2
) with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x1
|
The top left X coordinate.
|
[in]
|
y1
|
The top left Y coordinate.
|
[in]
|
x2
|
The bottom right X coordinate.
|
[in]
|
y2
|
The bottom right Y coordinate.
|
◆
Arc()
Draws an arc within the rectangle from (
x1
,
y1
) to (
x2
,
y2
) with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x1
|
The top left X coordinate.
|
[in]
|
y1
|
The top left Y coordinate.
|
[in]
|
x2
|
The bottom right X coordinate.
|
[in]
|
y2
|
The bottom right Y coordinate.
|
[in]
|
seg
|
The arc is drawn in the direction given by:
GE_CM_ARCSEGMENT
|
◆
FillArc()
Fills an arc within the rectangle from (
x1
,
y1
) to (
x2
,
y2
) with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x1
|
The top left X coordinate.
|
[in]
|
y1
|
The top left Y coordinate.
|
[in]
|
x2
|
The bottom right X coordinate.
|
[in]
|
y2
|
The bottom right Y coordinate.
|
[in]
|
seg
|
The arc is drawn in the direction given by:
GE_CM_ARCSEGMENT
|
◆
Ellipse()
Draws an ellipse within the rectangle from (
x1
,
y1
) to (
x2
,
y2
) with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x1
|
The top left X coordinate.
|
[in]
|
y1
|
The top left Y coordinate.
|
[in]
|
x2
|
The bottom right X coordinate.
|
[in]
|
y2
|
The bottom right Y coordinate.
|
◆
FillEllipse()
Fills an ellipse within the rectangle from (
x1
,
y1
) to (
x2
,
y2
) with the draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x1
|
The top left X coordinate.
|
[in]
|
y1
|
The top left Y coordinate.
|
[in]
|
x2
|
The bottom right X coordinate.
|
[in]
|
y2
|
The bottom right Y coordinate.
|
◆
GetPixelRGBA()
Retrieves the color of the pixel at (
x
,
y
).
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x
|
The X coordinate.
|
[in]
|
y
|
The Y coordinate.
|
[out]
|
r
|
Assigned the red value. (Between
0
and
255
.)
|
[out]
|
g
|
Assigned the green value. (Between
0
and
255
.)
|
[out]
|
b
|
Assigned the blue value. (Between
0
and
255
.)
|
[out]
|
a
|
Assigned the alpha value. (Between
0
and
255
.)
|
◆
SetPixelRGBA()
Sets the pixel at (
x
,
y
) to the specified color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x
|
The X coordinate.
|
[in]
|
y
|
The Y coordinate.
|
[in]
|
r
|
The red value. (Between
0
and
255
.)
|
[in]
|
g
|
The green value. (Between
0
and
255
.)
|
[in]
|
b
|
The blue value. (Between
0
and
255
.)
|
[in]
|
a
|
Alpha value. (Between
0
and
255
.)
|
◆
TextAt()
Draws the string
txt
at (
x
,
y
) with the current draw color.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
x
|
The top left X coordinate.
|
[in]
|
y
|
The top left Y coordinate.
|
[in]
|
txt
|
The text.
|
◆
GetTextWidth()
Calculates the width of the string
txt
in the current font.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
-
返回
-
The text width.
◆
GetTextHeight()
Calculates the maximum height of text in the current font.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
返回
-
The text height.
◆
GetTextAscent()
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.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
返回
-
The text ascent.
◆
Blit()
Blits from s_dp to the 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 specify a raster operation with
rop
.
-
警告
-
This function must be enclosed between
BeginDraw()
and
EndDraw()
.
-
参数
-
[in]
|
dx
|
The top left destination X coordinate.
|
[in]
|
dy
|
The top left destination Y coordinate.
|
[in]
|
s_dp
|
The source.
|
[in]
|
sx1
|
The top left source X coordinate.
|
[in]
|
sy1
|
The top left source Y coordinate.
|
[in]
|
sx2
|
The bottom right source X coordinate.
|
[in]
|
sy2
|
The bottom right source Y coordinate.
|
[in]
|
rop
|
The raster operation:
GE_CM_BLIT
|
◆
SetClipRgn()
[1/2]
Sets the clipping region of the clip map. This affects all drawing commands so that nothing is drawn outside the region specified by (
left
,
top
) to (
right
,
bottom
).
-
参数
-
[in]
|
left
|
The left position of the clipping region.
|
[in]
|
top
|
The top position of the clipping region.
|
[in]
|
right
|
The right position of the clipping region.
|
[in]
|
bottom
|
The bottom position of the clipping region.
|
◆
SetClipRgn()
[2/2]
Sets the stored region to the inside of the polygonal path specified by the
points
array.
-
参数
-
[in]
|
points
|
An array of
count
points with the polygonal path. The caller owns the pointed array.
|
[in]
|
count
|
The number of elements in the
points
array.
|
[in]
|
mode
|
The method used to determine the inside of the path:
GE_CM_CLIPREGION
|
◆
ClipPoint()
Checks if a point is inside the clipping region.
-
参数
-
[in]
|
x
|
The X coordinate.
|
[in]
|
y
|
The Y coordinate.
|
-
返回
-
true
if the point is inside the clipping region, otherwise
false
.
◆
ClipArea()
Checks if a rectangle is inside the clipping region.
-
参数
-
[in]
|
x1
|
The top left X coordinate.
|
[in]
|
y1
|
The top left Y coordinate.
|
[in]
|
x2
|
The bottom right X coordinate.
|
[in]
|
y2
|
The bottom right Y coordinate.
|
-
返回
-
The result.
◆
SetFont()
Sets the current font.
-
参数
-
[in]
|
font_description
|
The font description. Obtained from
GeChooseFont()
,
GetFontDescription()
,
EnumerateFonts()
or
nullptr
for the default font. The caller owns the pointed base container.
|
[in]
|
font_size
|
The font size, or
0.0
for the default height.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetFont()
Retrieves the current font.
-
参数
-
[out]
|
font_description
|
Assigned the current font description. The caller owns the pointed base container.
|
-
返回
-
The font size.
◆
GetFontName()
Retrieves the font name from a font description.
-
参数
-
[in]
|
font_description
|
The font description. The caller owns the pointed base container.
|
[in]
|
type
|
The type of name:
GeFontNameType
|
[out]
|
dst
|
Assigned the font name. The caller owns the pointed string.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetFontDescription()
Retrieves a font description.
-
参数
-
[in]
|
name
|
The font name.
|
[in]
|
type
|
The type of font name:
GeFontNameType
|
[out]
|
dst
|
Assigned the font description. The caller owns the pointed base container.
|
-
返回
-
true
if successful, otherwise
false
.
◆
EnumerateFonts()
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()
,
GetFontName()
or as input for
GeChooseFont()
.
-
参数
-
[out]
|
dst
|
Assigned the font list. The caller owns the pointed base container.
|
[in]
|
sort_mode
|
The sort mode:
GE_CM_FONTSORT
|
◆
GetDefaultFont()
Retrieves
Cinema 4D
's default font.
-
参数
-
[in]
|
type
|
The default font type:
GeFontDefaultType
|
[out]
|
font_description
|
Assigned the font description. The caller owns the pointed base container.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetFontSize()
Retrieves the font size for a given font.
-
参数
-
[in]
|
font_description
|
The font description. The caller owns the pointed base container.
|
[in]
|
type
|
The font size type:
GeFontSizeType
|
[out]
|
size
|
Assigned the font size.
|
-
返回
-
true
if successful, otherwise
false
.
◆
SetFontSize()
Sets the font size for a given font.
-
参数
-
[in]
|
font_description
|
The font description. The caller owns the pointed base container.
|
[in]
|
type
|
The font size type:
GeFontSizeType
|
[in]
|
size
|
The font size to set.
|
-
返回
-
true
if successful, otherwise
false
.