MultipassBitmap Class Reference

#include <c4d_basebitmap.h>

Inheritance diagram for MultipassBitmap:

Detailed Description

This is an extension of the BaseBitmap class that supports higher bit depths, floating point images and multiple layers.
The layers are stored hierarchically. There are three kinds of layers:

  • Layer : A regular layer, with full range of functionality.
  • Folder : A collection of layers. This is a dummy element that has no image content, but other stuff like name, visibility etc.
  • Alpha : An alpha channel layer, with full range of functionality.
Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
This represents internally the same class as VPBuffer, so a VPBuffer can be cast to a MultipassBitmap and vice versa.

Private Member Functions

 MultipassBitmap ()
 
 ~MultipassBitmap ()
 

Alloc/Free

static MultipassBitmapAlloc (Int32 bx, Int32 by, COLORMODE mode)
 
static MultipassBitmapAllocWrapper (BaseBitmap *bmp)
 
static void Free (MultipassBitmap *&bm)
 

Layers

Int32 GetLayerCount () const
 
Int32 GetAlphaLayerCount () const
 
Int32 GetHiddenLayerCount () const
 
MultipassBitmapGetSelectedLayer ()
 
MultipassBitmapGetLayerNum (Int32 num)
 
MultipassBitmapGetAlphaLayerNum (Int32 num)
 
MultipassBitmapGetHiddenLayerNum (Int32 num)
 
MultipassBitmapAddLayer (MultipassBitmap *insertafter, COLORMODE colormode, Bool hidden=false)
 
MultipassBitmapAddFolder (MultipassBitmap *insertafter, Bool hidden=false)
 
MultipassBitmapAddAlpha (MultipassBitmap *insertafter, COLORMODE colormode)
 
Bool DeleteLayer (MultipassBitmap *&layer)
 
void SetMasterAlpha (BaseBitmap *master)
 
void FreeHiddenLayers ()
 

Get Layers

Bool GetLayers (maxon::BaseArray< BaseBitmap * > &list, MPB_GETLAYERS flags=MPB_GETLAYERS::IMAGE|MPB_GETLAYERS::ALPHA)
 
Bool GetLayers (maxon::BaseArray< MultipassBitmap * > &list, MPB_GETLAYERS flags=MPB_GETLAYERS::IMAGE|MPB_GETLAYERS::ALPHA)
 

Get/Set Layers Parameter

GeData GetParameter (MPBTYPE id) const
 
Bool SetParameter (MPBTYPE id, const GeData &par)
 

Miscellaneous

void ClearImageData ()
 
MultipassBitmapFindUserID (Int32 id, Int32 subid=0)
 
PaintBitmapGetPaintBitmap ()
 
Int32 GetUserID () const
 
void SetUserID (Int32 id)
 
void SetUserSubID (Int32 subid)
 
void SetBlendMode (Int32 mode)
 
void SetName (const maxon::String &name)
 
void SetColorMode (COLORMODE mode)
 
void SetDpi (Int32 dpi)
 
Bool SetTempColorProfile (const ColorProfile *profile, Bool dithering)
 
void SetSave (Bool save)
 
void SetComponent (Int32 c)
 

Additional Inherited Members

- Public Member Functions inherited from BaseBitmap
Bool SetColorProfile (const ColorProfile *profile, Int32 index=COLORPROFILE_INDEX_IMAGE)
 
const ColorProfileGetColorProfile (Int32 index=COLORPROFILE_INDEX_IMAGE) const
 
IMAGERESULT Init (const Filename &name, Int32 frame=-1, Bool *ismovie=nullptr)
 
IMAGERESULT Init (Int32 x, Int32 y, Int32 depth=24, INITBITMAPFLAGS flags=INITBITMAPFLAGS::NONE)
 
void FlushAll ()
 
IMAGERESULT Save (const Filename &name, Int32 format, BaseContainer *data, SAVEBIT savebits) const
 
BaseBitmapGetClone () const
 
BaseBitmapGetClonePart (Int32 x, Int32 y, Int32 w, Int32 h) const
 
Bool CopyTo (BaseBitmap *dst) const
 
Bool CopyPartTo (BaseBitmap *dst, Int32 x, Int32 y, Int32 w, Int32 h) const
 
Int32 GetBw () const
 
Int32 GetBh () const
 
Int32 GetBt () const
 
Int32 GetBpz () const
 
COLORMODE GetColorMode () const
 
void ScaleIt (BaseBitmap *dst, Int32 intens, Bool sample, Bool nprop) const
 
void ScaleBicubic (BaseBitmap *dst, Int32 src_xmin, Int32 src_ymin, Int32 src_xmax, Int32 src_ymax, Int32 dst_xmin, Int32 dst_ymin, Int32 dst_xmax, Int32 dst_ymax) const
 
void SetPen (Int32 r, Int32 g, Int32 b)
 
void Clear (Int32 r, Int32 g, Int32 b)
 
void Clear (Int32 x1, Int32 y1, Int32 x2, Int32 y2, Int32 r, Int32 g, Int32 b)
 
void Line (Int32 x1, Int32 y1, Int32 x2, Int32 y2)
 
void Arc (Int32 x, Int32 y, Float radius, Float angle_start, Float angle_end, Int32 subdiv=32)
 
void GetPixel (Int32 x, Int32 y, UInt16 *r, UInt16 *g, UInt16 *b) const
 
Vector32 GetPixelDirect (Int32 x, Int32 y) const
 
Bool SetPixel (Int32 x, Int32 y, Int32 r, Int32 g, Int32 b)
 
void GetAlphaPixel (BaseBitmap *channel, Int32 x, Int32 y, UInt16 *val) const
 
Bool SetAlphaPixel (BaseBitmap *channel, Int32 x, Int32 y, Int32 val)
 
void GetPixelCnt (Int32 x, Int32 y, Int32 cnt, UChar *buffer, Int32 inc, COLORMODE dstmode, PIXELCNT flags, ColorProfileConvert *conversion=nullptr) const
 
Bool SetPixelCnt (Int32 x, Int32 y, Int32 cnt, UChar *buffer, Int32 inc, COLORMODE srcmode, PIXELCNT flags)
 
BaseBitmapAddChannel (Bool internal, Bool straight)
 
void RemoveChannel (BaseBitmap *channel)
 
const BaseBitmapGetInternalChannel () const
 
BaseBitmapGetInternalChannel ()
 
Int32 GetChannelCount () const
 
const BaseBitmapGetChannelNum (Int32 num) const
 
BaseBitmapGetChannelNum (Int32 num)
 
GeData GetData (Int32 id, const GeData &t_default) const
 
Bool SetData (Int32 id, const GeData &data)
 
UInt32 GetDirty () const
 
void SetDirty ()
 
const BaseBitmapGetUpdateRegionBitmap () const
 
BaseBitmapGetUpdateRegionBitmap ()
 
void GetUpdateRegion (Int32 &xMin, Int32 &xMax, Int32 &yMin, Int32 &yMax, Bool reset)
 
Int GetMemoryInfo () const
 
Bool IsMultipassBitmap () const
 
void SetCMAP (Int32 i, Int32 r, Int32 g, Int32 b)
 
Bool GetImageRef (SAVEBIT saveBit, Bool alpha, maxon::ImageRef &imageRef) const
 
- Static Public Member Functions inherited from BaseBitmap
static BaseBitmapAlloc ()
 
static void Free (BaseBitmap *&bm)
 
static IMAGERESULT Init (BaseBitmap *&res, const Filename &name, Int32 frame=-1, Bool *ismovie=nullptr, BitmapLoaderPlugin **loaderplugin=nullptr, const maxon::Delegate< void(Float progress)> &progressCallback=nullptr)
 
- Static Public Attributes inherited from BaseBitmap
static constexpr Int32 COLORPROFILE_INDEX_IMAGE
 
static constexpr Int32 COLORPROFILE_INDEX_RENDERSPACE
 
static constexpr Int32 COLORPROFILE_INDEX_VIEW_TRANSFORM
 
static constexpr Int32 COLORPROFILE_INDEX_DISPLAYSPACE
 

Constructor & Destructor Documentation

◆ MultipassBitmap()

MultipassBitmap ( )
private

◆ ~MultipassBitmap()

~MultipassBitmap ( )
private

Member Function Documentation

◆ Alloc()

static MultipassBitmap* Alloc ( Int32  bx,
Int32  by,
COLORMODE  mode 
)
static

Allocates a multipass bitmap of size [bx,by] and bit depth given by mode. The first RGBA layer is also created.
Use Free() to deallocate the bitmap.

Parameters
[in]bxThe width in pixels.
[in]byThe height in pixels.
[in]modeThe color mode: COLORMODE
Returns
The allocated multipass bitmap, or nullptr if the allocation failed.

◆ AllocWrapper()

static MultipassBitmap* AllocWrapper ( BaseBitmap bmp)
static

Allocates a multipass wrapper for bmp.
The wrapped bitmap has to stay alive and not be freed until after the allocated wrapper has been freed.
The returned multipass wrapper can be modified freely.

Parameters
[in]bmpThe bitmap to wrap. The caller owns the pointed bitmap.
Returns
The allocated wrapper bitmap, or nullptr if the allocation failed.

◆ Free()

static void Free ( MultipassBitmap *&  bm)
static

Destructs multipass bitmaps allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in]bmThe multipass bitmap to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ GetLayerCount()

Int32 GetLayerCount ( ) const

Gets the number of layers in the bitmap. This is the sum of the number of layers, folders and alphas that are direct children of the multipass bitmap.

Returns
The layer count.

◆ GetAlphaLayerCount()

Int32 GetAlphaLayerCount ( ) const

Gets the number of alpha layers in the multipass bitmap.

Returns
The alpha layer count.

◆ GetHiddenLayerCount()

Int32 GetHiddenLayerCount ( ) const

Gets the number of hidden layers in the multipass bitmap.

Returns
The hidden layer count.

◆ GetSelectedLayer()

MultipassBitmap* GetSelectedLayer ( )

Gets the currently selected layer.

Returns
The selected layer, or nullptr if the operation failed. The multipass bitmap owns the pointed layer.

◆ GetLayerNum()

MultipassBitmap* GetLayerNum ( Int32  num)

Gets the layer at index num.

Parameters
[in]numThe layer index: 0 <= num < GetLayerCount().
Returns
The retrieved layer, or nullptr if the operation failed. The multipass bitmap owns the pointed layer.

◆ GetAlphaLayerNum()

MultipassBitmap* GetAlphaLayerNum ( Int32  num)

Gets the alpha layer at index num.

Parameters
[in]numThe alpha layer index: 0 <= num < GetAlphaLayerCount().
Returns
The retrieved alpha layer, or nullptr if the operation failed. The multipass bitmap owns the pointed alpha layer.

◆ GetHiddenLayerNum()

MultipassBitmap* GetHiddenLayerNum ( Int32  num)

Gets the hidden layer at index num.

Parameters
[in]numThe hidden layer index: 0 <= num < GetHiddenLayerCount().
Returns
The retrieved hidden layer, or nullptr if the operation failed. The multipass bitmap owns the pointed alpha layer.

◆ AddLayer()

MultipassBitmap* AddLayer ( MultipassBitmap insertafter,
COLORMODE  colormode,
Bool  hidden = false 
)

Adds a layer with mode colormode after insertafter in the multipass bitmap.

Parameters
[in]insertafterThe layer to insert after. Pass nullptr to insert first or BMP_INSERTLAST to insert last.
[in]colormodeThe color mode of the new layer: COLORMODE
[in]hiddenIf true the layer is hidden.
Returns
The added layer, or nullptr if the operation failed. The multipass bitmap owns the pointed layer.

◆ AddFolder()

MultipassBitmap* AddFolder ( MultipassBitmap insertafter,
Bool  hidden = false 
)

Adds a folder after insertafter in the bitmap.

Parameters
[in]insertafterThe layer to insert after. Pass nullptr to insert first or BMP_INSERTLAST to insert last.
[in]hiddenIf true the layer is hidden.
Returns
The added folder, or nullptr if the operation failed. The multipass bitmap owns the pointed folder.

◆ AddAlpha()

MultipassBitmap* AddAlpha ( MultipassBitmap insertafter,
COLORMODE  colormode 
)

Adds an alpha layer with mode colormode after insertafter in the bitmap.

Parameters
[in]insertafterThe layer to insert after. Pass nullptr to insert first or BMP_INSERTLAST to insert last.
[in]colormodeThe color mode of the new alpha layer: COLORMODE
Returns
The added alpha layer, or nullptr if the operation failed. The multipass bitmap owns the pointed alpha layer.

◆ DeleteLayer()

Bool DeleteLayer ( MultipassBitmap *&  layer)

Deletes layer from the bitmap, freeing its memory.

Parameters
[in]layerThe layer to delete. The pointer will be set to nullptr if the operation is successful, since the layer does not exist afterwards.
Returns
true if layer was successfully deleted, otherwise false.

◆ SetMasterAlpha()

void SetMasterAlpha ( BaseBitmap master)

Sets the master alpha layer. This just stores the pointer, it does not add a new layer.

Parameters
[in]masterThe new master alpha layer.

◆ FreeHiddenLayers()

void FreeHiddenLayers ( )

Free the hidden layers.

◆ GetLayers() [1/2]

Fills the passed array with all the layers specified by flags.

Parameters
[in]listThe array filled with the layers as BaseBitmap*.
[in]flagsThe flags: MPB_GETLAYERS
Returns
true if the layers could be obtained, otherwise false.

◆ GetLayers() [2/2]

Fills the passed array with all the layers specified by flags.

Parameters
[in]listThe array filled with the layers as MultipassBitmap*.
[in]flagsThe flags: MPB_GETLAYERS
Returns
true if the layers could be obtained, otherwise false.

◆ GetParameter()

GeData GetParameter ( MPBTYPE  id) const

Gets a layer parameter.

Parameters
[in]idThe layer parameter ID: MPBTYPE
Returns
The retrieved layer parameter data.

◆ SetParameter()

Bool SetParameter ( MPBTYPE  id,
const GeData par 
)

Sets a layer parameter.

Parameters
[in]idThe layer parameter ID: MPBTYPE
[in]parThe new parameter data.
Returns
true if the layer parameter was successfully set, otherwise false.

◆ ClearImageData()

void ClearImageData ( )

Clears the image data for all layers. The layers themselves are not removed or deleted.

◆ FindUserID()

MultipassBitmap* FindUserID ( Int32  id,
Int32  subid = 0 
)

Finds a layer in the bitmap with its id.

Parameters
[in]idThe main layer ID.
See also
MPBTYPE::USERID.
Parameters
[in]subidThe sub layer ID.
See also
MPBTYPE::USERID.
Returns
The found layer, or nullptr if the operation failed. The multipass bitmap owns the pointed layer.

◆ GetPaintBitmap()

PaintBitmap* GetPaintBitmap ( )

Gets a BodyPaint 3D paint bitmap for the multipass bitmap.

Returns
The paint bitmap.

◆ GetUserID()

Int32 GetUserID ( ) const

Gets the user ID for the layer. In the renderer this is VPBUFFER_XXX.

Returns
The user ID for the layer.

◆ SetUserID()

void SetUserID ( Int32  id)

Sets the user ID for the layer. In the renderer this is VPBUFFER_XXX.

Parameters
[in]idThe new user ID for the layer.

◆ SetUserSubID()

void SetUserSubID ( Int32  subid)

Sets the user sub-id for the layer. In the renderer this is used for blend channels for instance.

Parameters
[in]subidThe new user sub-ID for the layer.

◆ SetBlendMode()

void SetBlendMode ( Int32  mode)

Adjusts the blend mode of a layer. This also shows up in the description UI of a layer (ID_PAINTLAYER_BLEND parameter).

Parameters
[in]modeThe values are declared in bplayer.h under the ID_PAINTLAYER_BLEND parameter.

◆ SetName()

void SetName ( const maxon::String name)

Sets the name of the layer.

Parameters
[in]nameThe new name.

◆ SetColorMode()

void SetColorMode ( COLORMODE  mode)

Sets the color mode for the layer.

Parameters
[in]modeThe new color mode.

◆ SetDpi()

void SetDpi ( Int32  dpi)

Private.

◆ SetTempColorProfile()

Bool SetTempColorProfile ( const ColorProfile profile,
Bool  dithering 
)

Private.

◆ SetSave()

void SetSave ( Bool  save)

Private.

◆ SetComponent()

void SetComponent ( Int32  c)

Private.