About
GeClipMap is a utility class that allows to perform advanced drawing operations.
Allocation/Deallocation
A GeClipMap can be created with the usual tools:
- GeClipMap::Alloc(): Creates a new GeClipMap.
- GeClipMap::Free(): Deletes the given GeClipMap.
The created GeClipMap can be initiated in multiple ways:
- GeClipMap::Init(Int32 w, Int32 h, Int32 bits): Initiates the GeClipMap with the given dimensions.
- GeClipMap::Init(BaseBitmap *bm): Initiates the GeClipMap by loading the given BaseBitmap.
- GeClipMap::Init(BaseBitmap *bm, BaseBitmap *alpha_channel): Initiates the GeClipMap by loading the given BaseBitmap and alpha channel.
- GeClipMap::Init(const Filename &name, Int32 frame, Bool *ismovie): Initiates the GeClipMap by loading the given image file.
- GeClipMap::Init(const IconData &iconData): Initiates the GeClipMap by loading the IconData.
AutoAlloc<GeClipMap> clipMap;
if (clipMap == nullptr)
const Int32 height = 1024;
clipMap->BeginDraw();
clipMap->SetColor(255, 0, 0);
clipMap->FillRect(0, 0,
width - 1, height - 1);
clipMap->EndDraw();
BaseBitmap* const bitmap = clipMap->GetBitmap();
if (bitmap == nullptr)
Py_UCS4 * res
Definition: unicodeobject.h:1113
OK
User has selected a font.
Definition: customgui_fontchooser.h:0
IMAGERESULT
Definition: ge_prepass.h:3947
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
Bool ShowBitmap(const Filename &fn)
maxon::Int32 Int32
Definition: ge_sys_math.h:51
unsigned long Py_ssize_t width
Definition: pycore_traceback.h:88
A GeClipMap is easily cleared with:
- GeClipMap::Destroy(): Resets the clip map to its initial state.
Read-Only Properties
The basic settings of a GeClipMap are accessed with:
- GeClipMap::GetDim(): Gets the dimensions of the GeClipMap.
- GeClipMap::GetBw(): Returns the width of the GeClipMap.
- GeClipMap::GetBh(): Returns the height of the GeClipMap.
The bitmap data is stored internally as a BaseBitmap:
- GeClipMap::GetBitmap(): Returns a pointer to the internal BaseBitmap.
Drawing
Every drawing operation performed with a GeClipMap must be encapsulated between these two functions:
- GeClipMap::BeginDraw(): Must be called before any drawing operation.
- GeClipMap::EndDraw(): Must be called after a sequence of drawing operations.
The drawing operations can be modified with:
- GeClipMap::SetDrawMode(): Sets the raw mode, see ::GE_CM_DRAWMODE.
- GeClipMap::SetColor(): Sets the currently used color.
- GeClipMap::SetOffset(): Sets the offset for all following drawing operations.
clipMap->BeginDraw();
clipMap->SetColor(255, 255, 255);
clipMap->FillRect(0, 0,
width - 1, height - 1);
{
const Int32 offsetX = 10 + (
i * 100);
const Int32 offsetY = 10;
clipMap->SetOffset(offsetX, offsetY);
}
clipMap->EndDraw();
Py_ssize_t i
Definition: abstract.h:645
#define iferr_return
Definition: resultbase.h:1531
A clipping region defines the part of the GeClipMap which will be affected by the following drawing operations.
- GeClipMap::SetClipRgn(): Sets the clipping region.
- GeClipMap::ClipPoint(): Returns true if the given point is in the clipping region.
- GeClipMap::ClipArea(): Returns true if the given area is in the clipping region.
Single pixels of the GeClipMap can be accessed with:
- GeClipMap::GetPixelRGBA(): Gets the RGBA values of the given coordinates.
- GeClipMap::SetPixelRGBA(): Sets the RGBA values of the given coordinates.
clipMap->GetDim(&clipMapWidth, &clipMapHeight);
clipMap->BeginDraw();
Random randomGen;
for (
Int32 x = 0;
x < clipMapWidth; ++
x)
{
for (
Int32 y = 0; y < clipMapHeight; ++y)
{
clipMap->SetPixelRGBA(
x, y, red, green, blue);
}
}
clipMap->EndDraw();
PyObject * x
Definition: bytesobject.h:38
static const Float COLORTOINT_MULTIPLIER
Constant to convert from vectors color components to integers.
Definition: c4d_tools.h:26
A blit operations allows to easily copy a part of a GeClipMap into another GeClipMap.
- GeClipMap::Blit(): Copies (a part) of the source GeClipMap into the GeClipMap.
const IMAGERESULT resSource = sourceClipMap->Init(sourceBitmap);
const IMAGERESULT resTarget = targetClipMap->Init(targetWidth, targetHeight, 32);
if (sourceImageOK && targetImageOK)
{
targetClipMap->BeginDraw();
targetClipMap->Blit(0, 0, *sourceClipMap, 0, 0, targetWidth, targetHeight,
GE_CM_BLIT::COPY);
targetClipMap->EndDraw();
}
COPY
New pixels overwrite old ones.
Definition: lib_clipmap.h:0
maxon::Bool Bool
Definition: ge_sys_math.h:46
Drawing Operations
These drawing operations allow to create basic shapes. The use the current color defined with GeClipMap::SetColor().
- GeClipMap::SetPixel(): Sets the given pixel.
- GeClipMap::Line(): Draws a line.
- GeClipMap::PolyLine(): Draws a polygon line using ::GE_POINT2D.
- GeClipMap::FillPolygon(): Draws a filled polygon using ::GE_POINT2D.
- GeClipMap::Rect(): Draws a rectangle.
- GeClipMap::FillRect(): Draws a filled rectangle.
- GeClipMap::Arc(): Draws an arc.
- GeClipMap::FillArc(): Draws a filled arc.
- GeClipMap::Ellipse(): Draws an ellipse.
- GeClipMap::FillEllipse(): Draws a filled ellipse.
- GeClipMap::DrawBezierSegment(): Draws a Bezier segment.
- GeClipMap::SupportsDrawBezierSegment(): Returns true if the GeClipMap supports GeClipMap::DrawBezierSegment().
clipMap->BeginDraw();
clipMap->SetColor(255, 255, 0);
clipMap->FillEllipse(10, 10, 90, 90);
clipMap->SetColor(0, 0, 0);
clipMap->FillEllipse(30, 30, 40, 50);
clipMap->FillEllipse(60, 30, 70, 50);
clipMap->EndDraw();
LEFTBOTTOM
(x2,y2) -> (x1,y2) -> (x1,y1)
Definition: lib_clipmap.h:2
RIGHTBOTTOM
(x2,y1) -> (x2,y2) -> (x1,y2)
Definition: lib_clipmap.h:1
Drawing Text
These functions are used to handle and draw text:
- GeClipMap::TextAt(): Draws the given text at the given coordinates.
- GeClipMap::GetTextWidth(): Returns the width of the given text using the current font.
- GeClipMap::GetTextHeight(): Returns the text height using the current font.
- GeClipMap::GetTextAscent(): Returns the ascent using the current font.
The currently used font is defined with:
- GeClipMap::GetFont(): Gets a BaseContainer with the current font description.
- GeClipMap::SetFont(): Sets the currently used font using a BaseContainer.
AutoAlloc<GeClipMap> clipMap;
if (clipMap == nullptr)
BaseContainer fontSettings;
clipMap->BeginDraw();
clipMap->SetFont(&fontSettings, 20.0);
const Int32 textWidth = clipMap->GetTextWidth(
text);
const Int32 textHeight = clipMap->GetTextHeight();
clipMap->EndDraw();
clipMap->Destroy();
res = clipMap->Init(textWidth, textHeight, 32);
clipMap->BeginDraw();
clipMap->SetColor(255, 255, 255, 255);
clipMap->FillRect(0, 0, textWidth - 1, textHeight - 1);
clipMap->SetColor(0, 0, 0, 255);
clipMap->SetFont(&fontSettings, 20.0);
clipMap->TextAt(0, 0,
text);
clipMap->EndDraw();
@ GE_FONT_NAME_POSTSCRIPT
Font postscript name (e.g. "Helvetica-Bold").
Definition: lib_clipmap.h:111
PyObject * text
Definition: pycore_traceback.h:70
These static functions are used to manage fonts:
- GeClipMap::GetDefaultFont(): Gets a description of the default font.
- GeClipMap::GetFontDescription(): Gets a description of the given fonts. Currently supports only ::GE_FONT_NAME_POSTSCRIPT.
- GeClipMap::EnumerateFonts(): Gets a BaseContainer with a list of all fonts.
- GeClipMap::GetFontName(): Gets the font name from the given font description.
- GeClipMap::GetFontSize(): Gets the font size from the given font description.
- GeClipMap::SetFontSize(): Sets the font size in the given font description.
See also FontData and GeChooseFont().
BaseContainer fonts;
GeData* fontData = nullptr;
BrowseContainer browse(&fonts);
while (browse.GetNext(&containerElement, &fontData))
{
const BaseContainer* const font = fontData->GetContainer();
const BaseContainer* const fontInstance = font->GetContainerInstance(0);
String postScript;
String displayName;
String familyName;
}
@ GE_FONT_NAME_FAMILY
Font family name (e.g. "Helvetica").
Definition: lib_clipmap.h:109
@ GE_FONT_NAME_DISPLAY
Human readable font name (e.g. "Helvetica Bold").
Definition: lib_clipmap.h:108
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
HIERARCHICAL
The font families are sorted alphabetically.
Definition: lib_clipmap.h:1
Further Reading