Gorgon Game Engine
PNG Class Reference

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...
 

Detailed Description

Encodes or decodes PNG compression.

Member Function Documentation

◆ Decode() [1/4]

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.

Exceptions
runtime_errorin case of a read error

References PNG::decode().

◆ Decode() [2/4]

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.

Exceptions
runtime_errorin case of a read error

References PNG::decode().

◆ decode()

◆ Decode() [3/4]

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.

Exceptions
runtime_errorin case of a read error

References PNG::decode().

◆ Decode() [4/4]

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.

Exceptions
runtime_errorin case of a read error

References PNG::decode().

◆ Encode() [1/3]

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

Exceptions
runtime_errorin case of an encoding error

References PNG::encode().

◆ encode()

◆ Encode() [2/3]

void Encode ( const Containers::Image input,
std::ostream &  output,
bool  replace_colormode = false 
)

Encodes a given input.

This variant writes to a stream

Warning
Array write buffer should either be a nullptr of type Byte or an array allocated with malloc. This system uses realloc or malloc to resize raw arrays.
Exceptions
runtime_errorin case of an encoding error

References PNG::encode().

◆ Encode() [3/3]

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.

Warning
Array write buffer should either be a nullptr of type Byte or an array allocated with malloc. This system uses realloc or malloc to resize raw arrays.
Exceptions
runtime_errorin case of an encoding error

References PNG::encode().


The documentation for this class was generated from the following files: