Represents a pixel buffer used for drawing, image transfer and display backing.
The Bitmap class describes a rectangular block of pixel data together with its dimensions, colour format, palette, clipping region and drawing state. Bitmaps are used directly by Display and Image objects and provide the low-level pixel storage behind much of Kōtuku's 2D graphics pipeline.
To create a bitmap, set Width and Height before initialisation. The pixel format can be selected explicitly with BitsPerPixel, BytesPerPixel, AmtColours and Type, or left for Query() and Init() to derive from the current display environment. MemType controls whether the bitmap uses regular CPU-accessible memory or a platform-specific video or texture resource where supported.
Direct CPU access is reliable for regular data bitmaps. Bitmaps backed by video or texture resources may require Lock() before reading or writing Data, and Unlock() after direct access is complete. Code that uses the drawing methods exposed by this class does not normally need to manage locking itself.
Bitmap methods are intentionally low-level and operate on immediate pixel data. Use the Vector module when retained scene graphs, paths, gradients, filters or higher-level drawing composition are required. Use Image when decoding or encoding image formats is the main concern.
Raw image bytes can be read and written with Read() and Write(). SaveImage() writes the clipped bitmap image as PCX data to a destination object that supports writing.
The Bitmap class consists of the following fields:
Access | Name | Type | Comment | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AmtColours | INT | The maximum number of colours represented by the bitmap format. | |||||||||||||||||||||||||||||||||||||||||||
For indexed bitmaps, this is the size of the usable palette. For direct-colour bitmaps, it reflects the colour range implied by BitsPerPixel and the selected ColourFormat. | |||||||||||||||||||||||||||||||||||||||||||||
| BitsPerPixel | INT | The number of bits used to represent each pixel. | |||||||||||||||||||||||||||||||||||||||||||
This includes all bits used by the pixel format, including alpha bits where present. | |||||||||||||||||||||||||||||||||||||||||||||
| Bkgd | RGB8 | Background colour in RGB format. | |||||||||||||||||||||||||||||||||||||||||||
| BkgdIndex | INT | Background colour as a packed pixel value or palette index. | |||||||||||||||||||||||||||||||||||||||||||
Use Bkgd for most updates. Set BkgdIndex directly only when the caller has already calculated the target bitmap's native pixel value or palette index. | |||||||||||||||||||||||||||||||||||||||||||||
| BlendMode | BLM | Defines the blending algorithm to use when rendering transparent pixels. | |||||||||||||||||||||||||||||||||||||||||||
The default value is
| |||||||||||||||||||||||||||||||||||||||||||||
| ByteWidth | INT | The width of the bitmap, in bytes. | |||||||||||||||||||||||||||||||||||||||||||
ByteWidth is calculated from Width, Type and BytesPerPixel. It describes the meaningful pixel bytes in a row and does not include alignment padding. The formulas used to calculate the value of this field are: Planar = Width/8 Chunky/8 = Width Chunky/15 = Width * 2 Chunky/16 = Width * 2 Chunky/24 = Width * 3 Chunky/32 = Width * 4 To learn the total byte-width per line including any additional padded bytes, refer to the LineWidth field. | |||||||||||||||||||||||||||||||||||||||||||||
| BytesPerPixel | INT | The number of bytes per pixel. | |||||||||||||||||||||||||||||||||||||||||||
This field reflects the byte count used by one chunky pixel. Values normally range from 1 to 4. For planar bitmaps, BitsPerPixel is the more useful format indicator. | |||||||||||||||||||||||||||||||||||||||||||||
| Clip | struct ClipRectangle | Defines the bitmap's clipping region. | |||||||||||||||||||||||||||||||||||||||||||
Clip is a shorthand reference for ClipLeft, ClipTop, ClipRight and ClipBottom, returning all four values as a single ClipRectangle structure. | |||||||||||||||||||||||||||||||||||||||||||||
| ClipBottom | INT | The exclusive bottom edge of the bitmap clipping region. | |||||||||||||||||||||||||||||||||||||||||||
The default clipping region matches the bitmap dimensions. Drawing operations are limited to the active clipping region. | |||||||||||||||||||||||||||||||||||||||||||||
| ClipLeft | INT | The left-most edge of a bitmap's clipping region. | |||||||||||||||||||||||||||||||||||||||||||
The default clipping region matches the bitmap dimensions. Drawing operations are limited to the active clipping region. | |||||||||||||||||||||||||||||||||||||||||||||
| ClipRight | INT | The exclusive right edge of the bitmap clipping region. | |||||||||||||||||||||||||||||||||||||||||||
The default clipping region matches the bitmap dimensions. Drawing operations are limited to the active clipping region. | |||||||||||||||||||||||||||||||||||||||||||||
| ClipTop | INT | The top-most edge of a bitmap's clipping region. | |||||||||||||||||||||||||||||||||||||||||||
The default clipping region matches the bitmap dimensions. Drawing operations are limited to the active clipping region. | |||||||||||||||||||||||||||||||||||||||||||||
| ColourFormat | struct ColourFormat * | Describes the colour format used to construct each bitmap pixel. | |||||||||||||||||||||||||||||||||||||||||||
ColourFormat points to the structure that describes how packed pixel values map to red, green, blue and alpha channels. It is relevant for direct-colour bitmaps, normally those with two or more bytes per pixel.
The following C++ helper methods can be called on a bitmap to build packed colour values from channel components: packPixel(Red, Green, Blue) packPixel(Red, Green, Blue, Alpha) packAlpha(Alpha) packPixelRGB(RGB8 &RGB) packPixelRGBA(RGB8 &RGB) The following C macros are optimised forms for 24 and 32-bit bitmaps: PackPixelWB(Red, Green, Blue) PackPixelWBA(Red, Green, Blue, Alpha) The following C++ helper methods unpack individual colour components from a packed colour value: unpackRed(Colour) unpackGreen(Colour) unpackBlue(Colour) unpackAlpha(Colour) | |||||||||||||||||||||||||||||||||||||||||||||
| ColourSpace | CS | Defines the colour space for RGB values. | |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
| Data | UINT8[] | Provides direct access to the bitmap's data area. | |||||||||||||||||||||||||||||||||||||||||||
Data points to the first byte of the bitmap's pixel buffer when CPU-visible memory is available. Caller-supplied memory can be used for data-backed bitmaps, but most callers should let Init() allocate the correctly sized buffer. For video or texture-backed bitmaps, Data may be unavailable until Lock() succeeds. | |||||||||||||||||||||||||||||||||||||||||||||
| DrawUCPixel | FUNCTION * | Points to a C function that draws pixels to the bitmap using colour indexes. | |||||||||||||||||||||||||||||||||||||||||||
DrawUCPixel points to the active low-level pixel writer for packed colour or palette-index values. It is intended for C callers that need direct pixel access. No clipping or bounds checks are performed. The prototype of the DrawUCPixel function is The new pixel value is supplied in the | |||||||||||||||||||||||||||||||||||||||||||||
| DrawUCRIndex | FUNCTION * | Points to a C function that draws pixels to the bitmap in RGB format. | |||||||||||||||||||||||||||||||||||||||||||
DrawUCRIndex points to the active low-level RGB pixel writer for a caller-supplied address inside Data. It is intended for C callers that need direct pixel access. No clipping, bounds or address validation is performed. The prototype of the DrawUCRIndex function is The Data parameter must point to a location within the Bitmap's graphical address space. The new pixel value must be defined in the There is no colour-index equivalent because callers can write indexed pixel bytes directly through Data. | |||||||||||||||||||||||||||||||||||||||||||||
| DrawUCRPixel | FUNCTION * | Points to a C function that draws pixels to the bitmap in RGB format. | |||||||||||||||||||||||||||||||||||||||||||
DrawUCRPixel points to the active low-level RGB pixel writer for The prototype of the DrawUCRPixel function is The new pixel value must be defined in the | |||||||||||||||||||||||||||||||||||||||||||||
| Flags | BMF | Optional flags. | |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
| Handle | APTR | Platform-dependent field for referencing video memory. | |||||||||||||||||||||||||||||||||||||||||||
| Height | INT | The height of the bitmap, in pixels. | |||||||||||||||||||||||||||||||||||||||||||
| LineWidth | INT | The length of each bitmap line in bytes, including alignment. | |||||||||||||||||||||||||||||||||||||||||||
LineWidth includes any row padding required by the active bitmap type or platform backend. Use ByteWidth for the number of meaningful pixel bytes in a row. | |||||||||||||||||||||||||||||||||||||||||||||
| MemType | BMT | Defines the memory type used to host a bitmap's data area. | |||||||||||||||||||||||||||||||||||||||||||
MemType controls the kind of backing storage requested during initialisation. The available values are Video or texture-backed bitmaps can be faster for some drawing paths, but direct CPU access is platform dependent. Use Lock() before reading or writing Data directly when the bitmap is not a regular data bitmap.
| |||||||||||||||||||||||||||||||||||||||||||||
| Opacity | INT | Determines the translucency setting to use in drawing operations. | |||||||||||||||||||||||||||||||||||||||||||
Opacity is an 8-bit alpha multiplier used by drawing operations that support translucent bitmap copies. A value of This value is separate from any per-pixel alpha channel stored in the bitmap. | |||||||||||||||||||||||||||||||||||||||||||||
| Palette | struct RGBPalette * | Points to a bitmap's colour palette. | |||||||||||||||||||||||||||||||||||||||||||
Palette points to the bitmap's colour table. Indexed bitmaps use this table to map pixel values to RGB colours, and some conversion paths use it even when the bitmap itself is direct-colour. The structure starts with the palette header and colour count, followed by colour entries in index order. There is no terminating entry. The following example is for a 32 colour palette: RGBPalette Palette = {
ID_PALETTE, VER_PALETTE, 32,
{{ 0x00,0x00,0x00 }, { 0x10,0x10,0x10 }, { 0x17,0x17,0x17 }, { 0x20,0x20,0x20 },
{ 0x27,0x27,0x27 }, { 0x30,0x30,0x30 }, { 0x37,0x37,0x37 }, { 0x40,0x40,0x40 },
{ 0x47,0x47,0x47 }, { 0x50,0x50,0x50 }, { 0x57,0x57,0x57 }, { 0x60,0x60,0x60 },
{ 0x67,0x67,0x67 }, { 0x70,0x70,0x70 }, { 0x77,0x77,0x77 }, { 0x80,0x80,0x80 },
{ 0x87,0x87,0x87 }, { 0x90,0x90,0x90 }, { 0x97,0x97,0x97 }, { 0xa0,0xa0,0xa0 },
{ 0xa7,0xa7,0xa7 }, { 0xb0,0xb0,0xb0 }, { 0xb7,0xb7,0xb7 }, { 0xc0,0xc0,0xc0 },
{ 0xc7,0xc7,0xc7 }, { 0xd0,0xd0,0xd0 }, { 0xd7,0xd7,0xd7 }, { 0xe0,0xe0,0xe0 },
{ 0xe0,0xe0,0xe0 }, { 0xf0,0xf0,0xf0 }, { 0xf7,0xf7,0xf7 }, { 0xff,0xff,0xff }
}
};
Palettes are created for all bitmap types, including RGB bitmaps above 8-bit colour, because several drawing functions use a palette table when converting between bitmap formats. Parent objects such as Display may need to be updated separately before palette changes are reflected by the visible display. | |||||||||||||||||||||||||||||||||||||||||||||
| PlaneMod | INT | The differential between each bitmap plane. | |||||||||||||||||||||||||||||||||||||||||||
PlaneMod specifies the byte distance between each bitplane in planar bitmaps. For chunky bitmaps, it reflects the total size of the bitmap buffer. | |||||||||||||||||||||||||||||||||||||||||||||
| Position | INT | The current read/write data position. | |||||||||||||||||||||||||||||||||||||||||||
| ReadUCPixel | FUNCTION * | Points to a C function that reads pixels from the bitmap in colour index format. | |||||||||||||||||||||||||||||||||||||||||||
ReadUCPixel points to the active low-level pixel reader for packed colour or palette-index values. It is intended for C callers that need direct pixel access. No clipping or bounds checks are performed. The prototype of the ReadUCPixel function is The pixel value will be returned in the | |||||||||||||||||||||||||||||||||||||||||||||
| ReadUCRIndex | FUNCTION * | Points to a C function that reads pixels from the bitmap in RGB format. | |||||||||||||||||||||||||||||||||||||||||||
ReadUCRIndex points to the active low-level RGB pixel reader for a caller-supplied address inside Data. It is intended for C callers that need direct pixel access. No clipping, bounds or address validation is performed. The prototype of the ReadUCRIndex function is The There is no colour-index equivalent because callers can read indexed pixel bytes directly through Data. | |||||||||||||||||||||||||||||||||||||||||||||
| ReadUCRPixel | FUNCTION * | Points to a C function that reads pixels from the bitmap in RGB format. | |||||||||||||||||||||||||||||||||||||||||||
ReadUCRPixel points to the active low-level RGB pixel reader for The prototype of the ReadUCRPixel function is The pixel value is returned in the | |||||||||||||||||||||||||||||||||||||||||||||
| Size | INT | The total size of the bitmap, in bytes. | |||||||||||||||||||||||||||||||||||||||||||
| TransColour | RGB8 | The transparent colour of the bitmap, in RGB format. | |||||||||||||||||||||||||||||||||||||||||||
Pixels matching this colour are skipped by drawing operations that honour colour-key transparency. Do not use colour-key transparency on bitmaps that use alpha transparency. | |||||||||||||||||||||||||||||||||||||||||||||
| TransIndex | INT | The transparent colour of the bitmap, represented as an index. | |||||||||||||||||||||||||||||||||||||||||||
TransIndex stores the transparent colour as a packed pixel value or palette index. Pixels matching this value are skipped by drawing operations that honour colour-key transparency. Use TransColour for most updates. Set TransIndex directly only when the caller has already calculated the target bitmap's native pixel value or palette index. Do not use colour-key transparency on bitmaps that use alpha transparency. | |||||||||||||||||||||||||||||||||||||||||||||
| Type | BMP | Defines the data type of the bitmap. | |||||||||||||||||||||||||||||||||||||||||||
Type defines the bitmap layout, either
| |||||||||||||||||||||||||||||||||||||||||||||
| Width | INT | The width of the bitmap, in pixels. | |||||||||||||||||||||||||||||||||||||||||||
The following actions are currently supported:
| Clear | Clears the bitmap image to BkgdIndex. | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ERR acClear(*Object) Clear fills the full bitmap with the current background colour. The colour used by the operation is BkgdIndex, which is derived from Bkgd when the background colour is set through the RGB field. To clear a bitmap to a different colour without changing the background fields, call DrawRectangle() with Error Codes
| ||||||||||||||||||||||||
| CopyData | Copies bitmap image data to other bitmaps with colour remapping enabled. | |||||||||||||||||||||||
ERR acCopyData(*Object, OBJECTID Dest)
CopyData copies this bitmap into another initialised Bitmap object. Other destination classes are not supported. The copy is clipped to the destination dimensions. If the destination is wider or taller than the source, the exposed area is cleared to the destination bitmap's background colour. Error Codes
| ||||||||||||||||||||||||
| Draw | Clears the bitmap image to BkgdIndex. | |||||||||||||||||||||||
ERR acDraw(*Object, DOUBLE X, DOUBLE Y, DOUBLE Width, DOUBLE Height)
Draw fills the full bitmap with the current background colour. It is equivalent to drawing a filled rectangle over the entire bitmap with BkgdIndex. | ||||||||||||||||||||||||
| Flush | Flushes pending graphics operations and returns when the accelerator is idle. | |||||||||||||||||||||||
ERR acFlush(*Object) Flush synchronises pending graphics operations with the active graphics backend. Synchronisation is required before direct CPU access to accelerator-managed bitmap memory. Clients do not need to call this function if solely using the graphics methods provided in the Bitmap class. | ||||||||||||||||||||||||
| Init | Initialises a bitmap. | |||||||||||||||||||||||
ERR InitObject(*Object) Init prepares a queried bitmap for use. It validates the calculated bitmap state, allocates Data when required, configures platform-specific backing resources and selects the pixel access routines used by drawing operations. If Data has already been supplied, Init uses the caller-provided memory. Otherwise allocation is controlled by MemType and Flags. Width and Height must be set before this action is called. Error Codes
| ||||||||||||||||||||||||
| Lock | Locks the bitmap surface for direct read/write access. | |||||||||||||||||||||||
ERR acLock(*Object) Lock makes bitmap memory available through Data for direct CPU access. It is mainly required for bitmaps backed by a video or platform drawable resource; data-backed bitmaps are already CPU-accessible. Call Unlock() when direct access is complete so platform resources can be released or synchronised. Error Codes
| ||||||||||||||||||||||||
| Query | Populates a bitmap with pre-initialised/default values prior to initialisation. | |||||||||||||||||||||||
ERR acQuery(*Object) Query calculates the bitmap's derived fields without allocating image memory. It resolves values such as Type, BytesPerPixel, BitsPerPixel, AmtColours, ByteWidth, LineWidth, PlaneMod and Size from the fields already set by the caller. At minimum, Width and Height must be positive. If format fields are incomplete, Query derives a compatible format where possible; for example, BytesPerPixel set to Error Codes
| ||||||||||||||||||||||||
| Read | Reads raw image data from a bitmap object. | |||||||||||||||||||||||
ERR acRead(*Object, std::span<int8_t> Buffer, INT *Result)
Read copies bytes from Data into the supplied output buffer, starting at Position. Position is advanced by the number of bytes copied and the result count is returned in the action arguments. If the requested length would pass the end of the bitmap data, Read truncates the transfer to the remaining byte count. Error Codes
| ||||||||||||||||||||||||
| Resize | Resizes a bitmap object's dimensions. | |||||||||||||||||||||||
ERR acResize(*Object, DOUBLE Width, DOUBLE Height, DOUBLE Depth)
Resize changes Width, Height and, unless If Error Codes
| ||||||||||||||||||||||||
| SaveImage | Saves the bitmap image to a writable object in PCX format. | |||||||||||||||||||||||
ERR acSaveImage(*Object, OBJECTID Dest, CLASSID ClassID)
SaveImage writes the current clipping region to Errors returned by the destination object's Write action are propagated to the caller. Error Codes
| ||||||||||||||||||||||||
| Seek | Changes the current byte position for read/write operations. | |||||||||||||||||||||||
ERR acSeek(*Object, DOUBLE Offset, INT Position)
| ||||||||||||||||||||||||
| Unlock | Unlocks the bitmap surface once direct access is no longer required. | |||||||||||||||||||||||
ERR acUnlock(*Object) Unlock releases or synchronises any platform resources held for direct CPU access after Lock(). Error Codes
| ||||||||||||||||||||||||
| Write | Writes raw image data to a bitmap object. | |||||||||||||||||||||||
ERR acWrite(*Object, std::span<const int8_t> Buffer, INT *Result)
Write copies bytes from the supplied input buffer into Data, starting at Position. Position is advanced by the number of bytes written and the result count is returned in the action arguments. The write must fit within the bitmap's allocated Size. Use Seek() to change the target position before writing. Error Codes
| ||||||||||||||||||||||||
The following methods are currently supported:
| ConvertToLinear | Converts a bitmap's colour space to linear RGB. | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ERR bmp::ConvertToLinear(OBJECTPTR Object) ConvertToLinear() converts the bitmap's clipped region from sRGB to linear RGB. If ColourSpace is set to This method currently requires a 32-bit bitmap. Error Codes
| |||||||||||||||||||||||||
| ConvertToRGB | Converts a bitmap's colour space to standard RGB. | ||||||||||||||||||||||||
ERR bmp::ConvertToRGB(OBJECTPTR Object) ConvertToRGB() converts the bitmap's clipped region from linear RGB to sRGB. If ColourSpace is set to This method currently requires a 32-bit bitmap. Error Codes
| |||||||||||||||||||||||||
| CopyArea | Copies a rectangular area from one bitmap to another. | ||||||||||||||||||||||||
ERR bmp::CopyArea(OBJECTPTR Object, objBitmap * DestBitmap, BAF Flags, INT X, INT Y, INT Width, INT Height, INT XDest, INT YDest)
CopyArea() copies a rectangular region from this bitmap to The operation is implemented by CopyArea() and supports the same BAF options. Error Codes
| |||||||||||||||||||||||||
| Demultiply | Reverses the conversion process performed by Premultiply(). | ||||||||||||||||||||||||
ERR bmp::Demultiply(OBJECTPTR Object) Demultiply() restores straight RGB channel values after Premultiply() has converted them to premultiplied alpha. The method returns This method operates only on 32-bit bitmaps that have an alpha channel, and it processes only the current clipping region. Error Codes
| |||||||||||||||||||||||||
| DrawRectangle | Draws rectangles, both filled and unfilled. | ||||||||||||||||||||||||
ERR bmp::DrawRectangle(OBJECTPTR Object, INT X, INT Y, INT Width, INT Height, UINT Colour, BAF Flags)
This method draws both filled and unfilled rectangles. The rectangle is drawn to the target bitmap at position The draw operation is clipped to the bitmap's current clipping region. Error Codes
| |||||||||||||||||||||||||
| GetColour | Converts Red, Green, Blue components into a single colour value. | ||||||||||||||||||||||||
ERR bmp::GetColour(OBJECTPTR Object, INT Red, INT Green, INT Blue, INT Alpha, UINT * Colour)
The GetColour() method is used to convert Error Codes
| |||||||||||||||||||||||||
| Premultiply | Premultiplies RGB channel values by the alpha channel. | ||||||||||||||||||||||||
ERR bmp::Premultiply(OBJECTPTR Object) Premultiply() converts RGB values in the current clipping region to premultiplied-alpha form. The formula applied to each colour channel is This method operates only on 32-bit bitmaps that have an alpha channel. If the bitmap is already marked as premultiplied, the method returns The process can be reversed with a call to Demultiply(). Error Codes
| |||||||||||||||||||||||||
| SetClipRegion | Sets a clipping region for a bitmap object. | ||||||||||||||||||||||||
ERR bmp::SetClipRegion(OBJECTPTR Object, INT Left, INT Top, INT Right, INT Bottom)
SetClipRegion() updates the bitmap's clipping region. Drawing operations are restricted to the combined region. This method is implemented by SetClipRegion(). Error Codes
| |||||||||||||||||||||||||
Instructions for basic graphics operations.
| Name | Description |
|---|---|
| BAF::BLEND | Enable alpha blending to the destination if the source supports an alpha channel. |
| BAF::COPY | Special CopyArea() option that avoids blending when the destination pixel is empty. |
| BAF::DITHER | Perform dithering if the colour formats differ between the source and destination. |
| BAF::FILL | For primitive operations such as DrawRectangle(), this will fill the shape with a solid colour or texture. |
| BAF::LINEAR | Use linear interpolation to improve the quality of alpha blending. |
Defines the blending algorithm to use when transparent pixels are rendered to the bitmap.
| Name | Description |
|---|---|
| BLM::AUTO | Use the most suitable of the available algorithms. |
| BLM::GAMMA | Use gamma correct blending. This algorithm is slow but produces a high quality result. |
| BLM::LINEAR | Use linear blending. Applicable if the bitmap is in linear colour space. |
| BLM::NONE | Never blend transparent pixels, just copy as-is. |
| BLM::SRGB | Use sRGB linear blending. This algorithm is extremely efficient but produces poor quality results. |
Bitmap flags
| Name | Description |
|---|---|
| BMF::ACCELERATED_2D | 2D video acceleration is available. |
| BMF::ACCELERATED_3D | 3D video acceleration is available. |
| BMF::ALPHA_CHANNEL | For 32-bit images, indicates that an alpha channel is present. |
| BMF::BLANK_PALETTE | Forces a blank/black palette on initialisation. |
| BMF::CLEAR | Clear graphics on initialisation and when resizing. |
| BMF::COMPRESSED | The bitmap data is compressed. |
| BMF::FIXED_DEPTH | Prevent changing of bitmap depth after initialisation (e.g. via Resize()). |
| BMF::INVERSE_ALPHA | Indicates reverse alpha blending, higher values are transparent. |
| BMF::MASK | Declare the Bitmap as a 1 or 8 bit mask. Must be set in conjunction with the Bitmap⇒BitsPerPixel field on initialisation. |
| BMF::NEVER_SHRINK | Ignore resize requests that would shrink the size of the bitmap. |
| BMF::NO_DATA | Do not allocate memory in the Data field on initialisation. |
| BMF::PREMUL | The RGB values are premultiplied (32-bit only). |
| BMF::QUERIED | Automatically set after a Query() on the bitmap. |
| BMF::TRANSPARENT | Indicates that the bitmap utilises a transparent colour. This is automatically set if the Bitmap⇒TransIndex or Bitmap⇒TransColour is defined, and support exists in functions such as CopyArea(). |
| BMF::USER | This user flag can be used to tag bitmaps with special meaning. Not used internally. |
Bitmap types
| Name | Description |
|---|---|
| BMP::CHUNKY | Chunky pixel mode (default). |
| BMP::PLANAR | Planar pixel mode separates pixel bits across multiple planes. Commonly used for single bit bitmap masks. |
Bitmap memory type.
| Name | Description |
|---|---|
| BMT::DATA | The default type, indicates a standard memory allocation from system RAM. |
| BMT::TEXTURE | Identifies non-displayable video memory, e.g. texture graphics. |
| BMT::VIDEO | Identifies video memory, such as the frame buffer. |
Colour space options.
| Name | Description |
|---|---|
| CS::CIE_LAB | Cartesian L*a*b* colour space defined by CIE 15. |
| CS::CIE_LCH | Polar L*CHab colour space defined by CIE 15. |
| CS::LINEAR_RGB | Linear RGB is used to improve colour balance in blending operations. |
| CS::SRGB | The default colour-space is sRGB. |
| Field | Type | Description |
|---|---|---|
| RedShift | UINT8 | Right shift value for red (15/16 bit formats only) |
| GreenShift | UINT8 | Right shift value for green |
| BlueShift | UINT8 | Right shift value for blue |
| AlphaShift | UINT8 | Right shift value for alpha |
| RedMask | UINT8 | Unshifted mask value for red (ranges from 0x00 to 0xff) |
| GreenMask | UINT8 | Unshifted mask value for green |
| BlueMask | UINT8 | Unshifted mask value for blue |
| AlphaMask | UINT8 | Unshifted mask value for alpha |
| RedPos | UINT8 | Left shift/positional value for red |
| GreenPos | UINT8 | Left shift/positional value for green |
| BluePos | UINT8 | Left shift/positional value for blue |
| AlphaPos | UINT8 | Left shift/positional value for alpha |
| BitsPerPixel | UINT8 | Number of bits per pixel for this format. |