Refactor bitmap, add extra accessor for color data

This commit is contained in:
2025-08-07 22:05:12 +03:00
parent 4ce443f0d9
commit d05efc5f85
6 changed files with 463 additions and 718 deletions

View File

@@ -11,24 +11,36 @@ typedef struct BH_Bitmap BH_Bitmap;
#define BH_BITMAP_PREMULT 0x1000
#define BH_BITMAP_NOALPHA 0x2000
#define BH_BITMAP_BGR 0x4000
#define BH_BITMAP_LSB 0x8000
#define BH_BITMAP_INDEX1 0x0000
#define BH_BITMAP_INDEX2 0x0001
#define BH_BITMAP_INDEX4 0x0002
#define BH_BITMAP_INDEX8 0x0003
#define BH_BITMAP_GRAY8 0x0004
#define BH_BITMAP_GRAY16 0x0005
#define BH_BITMAP_RGBA32 0x0006
#define BH_BITMAP_RGBA64 0x0007
#define BH_BITMAP_RGB565 0x0008
#define BH_BITMAP_RGB888 0x0009
#define BH_BITMAP_RGBA8888 0x000A
#define BH_BITMAP_RGB161616 0x000B
#define BH_BITMAP_RGBA16161616 0x000C
#define BH_BITMAP_RGBA1010102 0x000D
#define BH_BITMAP_INDEX1_LSB 0x0001
#define BH_BITMAP_INDEX2 0x0002
#define BH_BITMAP_INDEX2_LSB 0x0003
#define BH_BITMAP_INDEX4 0x0004
#define BH_BITMAP_INDEX4_LSB 0x0005
#define BH_BITMAP_INDEX8 0x0006
#define BH_BITMAP_GRAY8 0x0007
#define BH_BITMAP_GRAY16 0x0008
#define BH_BITMAP_RGBA32 0x0009
#define BH_BITMAP_RGBA64 0x000A
#define BH_BITMAP_RGB565 0x000B
#define BH_BITMAP_BGR565 0x000C
#define BH_BITMAP_RGB888 0x000D
#define BH_BITMAP_BGR888 0x000E
#define BH_BITMAP_RGBA8888 0x000F
#define BH_BITMAP_BGRA8888 0x0010
#define BH_BITMAP_ARGB8888 0x0011
#define BH_BITMAP_ABGR8888 0x0012
#define BH_BITMAP_RGB161616 0x0013
#define BH_BITMAP_BGR161616 0x0014
#define BH_BITMAP_RGBA16161616 0x0015
#define BH_BITMAP_BGRA16161616 0x0016
#define BH_BITMAP_ARGB16161616 0x0017
#define BH_BITMAP_ABGR16161616 0x0018
#define BH_BITMAP_RGBA1010102 0x0019
#define BH_BITMAP_BGRA1010102 0x001A
#define BH_BITMAP_ARGB2101010 0x001B
#define BH_BITMAP_ABGR2101010 0x001C
#define BH_BITMAP_FLAG_ALIGN32 0x0001
#define BH_BITMAP_FLAG_EXT_DATA 0x0002
@@ -40,7 +52,7 @@ BH_Bitmap *BH_BitmapNew(uint32_t width,
int format,
int flags,
void *data,
void *palette);
BH_Color *palette);
void BH_BitmapFree(BH_Bitmap *bitmap);
@@ -109,10 +121,10 @@ int BH_BitmapFlags(BH_Bitmap *bitmap);
void BH_BitmapConvertRow(void *src,
int srcFormat,
void *srcPalette,
const BH_Color *srcPalette,
void *dest,
int destFormat,
void *destPalette,
const BH_Color *destPalette,
size_t count);

View File

@@ -56,6 +56,7 @@ typedef struct BH_Color
uint16_t l;
uint16_t a;
} hsla;
uint16_t channel[4];
} data;
} BH_Color;