320 extern Status tex_wrap(
size_t w,
size_t h,
size_t bpp,
size_t flags,
const shared_ptr<u8>& data,
size_t ofs,
Tex* t);
411 typedef void (*
MipmapCB)(
size_t level,
size_t level_w,
size_t level_h,
const u8*
RESTRICT level_data,
size_t level_data_size,
void*
RESTRICT cbData);
476 #endif // INCLUDED_TEX
const Status TEX_INVALID_COLOR_TYPE
size_t ofs
offset to image data in file.
const Status TEX_CODEC_CANNOT_HANDLE
const int TEX_BASE_LEVEL_ONLY
special value for levels_to_skip: the callback will only be called for the base mipmap level (i...
bool tex_is_known_extension(const VfsPath &pathname)
Is the file's extension that of a texture format supported by tex_load?
Status tex_transform_to(Tex *t, size_t new_flags)
Change <t>'s pixel format (2nd version) (note: this is equivalent to tex_transform(t, t->flags^new_flags).
const Status TEX_COMPRESSED
flags & TEX_DXT is a field indicating compression.
indicates the image contains an alpha channel.
provides a memory range that can be expanded but doesn't waste physical memory or relocate itself...
const Status TEX_INCOMPLETE_HEADER
shared_ptr< u8 > data
file buffer or image data.
indicates the image is 8bpp greyscale.
size_t tex_hdr_size(const VfsPath &filename)
return the minimum header size (i.e.
indicates B and R pixel components are exchanged.
u32 tex_get_average_colour(const Tex *t)
return the ARGB value of the 1x1 mipmap level of the texture.
flags & TEX_ORIENTATION is a field indicating orientation, i.e.
Status tex_validate(const Tex *t)
Is the texture object valid and self-consistent?
const Status TEX_FMT_INVALID
const Status TEX_NOT_8BIT_PRECISION
u8 * tex_get_data(const Tex *t)
rationale: since Tex is a struct, its fields are accessible to callers.
const Status TEX_UNKNOWN_FORMAT
i64 Status
Error handling system.
stores all data describing an image.
void tex_set_global_orientation(int o)
Set the orientation to which all loaded images will automatically be converted (excepting file format...
we need a special value for DXT1a to avoid having to consider flags & TEX_ALPHA to determine S3TC typ...
const Status TEX_INVALID_DATA
void tex_util_foreach_mipmap(size_t w, size_t h, size_t bpp, const u8 *pixels, int levels_to_skip, size_t data_padding, MipmapCB cb, void *RESTRICT cbData)
for a series of mipmaps stored from base to highest, call back for each level.
const Status TEX_INVALID_LAYOUT
Status tex_wrap(size_t w, size_t h, size_t bpp, size_t flags, const shared_ptr< u8 > &data, size_t ofs, Tex *t)
store the given image data into a Tex object; this will be as if it had been loaded via tex_load...
void(* MipmapCB)(size_t level, size_t level_w, size_t level_h, const u8 *RESTRICT level_data, size_t level_data_size, void *RESTRICT cbData)
callback function for each mipmap level.
const Status TEX_INVALID_SIZE
void tex_codec_register_all()
Manually register codecs.
size_t tex_img_size(const Tex *t)
return total byte size of the image pixels.
Status tex_transform(Tex *t, size_t transforms)
Change <t>'s pixel format.
void tex_codec_unregister_all()
remove all codecs that have been registered.
size_t flags
see TexFlags and "Format Conversion" in docs.
Status tex_decode(const shared_ptr< u8 > &data, size_t dataSize, Tex *t)
decode an in-memory texture file into texture object.
void tex_free(Tex *t)
free all resources associated with the image and make further use of it impossible.
Status tex_encode(Tex *t, const OsPath &extension, DynArray *da)
encode a texture into a memory buffer in the desired file format.
TexFlags
flags describing the pixel format.