About
MultipassBitmap is a subclass of BaseBitmap that provides support for multiple folders and layers. Such a folder or layer is represented as another MultipassBitmap.
- Warning
- For Maxon API image classes see Images Manual. For Maxon API media input and output see Media Sessions Manual.
const Int32 height = 1080;
MultipassBitmap* multipassBitmap = MultipassBitmap::Alloc(
width, height, colorMode);
if (multipassBitmap == nullptr)
MultipassBitmap* const layer = multipassBitmap->AddLayer(nullptr, colorMode);
if (layer)
{
{
for (
Int32 y = 0; y < height; ++y)
{
{
lineBuffer[offset] = red;
lineBuffer[offset + 1] = green;
lineBuffer[offset + 2] = 0;
offset = offset + 3;
}
}
}
}
Filename imageFileName;
{
}
MultipassBitmap::Free(multipassBitmap);
NONE
Definition: asset_browser.h:1
PyObject * x
Definition: bytesobject.h:38
Py_UCS4 * res
Definition: unicodeobject.h:1113
OK
User has selected a font.
Definition: customgui_fontchooser.h:0
#define NewMemClear(T, cnt)
Definition: defaultallocator.h:216
COLORMODE
::Int32 Get/Set. The color mode: COLORMODE
Definition: ge_prepass.h:4
SAVE
::Bool Get/Set. Determines if the layer is saved with the image or not if SAVEBIT::USESELECTEDLAYERS ...
Definition: ge_prepass.h:1
IMAGES
Image files.
Definition: ge_prepass.h:1
MULTILAYER
Save multiple layers.
Definition: ge_prepass.h:2
USE32BITCHANNELS
Use 32-bit channels.
Definition: ge_prepass.h:8
RGBf
32-bit floating point RGB channels.
Definition: ge_prepass.h:30
#define COLORBYTES_RGBf
Floating point RGB.
Definition: c4d_basebitmap.h:92
#define FILTER_TIF
TIFF.
Definition: ge_prepass.h:185
IMAGERESULT
Definition: ge_prepass.h:3947
SAVEBIT
Definition: ge_prepass.h:275
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
#define ifnoerr(...)
The opposite of iferr.
Definition: errorbase.h:393
maxon::UChar UChar
Definition: ge_sys_math.h:48
Filename GeFilterSetSuffix(const Filename &name, Int32 id)
maxon::Float32 Float32
Definition: ge_sys_math.h:59
maxon::Int32 Int32
Definition: ge_sys_math.h:51
Float32 PIX_F
32-bit float pixel type.
Definition: ge_math.h:29
void DeleteMem(T *&p)
Definition: defaultallocator.h:269
unsigned long Py_ssize_t width
Definition: pycore_traceback.h:88
#define NAME
Definition: token.h:14
Access
A MultipassBitmap can be cast into a VPBuffer and vice versa in the rendering pipeline. If a given BaseBitmap pointer refers to a MultipassBitmap can be checked with BaseBitmap::IsMultipassBitmap().
Allocation/Deallocation
A MultipassBitmap can be created with the usual tools:
- MultipassBitmap::Alloc(): Creates a new MultipassBitmap.
- MultipassBitmap::Free(): Deletes the given MultipassBitmap.
- MultipassBitmap::AllocWrapper(): Creates a new MultipassBitmap wrapping around the given BaseBitmap.
const Int32 height = 1080;
MultipassBitmap* multipassBitmap = MultipassBitmap::Alloc(
width, height, colorMode);
if (multipassBitmap == nullptr)
MultipassBitmap::Free(multipassBitmap);
RGB
8-bit RGB channels.
Definition: ge_prepass.h:7
A multi-layer image file can also be loaded into a MultipassBitmap using BaseBitmap::Init():
Filename selectedImageFile;
BaseBitmap* bitmap = nullptr;
if (bitmap->IsMultipassBitmap())
{
MultipassBitmap* const multipassBitmap = static_cast<MultipassBitmap*>(bitmap);
const Int32 layerCount = multipassBitmap->GetLayerCount();
}
else
{
}
BaseBitmap::Free(bitmap);
LOAD
Load.
Definition: c4d_filterdata.h:1
PyObject PyObject * result
Definition: abstract.h:43
return OK
Definition: apibase.h:2740
maxon::Url MaxonConvert(const Filename &fn, MAXONCONVERTMODE convertMode)
The image data stored in the layers can easily be deleted with:
- MultipassBitmap::ClearImageData(): Clears the image data for all layers without deleting the layers.
Properties
Parameters
Multiple parameters can be set to define the behaviour of a given layer:
- MultipassBitmap::GetParameter(): Returns the value stored with the given parameter ID.
- MultipassBitmap::SetParameter(): Set the value stored with the given parameter ID.
- Note
- Since a MultipassBitmap is used within the rendering pipeline some of these parameters are only relevant in that context.
The parameter IDs are:
Some of these parameters can be directly accessed with these convenience functions:
- MultipassBitmap::GetUserID(): Returns the user ID.
- MultipassBitmap::SetUserID(): Sets the user ID.
- MultipassBitmap::SetUserSubID(): Sets the user sub-ID.
- MultipassBitmap::SetBlendMode(): Sets the blend mode.
- MultipassBitmap::SetName(): Sets the name.
- MultipassBitmap::SetColorMode(): Sets the color mode.
- MultipassBitmap::SetDpi(): Sets the DPI.
MultipassBitmap* const layer = multipassBitmap->AddLayer(nullptr, colorMode);
if (layer)
{
layer->SetName("New Layer"_s);
}
@ LAYER_ADD
Definition: bplayer.h:40
BLENDMODE
::Int32 Get/Set. The blend mode (LAYER_NORMAL, LAYER_DISSOLVE etc. from bplayer.h).
Definition: ge_prepass.h:3
SHOW
::Bool Get/Set. Determines if the layer will be shown in the external render window....
Definition: ge_prepass.h:0
Bool ShowBitmap(const Filename &fn)
Layers
A MultipassBitmap can contain default layers, alpha layers and hidden layers:
- MultipassBitmap::GetLayerCount(): Returns the number of layers.
- MultipassBitmap::GetAlphaLayerCount(): Returns the number of alpha layers.
- MultipassBitmap::GetHiddenLayerCount(): Returns the number of hidden layers.
These layers are accessed with:
- MultipassBitmap::GetLayers(): Stores pointers to the layers into the given maxon::BaseArray.
- MultipassBitmap::FindUserID(): Returns the layer with the given ID and sub-ID.
- MultipassBitmap::GetSelectedLayer(): Returns the currently selected layer.
- MultipassBitmap::GetLayerNum(): Returns the layer with the given index.
- MultipassBitmap::GetAlphaLayerNum(): Returns the alpha layer with the given index.
- MultipassBitmap::GetHiddenLayerNum(): Returns the hidden layer with the given index.
const Int32 layerCount = multipassBitmap->GetLayerCount();
for (
Int32 layerIndex = 0; layerIndex < layerCount; ++layerIndex)
{
MultipassBitmap* const layer = multipassBitmap->GetLayerNum(layerIndex);
if (layer)
{
const String layerName = layer->GetParameter(
MPBTYPE::NAME).GetString();
}
}
Layers, folders and alpha layers are added with:
- MultipassBitmap::AddLayer(): Adds a new layer or hidden layer.
- MultipassBitmap::AddFolder(): Adds a new folder.
- MultipassBitmap::AddAlpha(): Adds a new alpha layer.
Further layer related functions are:
- MultipassBitmap::DeleteLayer(): Deletes the given layer.
- MultipassBitmap::SetMasterAlpha(): Sets the master alpha layer.
- MultipassBitmap::FreeHiddenLayers(): Deletes the hidden layers.
MultipassBitmap* const folder = multipassBitmap->AddFolder(nullptr);
if (folder)
{
folder->SetName("Folder"_s);
MultipassBitmap* const layerA = folder->AddLayer(nullptr, colorMode);
if (layerA)
{
layerA->SetName("Layer A"_s);
}
MultipassBitmap* const layerB = folder->AddLayer(nullptr, colorMode);
if (layerB)
{
layerB->SetName("Layer B"_s);
}
}
Convert
The content of a MultipassBitmap can also be represented as a BodyPaint PaintBitmap:
- MultipassBitmap::GetPaintBitmap(): Returns the corresponding PaintBitmap.
AutoAlloc<BaseBitmap> mergedBitmap;
if (mergedBitmap == nullptr)
PaintBitmap* const paintBitmap = multipassBitmap->GetPaintBitmap();
if (paintBitmap == nullptr)
const Int32 height = multipassBitmap->GetBh();
if (!paintBitmap->ReCalc(
nullptr, 0, 0,
width, height, mergedBitmap, calcFlags, 0))
#define RECALC_NOGRID
If set the checkered background grid will not be evaluated.
Definition: c4d_painter.h:577
#define RECALC_INITBMP
Initialize the BaseBitmap of the bmp parameter.
Definition: c4d_painter.h:578
Further Reading