Refactor bitmap, add RGBA5551 format

This commit is contained in:
2025-08-26 10:40:43 +03:00
parent dd63b19f71
commit 3bba87d8dc
4 changed files with 222 additions and 148 deletions

View File

@@ -70,6 +70,10 @@ Currently, the following pixel formats are supported:
64-bit RGB with alpha represented in uint64_t value. The layout is:
0xAAAARRRRGGGGBBBB
=item B<BH_BITMAP_RGBA5551>, B<BH_BITMAP_BGRA5551>, B<BH_BITMAP_ARGB1555>, B<BH_BITMAP_ABGR1555>
16-bit RGB
=item B<BH_BITMAP_RGB565>, B<BH_BITMAP_BGR565>
16-bit RGB
@@ -116,7 +120,8 @@ premultiplied form.
int format,
int flags,
void *data,
BH_Color *palette);
BH_Color *palette,
int *result);
Creates the bitmap with the specified I<width>, I<height> and pixel I<format>.
@@ -134,6 +139,8 @@ The optional I<data> parameter specifies pointer to the existing data.
The optional I<palette> parameter specifies pointer to the existing palette.
The optional parameter I<result> returns 0 or an error code.
This function returns a pointer to a new BH_Bitmap object or NULL.
@@ -198,7 +205,8 @@ The I<x> and I<y> parameters specify a position on the bitmap.
uint32_t y,
uint32_t width,
uint32_t height,
int shallow);
int shallow,
int *result);
Creates a copy of the bitmap region by the given position and size.
@@ -210,6 +218,8 @@ The I<shallow> parameter specifies whether the new bitmap is a shallow copy (or
a view) of the existing bitmap or a deep copy. For the shallow copy to work, the
region should be within the existing bitmap.
The optional parameter I<result> returns 0 or an error code.
This function returns a pointer to a new BH_Bitmap object or NULL.

View File

@@ -71,6 +71,10 @@ BH_Bitmap - доступ к растровому изображению/карт
64-разрядный RGB с прозрачностью, представленный в виде uint64_t.
Формат: 0xAAAARRRRGGGGBBBB
=item B<BH_BITMAP_RGBA5551>, B<BH_BITMAP_BGRA5551>, B<BH_BITMAP_ARGB1555>, B<BH_BITMAP_ABGR1555>
16-разрядный RGB
=item B<BH_BITMAP_RGB565>, B<BH_BITMAP_BGR565>
16-разрядный RGB
@@ -117,7 +121,8 @@ BH_Bitmap - доступ к растровому изображению/карт
int format,
int flags,
void *data,
BH_Color *palette);
BH_Color *palette,
int *result);
Создает растровое изображение с указанной шириной, высотой и пиксельным
форматом.
@@ -140,6 +145,8 @@ BH_Bitmap - доступ к растровому изображению/карт
Необязательный параметр I<palette> указывает на существующую палитру.
Опциональный параметр I<result> возвращает 0 или код ошибки.
Эта функция возвращает указатель на новый объект BH_Bitmap или значение NULL.
@@ -204,7 +211,8 @@ void BH_BitmapSetIndex(BH_Bitmap *bitmap,
uint32_t y,
uint32_t width,
uint32_t height,
int shallow);
int shallow,
int *result);
Создает копию области растрового изображения с заданным положением и размером.
@@ -217,6 +225,8 @@ void BH_BitmapSetIndex(BH_Bitmap *bitmap,
его глубокой копией. Для работы с поверхностной копией область должна находиться
в пределах существующего растрового изображения.
Опциональный параметр I<result> возвращает 0 или код ошибки.
Эта функция возвращает указатель на новый объект BH_Bitmap или NULL.