#include <tex_codec.h>
decode the file into a Tex structure.
- Parameters
-
data | input data array (non-const, because the texture may have to be flipped in-place - see "texture orientation"). |
size | [bytes] of data, always >= 4 (this is usually enough to compare the header's "magic" field, and no legitimate file will be smaller) |
t | output texture object |
- Returns
- Status
Implements ITexCodec.
encode the texture data into the codec's file format (in memory).
- Parameters
-
t | input texture object. note: non-const because encoding may require a Tex::transform. |
da | output data array, allocated by codec. rationale: some codecs cannot calculate the output size beforehand (e.g. PNG output via libpng), so the output memory cannot be allocated by the caller. |
- Returns
- Status
Implements ITexCodec.
virtual const wchar_t* TexCodecPng::get_name |
( |
| ) |
const |
|
inlinevirtual |
name of codec for debug purposes.
typically set via TEX_CODEC_REGISTER.
Implements ITexCodec.
size_t TexCodecPng::hdr_size |
( |
const u8 * |
file | ) |
const |
|
virtual |
return size of the file header supported by this codec.
- Parameters
-
file | the specific header to return length of (taking its variable-length fields into account). if NULL, return minimum guaranteed header size, i.e. the header without any variable-length fields. |
- Returns
- size [bytes]
Implements ITexCodec.
bool TexCodecPng::is_ext |
( |
const OsPath & |
extension | ) |
const |
|
virtual |
is the extension that of a file format supported by this codec?
rationale: cannot just return the extension string and have caller compare it (-> smaller code) because a codec's file format may have several valid extensions (e.g. jpg and jpeg).
- Parameters
-
- Returns
- bool
Implements ITexCodec.
bool TexCodecPng::is_hdr |
( |
const u8 * |
file | ) |
const |
|
virtual |
indicate if the data appears to be an instance of this codec's header, i.e.
can this codec decode it?
- Parameters
-
file | input data; only guaranteed to be 4 bytes! (this should be enough to examine the header's 'magic' field) |
- Returns
- bool
Implements ITexCodec.
Status TexCodecPng::transform |
( |
Tex * |
t, |
|
|
size_t |
transforms |
|
) |
| const |
|
virtual |
transform the texture's pixel format.
- Parameters
-
t | texture object |
transforms | OR-ed combination of TEX_* flags that are to be changed. note: the codec needs only handle situations specific to its format; generic pixel format transforms are handled by the caller. |
Implements ITexCodec.
The documentation for this class was generated from the following files: