27 #ifndef INCLUDED_TEX_CODEC 28 #define INCLUDED_TEX_CODEC 87 virtual bool is_hdr(
const u8* file)
const = 0;
110 virtual size_t hdr_size(
const u8* file)
const = 0;
115 virtual const wchar_t*
get_name()
const = 0;
125 virtual bool is_hdr(
const u8* file)
const;
127 virtual size_t hdr_size(
const u8* file)
const;
129 static const wchar_t *name = L
"png";
139 virtual bool is_hdr(
const u8* file)
const;
141 virtual size_t hdr_size(
const u8* file)
const;
143 static const wchar_t *name = L
"dds";
153 virtual bool is_hdr(
const u8* file)
const;
155 virtual size_t hdr_size(
const u8* file)
const;
157 static const wchar_t *name = L
"tga";
167 virtual bool is_hdr(
const u8* file)
const;
169 virtual size_t hdr_size(
const u8* file)
const;
171 static const wchar_t *name = L
"bmp";
230 extern std::vector<RowPtr>
tex_codec_alloc_rows(
const u8* data,
size_t h,
size_t pitch,
size_t src_flags,
size_t dst_orientation);
244 #endif // #ifndef INCLUDED_TEX_CODEC virtual Status transform(Tex *t, size_t transforms) const =0
transform the texture's pixel format.
Stores all data describing an image.
Definition: tex.h:208
Status tex_codec_transform(Tex *t, size_t transforms)
transform the texture's pixel format.
Definition: tex_codec.cpp:84
provides a memory range that can be expanded but doesn't waste physical memory or relocate itself...
Definition: dynarray.h:39
virtual const wchar_t * get_name() const
name of codec for debug purposes.
Definition: tex_codec.h:156
Status tex_codec_for_filename(const OsPath &extension, const ITexCodec **c)
Find codec that recognizes the desired output file extension.
Definition: tex_codec.cpp:50
virtual const wchar_t * get_name() const =0
name of codec for debug purposes.
virtual bool is_ext(const OsPath &extension) const =0
is the extension that of a file format supported by this codec?
Definition: tex_codec.h:148
uint8_t u8
Definition: types.h:37
Definition: tex_codec.h:162
virtual size_t hdr_size(const u8 *file) const =0
return size of the file header supported by this codec.
i64 Status
Error handling system.
Definition: status.h:169
virtual const wchar_t * get_name() const
name of codec for debug purposes.
Definition: tex_codec.h:170
Definition: tex_codec.h:134
Definition: tex_codec.h:120
const char * extension
Definition: mongoose.cpp:1741
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.
Definition: tex_codec.cpp:142
#define RESTRICT
Definition: code_annotation.h:332
virtual bool is_hdr(const u8 *file) const =0
indicate if the data appears to be an instance of this codec's header, i.e.
Status tex_codec_for_header(const u8 *data, size_t data_size, const ITexCodec **c)
find codec that recognizes the header's magic field.
Definition: tex_codec.cpp:66
virtual method table for TexCodecs.
Definition: tex_codec.h:39
std::vector< RowPtr > tex_codec_alloc_rows(const u8 *data, size_t h, size_t pitch, size_t src_flags, size_t dst_orientation)
Definition: tex_codec.cpp:120
virtual const wchar_t * get_name() const
name of codec for debug purposes.
Definition: tex_codec.h:128
const u8 * RowPtr
allocate an array of row pointers that point into the given texture data.
Definition: tex_codec.h:229
virtual ~ITexCodec()
Definition: tex_codec.h:117
virtual Status decode(u8 *data, size_t size, Tex *RESTRICT t) const =0
decode the file into a Tex structure.
virtual const wchar_t * get_name() const
name of codec for debug purposes.
Definition: tex_codec.h:142
virtual Status encode(Tex *RESTRICT t, DynArray *RESTRICT da) const =0
encode the texture data into the codec's file format (in memory).