c4d.bitmaps.MultipassBitmap

This is an extension of the BaseBitmap class that supports higher bit depths, even 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, with full range of functionality.

Definition

class c4d.bitmaps. MultipassBitmap

General

Add Methods

Layers

Parameters

Count Methods

Inheritance

Members

static MultipassBitmap. AllocWrapper ( bmp )

Allocates a multipass wrapper for bmp . The bitmap is internally copied because it must stay alive and not be freed unbtil after the allocated wrapper has been freed:

bmp = bitmaps.BaseBitmap()
bmp.InitWith("path_to_image")
mbp = bitmaps.MultipassBitmap.AllocWrapper(bmp)
# ...
							
Parameters: bmp ( c4d.bitmaps.BaseBitmap ) – Bitmap to wrap.
Return type: c4d.bitmaps.MultipassBitmap
Returns: The new multipass bitmap.
MultipassBitmap. __init__ ( bx , by , mode )

Allocates a multipass bitmap of size bx/by and bit depth given by mode. The first RGBA layer is also created.

Parameters:
  • bx ( int ) – Width in pixels.
  • bx – Height in pixels.
  • mode ( int ) –

    Main mode:

    COLORMODE_ALPHA Only 8-bit alpha channel.
    COLORMODE_GRAY8 8-bit greyscale channel.
    COLORMODE_AGRAY 8-bit greyscale channel with 8-bit alpha.
    COLORMODE_RGB 8-bit RGB channels.
    COLORMODE_ARGB 8-bit RGB channels with 8-bit alpha.
    COLORMODE_CMYK 8-bit CMYK channel.
    COLORMODE_ACMYK 8-bit CMYK channel with 8-bit alpha.
    COLORMODE_MASK 8-bit greymap as mask.
    COLORMODE_AMASK 8-bit greymap as mask with 8-bit alpha.
    COLORMODE_ILLEGAL Private.
    COLORMODE_GRAYw 8-bit greymap as mask with 8-bit alpha.
    COLORMODE_AGRAYw 16-bit greyscale channel with 16-bit alpha.
    COLORMODE_RGBw 16-bit RGB channels.
    COLORMODE_ARGBw 16-bit RGB channels with 16-bit alpha.
    COLORMODE_MASKw 16-bit greymap as mask with 16-bit alpha.
    COLORMODE_ILLEGALf Private.
    COLORMODE_GRAYf Floating point greyscale channel.
    COLORMODE_AGRAYf Floating point greyscale channel with floating point alpha.
    COLORMODE_RGBf Floating point RGB channels.
    COLORMODE_ARGBf Floating point RGB channels with floating point alpha.
    COLORMODE_MASKf Floating point greymap with floating point alpha.
Return type:

c4d.bitmaps.MultipassBitmap

Returns:

The new multipass bitmap.

MultipassBitmap. DeleteLayer ( layer )

Deletes layer from the bitmap, freeing the memory.

Parameters: layer ( c4d.bitmaps.MultipassBitmap ) – The layer to delete. Never access this reference afterwards.
Return type: bool
Returns: True if successful, otherwise False .
MultipassBitmap. FindUserID ( id [ , subid=0 ] )

Finds a layer in the bitmap by ID.

Parameters:
  • id ( int ) – Main layer ID.
  • subid ( int ) – Sub ID.
Return type:

c4d.bitmaps.MultipassBitmap

Returns:

The found layer or None .

MultipassBitmap. ClearImageData ( )

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

MultipassBitmap. GetPaintBitmap ( )

Gets a paint bitmap.

Return type: c4d.bitmaps.PaintBitmap
MultipassBitmap. FreeHiddenLayers ( )

Free the hidden layers.

MultipassBitmap. AddLayer ( insertafter , colormode [ , hidden=False ] )

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

Parameters:
  • insertafter ( c4d.bitmaps.MultipassBitmap ) – The layer to insert after.
  • colormode ( int ) –

    Color mode of the new layer:

    COLORMODE_ALPHA Only 8-bit alpha channel.
    COLORMODE_GRAY8 8-bit greyscale channel.
    COLORMODE_AGRAY 8-bit greyscale channel with 8-bit alpha.
    COLORMODE_RGB 8-bit RGB channels.
    COLORMODE_ARGB 8-bit RGB channels with 8-bit alpha.
    COLORMODE_CMYK 8-bit CMYK channel.
    COLORMODE_ACMYK 8-bit CMYK channel with 8-bit alpha.
    COLORMODE_MASK 8-bit greymap as mask.
    COLORMODE_AMASK 8-bit greymap as mask with 8-bit alpha.
    COLORMODE_ILLEGAL Private.
    COLORMODE_GRAYw 8-bit greymap as mask with 8-bit alpha.
    COLORMODE_AGRAYw 16-bit greyscale channel with 16-bit alpha.
    COLORMODE_RGBw 16-bit RGB channels.
    COLORMODE_ARGBw 16-bit RGB channels with 16-bit alpha.
    COLORMODE_MASKw 16-bit greymap as mask with 16-bit alpha.
    COLORMODE_ILLEGALf Private.
    COLORMODE_GRAYf Floating point greyscale channel.
    COLORMODE_AGRAYf Floating point greyscale channel with floating point alpha.
    COLORMODE_RGBf Floating point RGB channels.
    COLORMODE_ARGBf Floating point RGB channels with floating point alpha.
    COLORMODE_MASKf Floating point greymap with floating point alpha.
  • hidden ( bool ) – If this is True , the layer is hidden.
MultipassBitmap. AddAlpha ( insertafter , colormode )

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

Parameters:
  • insertafter ( c4d.bitmaps.MultipassBitmap ) – The layer to insert after.
  • colormode ( int ) –

    Color mode of the new alpha layer.

    COLORMODE_ALPHA Only 8-bit alpha channel.
    COLORMODE_GRAY8 8-bit greyscale channel.
    COLORMODE_AGRAY 8-bit greyscale channel with 8-bit alpha.
    COLORMODE_RGB 8-bit RGB channels.
    COLORMODE_ARGB 8-bit RGB channels with 8-bit alpha.
    COLORMODE_CMYK 8-bit CMYK channel.
    COLORMODE_ACMYK 8-bit CMYK channel with 8-bit alpha.
    COLORMODE_MASK 8-bit greymap as mask.
    COLORMODE_AMASK 8-bit greymap as mask with 8-bit alpha.
    COLORMODE_ILLEGAL Private.
    COLORMODE_GRAYw 8-bit greymap as mask with 8-bit alpha.
    COLORMODE_AGRAYw 16-bit greyscale channel with 16-bit alpha.
    COLORMODE_RGBw 16-bit RGB channels.
    COLORMODE_ARGBw 16-bit RGB channels with 16-bit alpha.
    COLORMODE_MASKw 16-bit greymap as mask with 16-bit alpha.
    COLORMODE_ILLEGALf Private.
    COLORMODE_GRAYf Floating point greyscale channel.
    COLORMODE_AGRAYf Floating point greyscale channel with floating point alpha.
    COLORMODE_RGBf Floating point RGB channels.
    COLORMODE_ARGBf Floating point RGB channels with floating point alpha.
    COLORMODE_MASKf Floating point greymap with floating point alpha.
Return type:

c4d.bitmaps.MultipassBitmap

Returns:

The added alpha layer or None

MultipassBitmap. AddFolder ( insertafter [ , hidden=False ] )

Adds a folder after insertafter in the bitmap.

Parameters:
Return type:

c4d.bitmaps.MultipassBitmap

Returns:

The added folder or None .

MultipassBitmap. GetLayers ( [ flags=MPB_GETLAYERS_IMAGE|MPB_GETLAYERS_ALPHA ] )

New in version R14.014.

Gets all the layers specified by flags .

Parameters: flags ( int ) –

Flags:

MPB_GETLAYERS_0 None.
MPB_GETLAYERS_ALPHA Get alpha layers.
MPB_GETLAYERS_IMAGE Get image layers.
Return type: list of BaseBitmap
Returns: The layers.
MultipassBitmap. GetParameter ( id )

Uses a description ID as a key into the container, and retrieves the stored data.

Parameters: id ( int ) –

Parameter ID:

MPBTYPE_SHOW bool Determines if this layer will be shown in the external render window. (The Cinema 4D renderer modifies this value itself.)
MPBTYPE_SAVE bool Determines if the layer is saved with the image or not, if SAVEBIT_USESELECTEDLAYERS is used.
MPBTYPE_PERCENT float The blend parameter, between 0 and 1.
MPBTYPE_BLENDMODE int Blend mode. ( LAYER_NORMAL etc. from bplayer.h. )
MPBTYPE_COLORMODE int Color mode:
COLORMODE_ALPHA Only 8-bit alpha channel.
COLORMODE_GRAY8 8-bit greyscale channel.
COLORMODE_AGRAY 8-bit greyscale channel with 8-bit alpha.
COLORMODE_RGB 8-bit RGB channels.
COLORMODE_ARGB 8-bit RGB channels with 8-bit alpha.
COLORMODE_CMYK 8-bit CMYK channel.
COLORMODE_ACMYK 8-bit CMYK channel with 8-bit alpha.
COLORMODE_MASK 8-bit greymap as mask.
COLORMODE_AMASK 8-bit greymap as mask with 8-bit alpha.
COLORMODE_ILLEGAL Private.
COLORMODE_GRAYw 8-bit greymap as mask with 8-bit alpha.
COLORMODE_AGRAYw 16-bit greyscale channel with 16-bit alpha.
COLORMODE_RGBw 16-bit RGB channels.
COLORMODE_ARGBw 16-bit RGB channels with 16-bit alpha.
COLORMODE_MASKw 16-bit greymap as mask with 16-bit alpha.
COLORMODE_ILLEGALf Private.
COLORMODE_GRAYf Floating point greyscale channel.
COLORMODE_AGRAYf Floating point greyscale channel with floating point alpha.
COLORMODE_RGBf Floating point RGB channels.
COLORMODE_ARGBf Floating point RGB channels with floating point alpha.
COLORMODE_MASKf Floating point greymap with floating point alpha.
MPBTYPE_BITMAPTYPE int Bitmap type. Cannot be set with MultipassBitmap.SetParameter() .
MPBTYPE_NAME str Layer name. Only a PaintLayerBmp or PaintLayerFolder can have a name.
MPBTYPE_DPI int Resolution in DPI.
MPBTYPE_USERID int User ID for the layer. In the renderer this is VPBUFFER_xxx .
MPBTYPE_USERSUBID int Sub ID for the layer. In the renderer this is used for blend channels etc.
MPBTYPE_FORCEBLEND int Special mode used to force blend layers.
Return type: any
Returns: Depends on the description ID. Can be None .
MultipassBitmap. SetParameter ( id , t_data )

Uses a description ID as a key into the container, and stores the specified data.

Parameters: id ( int ) –

Parameter ID:

MPBTYPE_SHOW bool Determines if this layer will be shown in the external render window. (The Cinema 4D renderer modifies this value itself.)
MPBTYPE_SAVE bool Determines if the layer is saved with the image or not, if SAVEBIT_USESELECTEDLAYERS is used.
MPBTYPE_PERCENT float The blend parameter, between 0 and 1.
MPBTYPE_BLENDMODE int Blend mode. ( LAYER_NORMAL etc. from bplayer.h. )
MPBTYPE_COLORMODE int Color mode:
COLORMODE_ALPHA Only 8-bit alpha channel.
COLORMODE_GRAY8 8-bit greyscale channel.
COLORMODE_AGRAY 8-bit greyscale channel with 8-bit alpha.
COLORMODE_RGB 8-bit RGB channels.
COLORMODE_ARGB 8-bit RGB channels with 8-bit alpha.
COLORMODE_CMYK 8-bit CMYK channel.
COLORMODE_ACMYK 8-bit CMYK channel with 8-bit alpha.
COLORMODE_MASK 8-bit greymap as mask.
COLORMODE_AMASK 8-bit greymap as mask with 8-bit alpha.
COLORMODE_ILLEGAL Private.
COLORMODE_GRAYw 8-bit greymap as mask with 8-bit alpha.
COLORMODE_AGRAYw 16-bit greyscale channel with 16-bit alpha.
COLORMODE_RGBw 16-bit RGB channels.
COLORMODE_ARGBw 16-bit RGB channels with 16-bit alpha.
COLORMODE_MASKw 16-bit greymap as mask with 16-bit alpha.
COLORMODE_ILLEGALf Private.
COLORMODE_GRAYf Floating point greyscale channel.
COLORMODE_AGRAYf Floating point greyscale channel with floating point alpha.
COLORMODE_RGBf Floating point RGB channels.
COLORMODE_ARGBf Floating point RGB channels with floating point alpha.
COLORMODE_MASKf Floating point greymap with floating point alpha.
MPBTYPE_BITMAPTYPE int Bitmap type. Cannot be set with MultipassBitmap.SetParameter() .
MPBTYPE_NAME str Layer name. Only a PaintLayerBmp or PaintLayerFolder can have a name.
MPBTYPE_DPI int Resolution in DPI.
MPBTYPE_USERID int User ID for the layer. In the renderer this is VPBUFFER_xxx .
MPBTYPE_USERSUBID int Sub ID for the layer. In the renderer this is used for blend channels etc.
MPBTYPE_FORCEBLEND int Special mode used to force blend layers.
Return type: any
Returns: Depends on the description ID. Can be None .
MultipassBitmap. GetLayerNum ( num )

Gets the layer with number num .

Parameters: num ( int ) – Layer index, 0 <= num < GetLayerCount() .
Return type: c4d.bitmaps.MultipassBitmap
Returns: The retrieved layer, or None if the operation failed.
MultipassBitmap. GetAlphaLayerNum ( num )

Gets the alpha layer with number num .

Parameters: num ( int ) – Alpha layer index, 0 <= num < GetAlphaLayerCount() .
Return type: c4d.bitmaps.MultipassBitmap
Returns: The retrieved layer, or None if the operation failed.
MultipassBitmap. GetHiddenLayerNum ( num )

Gets the hidden layer with number num .

Parameters: num ( int ) – Hidden layer index, 0 <= num < GetHiddenLayerCount() .
Return type: c4d.bitmaps.MultipassBitmap
Returns: The retrieved layer, or None if the operation failed.
MultipassBitmap. GetLayerCount ( num )

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

Return type: int
Returns: Layer count.
MultipassBitmap. GetAlphaLayerCount ( )

Retrieves the number of alpha layers in the bitmap.

Return type: int
Returns: Alpha layer count.
MultipassBitmap. GetHiddenLayerCount ( )

Retrieves the number of hidden layers in the bitmap.

Return type: int
Returns: Hidden layer count.