Skip to content
RedstoneShell edited this page Oct 10, 2026 · 1 revision

DBMP_H

Linking by #include <dbmp.h>, compiling by adding dbmp.o in linker.

dbmp_info

Structure that describe BMP.

typedef struct dbmp_info {
  u64 width; // BMP image width
  u64 height; // BMP image height
  u64 bpp; // Bits Per Pixel
  u64 pixel_offset; // Offset from start of file to first pixel
  int top_down; // Line direction flag: 1 - top_down, 0 - down_top
  u64 row_stride; // Real size of one line + pad
  const u8 *pixels; // Pointer to buffer of pixels in Virtual Memory
} dbmp_info_t

dbmp_check(const buf: void*, size: u64): int

Check if BMP is valid. buf is buffer at loaded in memory BMP, size is sizeof(buf) of buffer. Return 0 if invalid, 1 if valid.

dbmp_parse(const buf: void*, size: u64, out: dbmp_info_t*): int

Parse BMP into structure, buf is buffer at loaded in memory BMP, size is sizeof(buf) of buffer, out is output paramater where structure out filled.

dbmp_get_pixel(const info: dbmp_info_t*, x: u64, y: u64): u32

Get pixel in BMP at @(X,Y), info is structure that generated by dbmp_parse(void*, u64, dbmp_info_t*):int. Returns color of pixel in 0x00RRGGBB.

Clone this wiki locally