c4d.modules.bodypaint.PaintLayerBmp

class c4d.modules.bodypaint.PaintLayerBmp
The abstract base class of all paint classes.
Can be a texture, material, layer or mask.

Methods Signatures

PaintLayerBmp.ImportFromBaseBitmap(self, bmp, usealpha) Fill the layer bitmap with an imported bitmap.
PaintLayerBmp.ImportFromBaseBitmapAlpha(self, bmp, channel) Fill the layer bitmap with an imported bitmap.
PaintLayerBmp.GetBoundingBox(self) Get the bounding box of the bitmap layer.
PaintLayerBmp.GetPixelCnt(self, x, y, cnt, ...) Reads cnt pixels from (x, y) in the bitmap to the buffer with mode dstmode.
PaintLayerBmp.SetPixelCnt(self, x, y, cnt, ...) Sets cnt pixels at (x, y) in the bitmap from buffer with mode srcmode, incrementing inc bytes for each pixel.

Inheritance

Parent Class:

Methods Documentation

PaintLayerBmp.ImportFromBaseBitmap(self, bmp, usealpha)

Fill the layer bitmap with an imported bitmap.

Parameters:
  • bm (c4d.bitmaps.BaseBitmap) – The bitmap to import.
  • usealpha (bool) – If True the alpha channel of the bitmap is used, otherwise False.
Return type:

bool

Returns:

True if successful, otherwise False.

PaintLayerBmp.ImportFromBaseBitmapAlpha(self, bmp, channel)

Fill the layer bitmap with an imported bitmap.

Parameters:
Return type:

bool

Returns:

True if successful, otherwise False.

PaintLayerBmp.GetBoundingBox(self)

Get the bounding box of the bitmap layer.

d = layer_bmp.GetBoundingBox()
d["x1"], d["y1"], d["y1"], d["y2"]
Return type:dict
Returns:The coordinates.
PaintLayerBmp.GetPixelCnt(self, x, y, cnt, buffer, dstmode, flags)

Reads cnt pixels from (x, y) in the bitmap to the buffer with mode dstmode.

New in version R16.021.

Parameters:
  • x (int) – The starting X coordinate.
  • y (int) – The starting Y coordinate.
  • cnt (int) – The number of pixels to get.
  • buffer (c4d.storage.ByteSeq) – The destination buffer.
  • dstmode (int) –

    The destination color mode:

    COLORMODE_ILLEGAL Illegal 8-bit mode.
    COLORMODE_ALPHA Only 8-bit alpha channel.
    COLORMODE_GRAY 8-bit grayscale channel.
    COLORMODE_AGRAY 8-bit grayscale 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 grayscale map as mask.
    COLORMODE_AMASK 8-bit grayscale map as mask with 8-bit alpha.
    COLORMODE_ILLEGALw Illegal 16-bit mode.
    COLORMODE_GRAYw 16-bit grayscale channel.
    COLORMODE_AGRAYw 16-bit grayscale 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 grayscale map as mask with 16-bit alpha.
    COLORMODE_ILLEGALf Illegal 32-bit mode.
    COLORMODE_GRAYf 32-bit floating point grayscale channel.
    COLORMODE_AGRAYf 32-bit floating point grayscale channel with floating point alpha.
    COLORMODE_RGBf 32-bit floating point RGB channels.
    COLORMODE_ARGBf 32-bit floating point RGB channels with floating point alpha.
    COLORMODE_MASKf 32-bit floating point grayscale map as mask.
  • flags (int) –

    Flags:

    PIXELCNT_NONE None.
    PIXELCNT_DITHERING Allow dithering.
    PIXELCNT_B3DLAYERS Merge BodyPaint 3D layers (MultipassBitmap).
    PIXELCNT_APPLYALPHA Apply alpha layers to the result (PaintLayerBmp).
    PIXELCNT_INTERNAL_SETLINE Internal SetLine indicator. Private.
    PIXELCNT_INTERNAL_ALPHAVALUE Get also the alpha value (RGBA 32-bit). Private.
Return type:

bool

Returns:

True if successful, otherwise False.

PaintLayerBmp.SetPixelCnt(self, x, y, cnt, buffer, inc, srcmode, flags)

Sets cnt pixels at (x, y) in the bitmap from buffer with mode srcmode, incrementing inc bytes for each pixel.

New in version R16.021.

Parameters:
  • x (int) – X coordinate of the first pixel to set.
  • y (int) – Y coordinate of the first pixel to set.
  • cnt (int) – Number of pixels to set.
  • buffer (c4d.storage.ByteSeq) – The source buffer.
  • inc (int) – The byte increment per pixel in the buffer.
  • srcmode (int) –

    The source mode.

    Note

    None of the alpha modes are supported.

    COLORMODE_ILLEGAL Illegal 8-bit mode.
    COLORMODE_ALPHA Only 8-bit alpha channel.
    COLORMODE_GRAY 8-bit grayscale channel.
    COLORMODE_AGRAY 8-bit grayscale 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 grayscale map as mask.
    COLORMODE_AMASK 8-bit grayscale map as mask with 8-bit alpha.
    COLORMODE_ILLEGALw Illegal 16-bit mode.
    COLORMODE_GRAYw 16-bit grayscale channel.
    COLORMODE_AGRAYw 16-bit grayscale 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 grayscale map as mask with 16-bit alpha.
    COLORMODE_ILLEGALf Illegal 32-bit mode.
    COLORMODE_GRAYf 32-bit floating point grayscale channel.
    COLORMODE_AGRAYf 32-bit floating point grayscale channel with floating point alpha.
    COLORMODE_RGBf 32-bit floating point RGB channels.
    COLORMODE_ARGBf 32-bit floating point RGB channels with floating point alpha.
    COLORMODE_MASKf 32-bit floating point grayscale map as mask.
  • flags (int) –

    Flags:

    PIXELCNT_NONE None.
    PIXELCNT_DITHERING Allow dithering.
    PIXELCNT_B3DLAYERS Merge BodyPaint 3D layers (MultipassBitmap).
    PIXELCNT_APPLYALPHA Apply alpha layers to the result (PaintLayerBmp).
    PIXELCNT_INTERNAL_SETLINE Internal SetLine indicator. Private.
    PIXELCNT_INTERNAL_ALPHAVALUE Get also the alpha value (RGBA 32-bit). Private.
Return type:

bool

Returns:

True if successful, otherwise False.