![]() |
V-Gears 0
Free Final Fantasy VII engine.
|
#include <TexFile.h>
Public Member Functions | |
TexFile (File file) | |
Constructor. More... | |
TexFile (std::string path) | |
Constructor. More... | |
~TexFile () | |
Destructor. More... | |
void | SavePng (std::string file_name, unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int palette=0) |
Saves a fragment of the TEX file as a PNG file. More... | |
void | SavePng (std::string file_name, unsigned int palette=0) |
Saves the TEX file as a PNG file. More... | |
void | SavePng (std::string file_name, unsigned int x1, unsigned int x2, unsigned int y1, unsigned int y2, unsigned int w1, unsigned int w2, unsigned int h, unsigned int palette=0) |
Saves two fragments of the TEX file as a single PNG image. More... | |
Private Member Functions | |
void | Read (File file) |
Reads data from a file. More... | |
Private Attributes | |
u32 | version_ |
File format version. More... | |
u32 | unknown_0_ |
Unknown data. More... | |
u32 | colour_key_ |
Color key flag. More... | |
u32 | unknown_1_ |
Unknown data. More... | |
u32 | unknown_2_ |
Unknown data. More... | |
u32 | min_bpc_ |
Minimum bits per color. More... | |
u32 | max_bpc_ |
Maximum bits per color. More... | |
u32 | min_alpha_bits_ |
Minimum alpha bits. More... | |
u32 | max_alpha_bits_ |
Minimum alpha bits. More... | |
u32 | min_bpp_ |
Minimum bits per pixel. More... | |
u32 | max_bpp_ |
Maximum bits per pixel. More... | |
u32 | unknown_3_ |
Unknown data. More... | |
u32 | palette_count_ |
Number of colour palettes. More... | |
u32 | palette_colour_count_ |
Number of colours per palette. More... | |
u32 | bit_depth_ |
Bit depth. More... | |
u32 | width_ |
Image width. More... | |
u32 | height_ |
Image height. More... | |
u32 | pitch_ |
Pitch or bytes per row. More... | |
u32 | unknown_4_ |
Unknown data. More... | |
u32 | has_palette_ |
Indicates a paletted image. More... | |
u32 | bits_per_index_ |
Bits per index. More... | |
u32 | indexed_to_8_bit_ |
Indexed to 8 bit flag. More... | |
u32 | palette_size_ |
Palette size. More... | |
u32 | colours_per_palette_ |
Number of colours per palette. More... | |
u32 | run_0_ |
Runtime data. More... | |
u32 | bits_per_pixel_ |
Bits per pixel. More... | |
u32 | bytes_per_pixel_ |
Bytes per pixel. More... | |
u32 | bits_red_ |
Number of red bits. More... | |
u32 | bits_green_ |
Number of green bits. More... | |
u32 | bits_blue_ |
Number of blue bits. More... | |
u32 | bits_alpha_ |
Number of alpha bits. More... | |
u32 | bitmask_red_ |
Red shift. More... | |
u32 | bitmask_green_ |
Green bitmask. More... | |
u32 | bitmask_blue_ |
Blue bitmask. More... | |
u32 | bitmask_alpha_ |
Alpha bitmask. More... | |
u32 | shift_red_ |
Red shift. More... | |
u32 | shift_green_ |
Green shift. More... | |
u32 | shift_blue_ |
Blue shift. More... | |
u32 | shift_alpha_ |
Alpha shift. More... | |
u32 | bits_red_2_ |
Red bits. More... | |
u32 | bits_green_2_ |
Green bits. More... | |
u32 | bits_blue_2_ |
Blue bits. More... | |
u32 | bits_alpha_2_ |
Alpha bits. More... | |
u32 | max_red_ |
Max value for red colour. More... | |
u32 | max_green_ |
Max value for green colour. More... | |
u32 | max_blue_ |
Max value for blue colour. More... | |
u32 | max_alpha_ |
Max alpha value. More... | |
u32 | colour_k_array_ |
Colour key array flag. More... | |
u32 | run_1_ |
Runtime data. More... | |
u32 | ref_alpha_ |
Alpha reference value. More... | |
u32 | run_2_ |
Runtime data. More... | |
u32 | unknown_5_ |
Unknown data. More... | |
u32 | palette_index_ |
Palette index. More... | |
u32 | run_3_ |
Runtime data. More... | |
u32 | run_4_ |
Runtime data. More... | |
u32 | unknown_6_ |
Unknown data. More... | |
u32 | unknown_7_ |
Unknown data. More... | |
u32 | unknown_8_ |
Unknown data. More... | |
u32 | unknown_9_ |
Unknown data. More... | |
std::vector< std::vector< Ogre::ColourValue > > | palettes_ |
Palette data. More... | |
std::vector< Ogre::ColourValue > | pixel_colour_ |
Pixel data for non paletted images. More... | |
std::vector< u8 > | pixel_ref_ |
Pixel data for paletted images. More... | |
std::vector< u8 > | colour_key_array_ |
Colour key array. More... | |
TexFile::TexFile | ( | File | file | ) |
Constructor.
[in,out] | file | File with the tex data. The file data will not be modified, but it's offset will. |
TexFile::TexFile | ( | std::string | path | ) |
Constructor.
[in] | path | Path to the tex file. |
TexFile::~TexFile | ( | ) |
Destructor.
|
private |
Reads data from a file.
Called from constructors.
[in] | file | The file to read from. |
void TexFile::SavePng | ( | std::string | file_name, |
unsigned int | palette = 0 |
||
) |
Saves the TEX file as a PNG file.
[in] | file_name | Full path of the destination file. |
[in] | palette | Index of the color palette to use. For non paletted files it's ignored. |
void TexFile::SavePng | ( | std::string | file_name, |
unsigned int | x, | ||
unsigned int | y, | ||
unsigned int | w, | ||
unsigned int | h, | ||
unsigned int | palette = 0 |
||
) |
Saves a fragment of the TEX file as a PNG file.
[in] | file_name | Full path of the destination file. |
[in] | x | X coordinate of the image to extract from the TEX file. |
[in] | y | Y coordinate of the image to extract from the TEX file. |
[in] | w | Width of the image to extract from the TEX file. |
[in] | h | Height of the image to extract from the TEX file. |
[in] | palette | Index of the color palette to use. For non paletted files it's ignored. |
void TexFile::SavePng | ( | std::string | file_name, |
unsigned int | x1, | ||
unsigned int | x2, | ||
unsigned int | y1, | ||
unsigned int | y2, | ||
unsigned int | w1, | ||
unsigned int | w2, | ||
unsigned int | h, | ||
unsigned int | palette = 0 |
||
) |
Saves two fragments of the TEX file as a single PNG image.
The second fragment will be at the right of the first one. They must have the same height.
[in] | file_name | Full path of the destination file. |
[in] | x1 | X coordinate of the first image to extract from the TEX file. |
[in] | x2 | X coordinate of the second image to extract from the TEX file. |
[in] | y1 | Y coordinate of the first image to extract from the TEX file. |
[in] | y2 | Y coordinate of the first image to extract from the TEX file. |
[in] | w1 | Width of the first image to extract from the TEX file. |
[in] | w2 | Width of the second image to extract from the TEX file. |
[in] | h | Height of the images to extract from the TEX file. |
[in] | palette | Index of the color palette to use. For non paletted files it's ignored. |
|
private |
Bit depth.
4 Bytes.
Can be ignores, always follow {
|
private |
Alpha bitmask.
4 bytes.
|
private |
Blue bitmask.
4 bytes.
|
private |
Green bitmask.
4 bytes.
|
private |
Red shift.
4 bytes.
|
private |
Number of alpha bits.
|
private |
Alpha bits.
Always 8. 4 bytes.
Unused, use {
|
private |
Number of blue bits.
|
private |
Blue bits.
Always 8. 4 bytes.
Unused, use {
|
private |
Number of green bits.
|
private |
Green bits.
Always 8. 4 bytes.
Unused, use {
|
private |
Bits per index.
4 bytes.
For paletted images only. 0 for non-paletted.
|
private |
Bits per pixel.
|
private |
Number of red bits.
|
private |
Red bits.
Always 8. 4 bytes.
Unused, use {
|
private |
Bytes per pixel.
|
private |
Colour key array flag.
4 bytes.
Indicates the presence of a color key array,
|
private |
Color key flag.
4 bytes.
|
private |
Colour key array.
{
|
private |
Number of colours per palette.
4 bytes.
Ignore, use {
|
private |
Indicates a paletted image.
4 bytes.
|
private |
Image height.
4 bytes
|
private |
Indexed to 8 bit flag.
Ignored by OG and V-Gears.
|
private |
Max alpha value.
4 bytes.
|
private |
Minimum alpha bits.
4 bytes.
Ignored by V-Gears.
|
private |
Max value for blue colour.
4 bytes.
|
private |
Maximum bits per color.
4 bytes.
Ignored by V-Geas.
|
private |
Maximum bits per pixel.
4 bytes.
Ignored by V-Gears.
|
private |
Max value for green colour.
4 bytes.
|
private |
Max value for red colour.
4 bytes.
|
private |
Minimum alpha bits.
4 bytes.
Ignored by V-Gears.
|
private |
Minimum bits per color.
4 bytes.
Ignored by V-Geas.
|
private |
Minimum bits per pixel.
4 bytes.
Ignored by V-Gears.
|
private |
Number of colours per palette.
4 bytes.
|
private |
Number of colour palettes.
4 bytes.
|
private |
Palette index.
4 bytes.
Runtime data.
|
private |
Palette size.
4 bytes.
It must match {
|
private |
Palette data.
4 * {
Used only for paletted images. Blocks of 32-bit BGRA colour format.
|
private |
Pitch or bytes per row.
4 bytes.
Ignored, use {
|
private |
Pixel data for non paletted images.
{
|
private |
Pixel data for paletted images.
{
In paletted images, every byte is a color reference in the palette. For non-paletted images, a pixel format section.
|
private |
Alpha reference value.
4 bytes.
Only applies to paltted images, if the alpha value sampled from the palee is 0xFE, this value should be replaced with the reference alpha.
|
private |
Runtime data.
V-gears ignores it.
|
private |
Runtime data.
4 bytes.
V-Gears ignores it.
|
private |
Runtime data.
4 bytes.
V-Gears ignores it.
|
private |
Runtime data.
4 bytes.
V-Gears ignores it.
|
private |
Runtime data.
4 bytes.
V-Gears ignores it.
|
private |
Alpha shift.
4 bytes.
|
private |
Blue shift.
4 bytes.
|
private |
Green shift.
4 bytes.
|
private |
Red shift.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Unknown data.
4 bytes.
|
private |
Image width.
4 bytes