#include <c4d_basebitmap.h>
Public Attributes | |
void * | unknownBitmapData |
Int | unknownBitmapSize |
Protected Member Functions | |
IMAGERESULT | Init (void *mem, Int size) |
void | _Free () |
virtual IMAGERESULT | _Init (Int32 x, Int32 y, Int32 t, DrawPortTypes type=DpRegular, void *data=nullptr) |
Bool | Check (const Vector &v) const |
Bool | Check (Int32 x1, Int32 y1) const |
Bool | Check (Int32 x1, Int32 y1, Int32 x2, Int32 y2) const |
Protected Attributes | |
CHANNEL | Channels [4] |
Private Attributes | |
DrawPort * | dp |
COLORMODE | colormode |
Friends | |
class | HyperFile |
class | BaseMaterial |
class | SkyObjects |
class | iMatPreviewData |
class | JpgLoader |
class | BmpLoader |
Constructor/Destructor | |
BaseBitmap () | |
virtual | ~BaseBitmap () |
Alloc/Free | |
static BaseBitmap * | Alloc () |
static void | Free (BaseBitmap *&bm) |
Init/Load/Save | |
virtual IMAGERESULT | Init (Int32 x, Int32 y, Int32 depth=24, INITBITMAPFLAGS flags=INITBITMAPFLAGS_0) |
IMAGERESULT | Load (const Filename &name, Int32 format, BaseContainer *data, Int32 frame) |
IMAGERESULT | Save (const Filename &name, Int32 format, BaseContainer *data, SAVEBIT savebits) |
Bitmap Dimension/Information | |
Int32 | GetBw () const |
Int32 | GetBh () const |
Int32 | GetBt () const |
COLORMODE | GetColorMode () |
Clone/Copy/Scale | |
Bool | CloneIt (BaseBitmap *dest) const |
BaseBitmap * | GetClone () |
Bool | CopyPart (BaseBitmap *dest, Int32 x, Int32 y, Int32 w, Int32 h, Bool no_reallocation) const |
void | ScaleIt (BaseBitmap *dest, Int32 hell, Bool sample, Bool nprop=false, Bool disable_gamma=false) const |
Set/Get Pixels | |
Bool | SetPixel (Int32 x, Int32 y, Int32 red, Int32 green, Int32 blue, Int32 alpha=0) |
void | GetPixel (Int32 x, Int32 y, UInt16 *red, UInt16 *green, UInt16 *blue) const |
Vector | GetRGB (Int32 x, Int32 y) |
virtual Bool | SetAlphaPixel (BaseBitmap *channel, Int32 x, Int32 y, Int32 val) |
virtual void | GetAlphaPixel (BaseBitmap *channel, Int32 x, Int32 y, UInt16 *val) const |
Bool | SetPixelCnt (Int32 x, Int32 y, Int32 cnt, UChar *buffer, Int32 inc, COLORMODE srcmode, PIXELCNT flags) |
virtual void | GetPixelCnt (Int32 x, Int32 y, Int32 cnt, UChar *buffer, Int32 inc, COLORMODE dstmode, PIXELCNT flags, ColorProfileConvert *conversion=nullptr) const |
virtual Bool | SetAlphaPixelCnt (Int32 x, Int32 y, Int32 cnt, UChar *buffer, Int32 inc, BaseBitmap *channel) |
virtual void | GetAlphaPixelCnt (Int32 x, Int32 y, Int32 cnt, UChar *buffer, Int32 inc, BaseBitmap *channel) const |
Bool | SetLineDirect (Int32 y, void *data, Int32 depth) |
Channel | |
virtual BaseBitmap * | AddChannel (Bool internal, Bool straight=false) |
virtual void | RemoveChannel (BaseBitmap *channel) |
virtual BaseBitmap * | GetInternalChannel () const |
virtual Int32 | GetChannelCount () const |
virtual BaseBitmap * | GetChannelNum (Int32 num) const |
The bitmap class can be used to load, read, draw and save bitmap pictures of various formats.
Bitmaps are organized so that the 2D point [0,0] is the top left corner. Be sure to call Init(Int32 x, Int32 y, Int32 depth = 24, INITBITMAPFLAGS flags = INITBITMAPFLAGS_0) before attempting to use a newly allocated bitmap.
BaseBitmap | ( | ) |
Default constructor.
|
virtual |
Default destructor.
|
protected |
Private. Internal.
|
protected |
Private. Internal.
|
protectedvirtual |
Private. Internal.
|
static |
Allocates a bitmap. Destroy the allocated bitmap with Free().
|
static |
Destructs bitmaps allocated with Alloc().
[in,out] | bm | The bitmap to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
|
virtual |
Initializes the bitmap to the given [x,y] dimensions and depth.
[in] | x | The requested width in pixels (Maximum 16 000 pixels). |
[in] | y | The requested height in pixels (Max. 16000 pixels). |
[in] | depth | The requested bit depth. The possible values are (1, 4, 8, 16, 24, 32, 64, 96). On some platforms 32-bit will be used even if 24 is requested, to allow for padding. In this case GetBt() will return 32. |
[in] | flags | The initialization flags. |
IMAGERESULT Load | ( | const Filename & | name, |
Int32 | format, | ||
BaseContainer * | data, | ||
Int32 | frame | ||
) |
Loads the bitmap from a file.
[in] | name | A valid filename that can either refer a movie or a picture. |
[in] | format | The image format. |
[in] | data | Some formats provide additional settings. Can be nullptr, which means the same as an empty container. The caller owns the pointed container. |
[in] | frame | The frame number to load in a movie. |
IMAGERESULT Save | ( | const Filename & | name, |
Int32 | format, | ||
BaseContainer * | data, | ||
SAVEBIT | savebits | ||
) |
Saves the bitmap to a file.
[in] | name | A valid filename that can either refer a movie or a picture. |
[in] | format | The image format. |
[in] | data | Some formats provide additional settings. Can be nullptr, which means the same as an empty container. The caller owns the pointed container. |
[in] | savebits | A combination of the following flags. |
Int32 GetBw | ( | ) | const |
Gets the width of the bitmap in pixels. If the bitmap has not been initialized the return value is 0.
Int32 GetBh | ( | ) | const |
Gets the height of the bitmap in pixels.
Int32 GetBt | ( | ) | const |
Gets the number of bits per pixel.
Bool CloneIt | ( | BaseBitmap * | dest | ) | const |
Copies the bitmap.
[out] | dest | The cloned bitmap, or nullptr if an error occurred. The caller owns the pointed bitmap. |
BaseBitmap* GetClone | ( | ) |
Copies the bitmap.
Copies part of the bitmap to dest.
[out] | dest | The bitmap to copy the bitmap to. The caller owns the pointed bitmap. |
[in] | x | The X position of the bitmap part to be copied. |
[in] | y | The Y position of the bitmap part to be copied. |
[in] | w | The width of the bitmap part to be copied. |
[in] | h | The height of the bitmap part to be copied. |
[in] | no_reallocation | Pass true if dest is an already initialized bitmap with width and height equal to w and h. Faster without initialization/allocation. |
void ScaleIt | ( | BaseBitmap * | dest, |
Int32 | hell, | ||
Bool | sample, | ||
Bool | nprop = false , |
||
Bool | disable_gamma = false |
||
) | const |
Scales the bitmap to fit in the destination bitmap and copies it there.
The destination bitmap dest needs to be initialized with the destination size before calling this function.
[out] | dest | The destination bitmap. The caller owns the pointed bitmap. |
[in] | hell | Lets you change brightness of the image (128 = 50% brightness, 256 = unchanged). |
[in] | sample | If true a better scaling algorithm is used, which results in a better quality but a bit slower. |
[in] | nprop | Must be true if non-proportional scaling is wanted. |
[in] | disable_gamma | Pass true to disable gamma correction. |
Sets the pixel at [x,y] to the color specified by (red,green,blue) (0 <= red/green/blue <= 255). The alpha value for the pixel can also be set.
The range of the red, green, blue and alpha parameters is 0 to 255, where (255,255,255) is white or opaque, regardless of the bit depth of the image.
[in] | x | The X coordinate. |
[in] | y | The Y coordinate. |
[in] | red | The red component. |
[in] | green | The green component. |
[in] | blue | The blue component. |
[in] | alpha | The alpha. |
Gets the color at [x,y] and assigns it to the passed (red,green,blue) parameters.
The range of the assigned red, green and blue parameters is 0 to 255, where (255,255,255) is white, regardless of the bit depth of the image.
[in] | x | The X coordinate. |
[in] | y | The Y coordinate. |
[out] | red | Assigned the red component. |
[out] | green | Assigned the green component. |
[out] | blue | Assigned the blue component. |
Gets the color at [x,y] as RGB Vector.
[in] | x | The X coordinate. |
[in] | y | The Y coordinate. |
|
virtual |
Sets the alpha value at [x,y] to val.
[in] | channel | The alpha channel to use. |
[in] | x | The X coordinate. |
[in] | y | The Y coordinate. |
[in] | val | The alpha value. 0 <= val <= 255 |
|
virtual |
Gets the alpha value at [x,y] and assigns it to the passed parameter val (0 <= val <= 255).
[in] | channel | The alpha channel to use. |
[in] | x | The X coordinate. |
[in] | y | The Y coordinate. |
[out] | val | Assigned the alpha value. |
Bool SetPixelCnt | ( | Int32 | x, |
Int32 | y, | ||
Int32 | cnt, | ||
UChar * | buffer, | ||
Int32 | inc, | ||
COLORMODE | srcmode, | ||
PIXELCNT | flags | ||
) |
Sets cnt pixels at [x,y] in the bitmap from buffer with color mode srcmode, incrementing inc bytes for each pixel.
[in] | x | The X coordinate of the first pixel to set. |
[in] | y | The Y coordinate of the first pixel to set. |
[in] | cnt | The number of pixels to set. |
[in] | buffer | A pointer to a large enough memory buffer containing the pixels to set. The caller owns the pointed buffer. |
[in] | inc | The byte increment per pixel in the buffer. |
[in] | srcmode | The source color mode. Warning: None of the alpha modes are supported. |
[in] | flags | The flags. |
|
virtual |
Reads cnt pixels from [x,y] in the bitmap to the buffer with the color mode dstmode, incrementing inc bytes for each pixel.
[in] | x | The X coordinate of the first pixel to get. |
[in] | y | The Y coordinate of the first pixel to get. |
[in] | cnt | The number of pixels to get. |
[out] | buffer | A pointer to a large enough memory buffer where the pixel data will be written. The caller owns the pointed buffer. |
[in] | inc | The byte increment per pixel in the buffer. |
[in] | dstmode | The destination color mode. |
[in] | flags | The flags. |
[in] | conversion | This should be normally set to nullptr. Pass a color profile only if a conversion is wanted before retrieving the pixel data. This only works if either the bitmap is 32-bit per component (so no 8/16-bit images) or the dstmode is 32-bit per component. The conversion is done before color reduction (e.g. if dstmode is 16-bit the profile is first applied and then the data resampled to 16-bit). |
|
virtual |
Sets cnt alpha pixels at [x,y] in the bitmap channel from buffer incrementing inc bytes for each pixel.
[in] | x | The X coordinate of the first pixel to set. |
[in] | y | The Y coordinate of the first pixel to set. |
[in] | cnt | The number of pixels to set. |
[in] | buffer | A pointer to a large enough memory buffer containing the alpha values to set. The caller owns the pointed buffer. |
[in] | inc | The byte increment per pixel in the buffer. |
[in] | channel | The channel to set the alpha values. The caller owns the pointed bitmap. |
|
virtual |
Reads cnt alpha pixels from [x,y] in the bitmap channel to the buffer incrementing inc bytes for each pixel.
[in] | x | The X coordinate of the first pixel to get. |
[in] | y | The Y coordinate of the first pixel to get. |
[in] | cnt | The number of pixels to get. |
[out] | buffer | A pointer to a large enough memory buffer where the pixel data will be written. The caller owns the pointed buffer. |
[in] | inc | The byte increment per pixel in the buffer. |
[in] | channel | The channel to get the alpha values. The caller owns the pointed bitmap. |
Sets all line pixels at y in the bitmap from data.
[in] | y | The Y coordinate of the line to set. |
[in] | data | A pointer to a large enough memory buffer containing the pixels to set. The caller owns the pointed buffer. |
[in] | depth | The bit depth. The possible values are (1, 4, 8, 16, 24, 32, 64, 96). On some platforms 32-bit will be used even if 24 is requested, to allow for padding. In this case GetBt() will return 32. |
|
virtual |
Adds a new alpha channel to the bitmap.
[in] | internal | Should only be true for the first alpha. The internal alpha will be stored within a bitmaps if its format supports alphas. |
[in] | straight | Should be true if the bitmap has to be interpreted as straight. For information about straight alphas please take a look at the corresponding option in the render settings and the manual of Cinema 4D. |
|
virtual |
Removes the specified channel from the bitmap.
[in] | channel | The alpha channel to remove. |
|
virtual |
Gets the internal read-only alpha channel.
The internal alpha channel is the one that is saved together with the picture, with those formats that support this. If no internal alpha is available, nullptr is returned.
|
virtual |
Gets the number of alpha channels in the bitmap, including the internal channel.
|
virtual |
Gets the alpha channel specified by num.
[in] | num | An alpha channel index between 0 and GetChannelCount(). |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
Private. Internal.
|
private |
Private. Internal.
|
protected |
Private. Internal.
void* unknownBitmapData |
Private. Internal.
Int unknownBitmapSize |
Private. Internal.