About
GeClipMap is a utility class that allows to perform advanced drawing operations.
Allocation/Deallocation
A GeClipMap can be created with the usual tools:
The created GeClipMap can be initiated in multiple ways:
if (clipMap == nullptr)
const Int32 height = 1024;
clipMap->BeginDraw();
clipMap->SetColor(255, 0, 0);
clipMap->FillRect(0, 0,
width - 1, height - 1);
clipMap->EndDraw();
if (bitmap == nullptr)
Bool ShowBitmap(const Filename &fn)
Definition: ge_autoptr.h:37
Definition: c4d_basebitmap.h:435
Py_UCS4 * res
Definition: unicodeobject.h:1113
maxon::Int32 Int32
Definition: ge_sys_math.h:60
IMAGERESULT
Definition: ge_prepass.h:3887
@ OK
Image loaded/created.
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
unsigned long Py_ssize_t width
Definition: pycore_traceback.h:88
A GeClipMap is easily cleared with:
Read-Only Properties
The basic settings of a GeClipMap are accessed with:
The bitmap data is stored internally as a BaseBitmap:
Drawing
Every drawing operation performed with a GeClipMap must be encapsulated between these two functions:
The drawing operations can be modified with:
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:1521
A clipping region defines the part of the GeClipMap which will be affected by the following drawing operations.
Single pixels of the GeClipMap can be accessed with:
clipMap->GetDim(&clipMapWidth, &clipMapHeight);
clipMap->BeginDraw();
for (
Int32 x = 0;
x < clipMapWidth; ++
x)
{
for (
Int32 y = 0; y < clipMapHeight; ++y)
{
clipMap->SetPixelRGBA(
x, y, red, green, blue);
}
}
clipMap->EndDraw();
Definition: c4d_tools.h:835
MAXON_ATTRIBUTE_FORCE_INLINE Float Get01()
Definition: c4d_tools.h:865
PyObject * x
Definition: bytesobject.h:38
A blit operations allows to easily copy a part of a GeClipMap into another 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();
}
maxon::Bool Bool
Definition: ge_sys_math.h:55
@ COPY
Source overwrites destination.
@ COPY
New pixels overwrite old ones.
Drawing Operations
These drawing operations allow to create basic shapes. The use the current color defined with GeClipMap::SetColor().
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)
@ RIGHTBOTTOM
(x2,y1) -> (x2,y2) -> (x1,y2)
Drawing Text
These functions are used to handle and draw text:
The currently used font is defined with:
if (clipMap == nullptr)
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();
Definition: c4d_basecontainer.h:48
static Bool GetFontDescription(String const &name, GeFontNameType type, BaseContainer *dst)
@ GE_FONT_NAME_POSTSCRIPT
Font postscript name (e.g. "Helvetica-Bold").
Definition: lib_clipmap.h:112
PyObject * text
Definition: pycore_traceback.h:70
These static functions are used to manage fonts:
See also FontData and GeChooseFont().
while (browse.GetNext(&containerElement, &fontData))
{
}
const BaseContainer * GetContainerInstance(Int32 id) const
Definition: c4d_basecontainer.h:470
Definition: c4d_gedata.h:760
static Bool GetFontName(BaseContainer const *font_description, GeFontNameType type, String *dst)
static void EnumerateFonts(BaseContainer *dst, GE_CM_FONTSORT sort_mode)
Definition: c4d_gedata.h:83
const BaseContainer * GetContainer() const
Definition: c4d_gedata.h:522
Definition: c4d_string.h:39
@ HIERARCHICAL
The font families are sorted alphabetically.
@ GE_FONT_NAME_FAMILY
Font family name (e.g. "Helvetica").
Definition: lib_clipmap.h:110
@ GE_FONT_NAME_DISPLAY
Human readable font name (e.g. "Helvetica Bold").
Definition: lib_clipmap.h:109
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
Further Reading