fxengine/src/render/bitmap.c

28 lines
1017 B
C
Raw Normal View History

#include <bitmap.h>
inline uint8_t bitmap_get_color_8(const bitmap_rich_8 * bmp, uint32_t x, uint32_t y)
{
if (x >= bmp->size_px_x || y >= bmp->size_px_y)
const uint32_t indice = y * bmp.size_o_y + x >> 3;
const uint32_t numero_bit = 7 - x % 8;
return ( bmp.layout[indice] | 1 << numero_bit ) << 1 + ( bmp.color[indice] | 1 << numero_bit );
}
inline uint8_t bitmap_get_color_16(const bitmap_rich_16 * bmp, uint32_t x, uint32_t y)
{
if (x >= bmp->size_px_x || y >= bmp->size_px_y)
const uint32_t indice = y * bmp.size_o_y + x >> 4;
const uint32_t numero_bit = 15 - x % 16;
return ( bmp.layout[indice] | 1 << numero_bit ) << 1 + ( bmp.color[indice] | 1 << numero_bit );
}
inline uint8_t bitmap_get_color_32(const bitmap_rich_32 * bmp, uint32_t x, uint32_t y)
{
if (x >= bmp->size_px_x || y >= bmp->size_px_y)
const uint32_t indice = y * bmp.size_o_y + x >> 5;
const uint32_t numero_bit = 31 - x % 32;
return ( bmp.layout[indice] | 1 << numero_bit ) << 1 + ( bmp.color[indice] | 1 << numero_bit );
}