struct Core::BitmapData

Overview

Struct for bitmap data mapped into main memory. More…

#include <corebitmapdata.h>

struct BitmapData
{
    // fields

    int width;
    int height;
    int format;
    void* scan0;
    int rowBytes;
    int bitsPerPixel;

    // methods

    INLINE void init(
        int width,
        int height,
        BitmapPixelFormat format,
        bool doubleWordAligned
    );

    INLINE void initScan0(void* bufferStart, bool topDown);
    INLINE void* getScanline(int y);
    INLINE const void* getScanline(int y) const;
    INLINE int getBytesPerPixel() const;
    INLINE RGBA& rgbaAt(int x, int y);
    INLINE const RGBA& rgbaAt(int x, int y) const;
    INLINE Pixel* getPixel(int x, int y);
    INLINE const Pixel* getPixel(int x, int y) const;
    INLINE uint16& rgb16At(int x, int y);
    INLINE const uint16& rgb16At(int x, int y) const;
    INLINE bool getBit(int x, int y) const;
    INLINE void setBit(int x, int y, bool state);

    static INLINE int getRowBytes(
        int width,
        int bitsPerPixel,
        bool doubleWordAligned
    );

    static INLINE void setRgb(Pixel* p, Pixel r, Pixel g, Pixel b);
    static INLINE void getRgb(Pixel& r, Pixel& g, Pixel& b, const Pixel* p);
};

Detailed Documentation

Struct for bitmap data mapped into main memory.

Fields

int width

bitmap width

int height

bitmap height

int format

See also:

BitmapPixelFormat

void* scan0

address of first scanline

int rowBytes

offset between scanlines in bytes (can be negative if image is bottom-up!)

int bitsPerPixel

number of bits per pixel

Methods

INLINE void init(
    int width,
    int height,
    BitmapPixelFormat format,
    bool doubleWordAligned
)

Initialize bitmap data structure.

INLINE void initScan0(void* bufferStart, bool topDown)

Initialize pointer to first scanline.

INLINE void* getScanline(int y)

Get scanline address (writable).

INLINE const void* getScanline(int y) const

Get scanline address (read-only).

INLINE int getBytesPerPixel() const

Get number of bytes used to store a pixel.

INLINE RGBA& rgbaAt(int x, int y)

Get RGBA pixel (writable).

INLINE const RGBA& rgbaAt(int x, int y) const

Get RGBA pixel (read-only).

INLINE Pixel* getPixel(int x, int y)

Get RGB pixel address (writable).

INLINE const Pixel* getPixel(int x, int y) const

Get RGB pixel address (read-only).

INLINE uint16& rgb16At(int x, int y)

Get 16 Bit (RGB 565) pixel (writable).

INLINE const uint16& rgb16At(int x, int y) const

Get 16 Bit (RGB 565) pixel (read-only).

INLINE bool getBit(int x, int y) const

Get monochrome pixel value.

INLINE void setBit(int x, int y, bool state)

Set monochrome pixel value.

static INLINE int getRowBytes(
    int width,
    int bitsPerPixel,
    bool doubleWordAligned
)

Calculate bytes per row based on given bitmap specification.

static INLINE void setRgb(Pixel* p, Pixel r, Pixel g, Pixel b)

Set RGB values at pixel address.

static INLINE void getRgb(Pixel& r, Pixel& g, Pixel& b, const Pixel* p)

Set RGB values at pixel address.