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:

Name Description
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, visibilitiy etc.
Alpha An alpha channel, with full range of functionality.

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 (BaseBitmap) – Bitmap to wrap.
Return type: 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_RGB 8-bit RGB channels.
    COLORMODE_RGBw 16-bit RGB channels.
    COLORMODE_RGBf Floating point RGB channels.
Return type:

MultipassBitmap

Returns:

The new multipass bitmap.

MultipassBitmap.DeleteLayer(layer)

Deletes layer from the bitmap, freeing the memory.

Parameters: layer (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:

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: 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 (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 (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:

MultipassBitmap

Returns:

The added alpha layer or None

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

Adds a folder after insertafter in the bitmap.

Parameters:
  • insertafter (MultipassBitmap) – The layer to insert after.
  • hidden (bool) – If this is True, the layer is hidden.
Return type:

MultipassBitmap

Returns:

The added folder or None.

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 SetParameter.
MPBTYPE_NAME str Layer 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 SetParameter.
MPBTYPE_NAME str Layer 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: 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 < GetLayerCount().
Return type: 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 < GetLayerCount().
Return type: 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.

Table Of Contents