![]() |
Gorgon Game Engine
|
Encodes or decodes PNG compression. More...
Public Member Functions | |
void | Decode (const Byte *input, std::size_t size, Containers::Image &output) |
Decodes the given PNG data. More... | |
void | Decode (const std::string &input, Containers::Image &output) |
Decodes the given PNG data. More... | |
void | Decode (std::istream &input, Containers::Image &output) |
Decodes the given PNG data. More... | |
void | Decode (std::vector< Byte > &input, Containers::Image &output) |
Decodes the given PNG data. More... | |
void | Encode (const Containers::Image &input, const std::string &output, bool replace_colormode=false) |
Encodes a given input. More... | |
void | Encode (const Containers::Image &input, std::ostream &output, bool replace_colormode=false) |
Encodes a given input. More... | |
void | Encode (const Containers::Image &input, std::vector< Byte > &output, bool replace_colormode=false) |
Encodes a given input. More... | |
Protected Member Functions | |
void | decode (png::Reader *reader, Containers::Image &output) |
Performs actual decoding. More... | |
void | encode (const Containers::Image &input, png::Writer *write, bool replace_colormode) |
Performs actual encoding. More... | |
Encodes or decodes PNG compression.
void Decode | ( | const Byte * | input, |
std::size_t | size, | ||
Containers::Image & | output | ||
) |
Decodes the given PNG data.
This function may produce an image with the following color modes: Grayscale, Grayscale_Alpha, RGB, RGBA. In this variant data is read from an array.
runtime_error | in case of a read error |
References PNG::decode().
void Decode | ( | const std::string & | input, |
Containers::Image & | output | ||
) |
Decodes the given PNG data.
This function may produce an image with the following color modes: Grayscale, Grayscale_Alpha, RGB, RGBA. This variant opens and reads data from a file.
runtime_error | in case of a read error |
References PNG::decode().
|
protected |
void Decode | ( | std::istream & | input, |
Containers::Image & | output | ||
) |
Decodes the given PNG data.
This function may produce an image with the following color modes: Grayscale, Grayscale_Alpha, RGB, RGBA. This variant reads data from the file.
runtime_error | in case of a read error |
References PNG::decode().
void Decode | ( | std::vector< Byte > & | input, |
Containers::Image & | output | ||
) |
Decodes the given PNG data.
This function may produce an image with the following color modes: Grayscale, Grayscale_Alpha, RGB, RGBA. This variant reads data from the vector.
runtime_error | in case of a read error |
References PNG::decode().
void Encode | ( | const Containers::Image & | input, |
const std::string & | output, | ||
bool | replace_colormode = false |
||
) |
Encodes a given input.
This variant opens the given file and writes on that file
runtime_error | in case of an encoding error |
References PNG::encode().
|
protected |
Performs actual encoding.
References Gorgon::Graphics::Alpha, basic_Image< T_ >::GetChannelsPerPixel(), basic_Image< T_ >::GetMode(), basic_Image< T_ >::GetSize(), basic_Image< T_ >::GetTotalSize(), Gorgon::Graphics::Grayscale, basic_Size< T_ >::Height, Gorgon::Graphics::Invalid, basic_Image< T_ >::RawData(), Gorgon::Graphics::RGB, Gorgon::Graphics::RGBA, and basic_Size< T_ >::Width.
void Encode | ( | const Containers::Image & | input, |
std::ostream & | output, | ||
bool | replace_colormode = false |
||
) |
Encodes a given input.
This variant writes to a stream
runtime_error | in case of an encoding error |
References PNG::encode().
void Encode | ( | const Containers::Image & | input, |
std::vector< Byte > & | output, | ||
bool | replace_colormode = false |
||
) |
Encodes a given input.
This variant writes data to a vector. Vector is resized automatically.
runtime_error | in case of an encoding error |
References PNG::encode().