27 #include "precompiled.h"
60 #define BI_RGB 0 // biCompression
73 return (file[0] ==
'B' && file[1] ==
'M');
79 return extension == L
".bmp";
85 const size_t hdr_size =
sizeof(
BmpHeader);
90 ENSURE(ofs >= hdr_size &&
"bmp_hdr_size invalid");
106 const long h = abs(h_);
129 const size_t hdr_size =
sizeof(
BmpHeader);
131 const size_t file_size = hdr_size + img_size;
134 size_t transforms = t->flags;
Status tex_codec_write(Tex *t, size_t transforms, const void *hdr, size_t hdr_size, DynArray *da)
apply transforms and then copy header and image into output buffer.
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
u32 read_le32(const void *p)
const Status TEX_CODEC_CANNOT_HANDLE
static Status bmp_transform(Tex *t, size_t transforms)
const Status TEX_COMPRESSED
indicates the image contains an alpha channel.
provides a memory range that can be expanded but doesn't waste physical memory or relocate itself...
static Status bmp_encode(Tex *RESTRICT t, DynArray *RESTRICT da)
indicates B and R pixel components are exchanged.
static Status bmp_decode(rpU8 data, size_t size, Tex *RESTRICT t)
flags & TEX_ORIENTATION is a field indicating orientation, i.e.
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
i64 Status
Error handling system.
stores all data describing an image.
u16 read_le16(const void *p)
read a little-endian number from memory into native byte order.
#define TEX_CODEC_REGISTER(name)
build codec vtbl and register it.
#define WARN_RETURN(status)
static bool bmp_is_ext(const OsPath &extension)
size_t tex_img_size(const Tex *t)
return total byte size of the image pixels.
static size_t bmp_hdr_size(const u8 *file)
static bool bmp_is_hdr(const u8 *file)