Menu

SBMFormat

Kaban

SBM (Simple BitMap) is native format for PixelImage.

Layout

  • File Header
  • Bitmap Header
  • Palette entries (if any)
  • Pixel data

Structures:

File header
Delphi/Pascal:

type
  TSBitmapFileHeader = record
    dwID: cardinal;
    dwSize: cardinal;
    dwDataVersion: cardinal;
    dwReserved1: cardinal;
    dwReserved2: cardinal;
    dwReserved3: cardinal;
    dwReserved4: cardinal;
    dwOffset: cardinal;
  end;

C/C++

typedef struct _sbm_hdr_file {
    uint32_t dwID;
    uint32_t dwSize;
    uint32_t dwDataVersion;
    uint32_t dwReserved[4];
    uint32_t dwOffset;
} sbm_hdr_file_t;

where:

  • dwID - 32-bit file identifier
  • dwSize - file size
  • dwDataVersion - version of bitmap structure
  • dwReserved - reserved for future use
  • dwOffset - offset to pixel data

Bitmap Info header

Delphi/Pascal

  TSBitmapInfoHeader = record
    sbwWidth: word;
    sbwHeight: word;
    sbdwFormat: TSPixelFormat;
    sbcCompression: byte;
    sbdwRowSize: cardinal;
    sbdwDataSize: cardinal;
    sbcColorUsed: word;
  end;

C/C++

typedef struct _sbm_hdr_bitmap {
    uint16_t sbwWidth;
    uint16_t sbwHeight;
    uint8_t sbwFormat;
    uint8_t sbwCompression;
    uint32_t sbwRowSize;
    uint32_t sbwDataSize;
    uint16_t sbwColorUsed;
} sbm_hdr_bitmap_t;

where:

  • sbwWidth - image width
  • sbwHeight - image height
  • sbwFormat - bit count and colorspace (see Color Formats)
  • sbwCompression - reserved for future use
  • sbwRowSize - row size. Rows are 32-bit aligned.
  • sbwDataSize - pixel data size in bytes (height * sbwRowSize)
  • sbwColorUsed - number of colors in palette

Palette entries

Each entry is 24-bit BGR color.

tagRGBTRIPLE = packed record
    rgbtBlue: Byte;
    rgbtGreen: Byte;
    rgbtRed: Byte;
  end;

or

typedef struct _rgbtriple {
    uint8_t rgbtBlue;
    uint8_t rgbtGreen;
    uint8_t rgbtRed;
} rgbtriple_t;

Related

Wiki: ColorFormats
Wiki: FBMFormat
Wiki: Home

MongoDB Logo MongoDB