libfacade 1.1
A library for manipulating PNG images with payloads.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
facade::png::Header Class Reference

A PNG header object. More...

#include <png.hpp>

Inheritance diagram for facade::png::Header:
facade::png::ChunkVec

Public Member Functions

 Header ()
 
 Header (const void *ptr, std::size_t size)
 
 Header (const std::vector< std::uint8_t > &vec)
 
 Header (std::uint32_t width, std::uint32_t height, std::uint8_t bit_depth, std::uint8_t color_type, std::uint8_t compression_method=0, std::uint8_t filter_method=0, std::uint8_t interlace_method=0)
 
 Header (const Header &other)
 
void set (std::uint32_t width, std::uint32_t height, std::uint8_t bit_depth, std::uint8_t color_type, std::uint8_t compression_method=0, std::uint8_t filter_method=0, std::uint8_t interlace_method=0)
 Set the values of this header all at once.
 
std::uint32_t width () const
 Get the width value of this header.
 
void set_width (std::uint32_t width)
 Set the width value of this header.
 
std::uint32_t height () const
 Get the height value of this header.
 
void set_height (std::uint32_t height)
 Set the height value of this header.
 
std::uint8_t bit_depth () const
 Get the bit depth of this header.
 
void set_bit_depth (std::uint8_t bit_depth)
 Set the bit depth of this header.
 
std::uint8_t color_type () const
 Get the color type of this header.
 
void set_color_type (std::uint8_t color_type)
 Set the color type of this header.
 
std::uint8_t compression_method () const
 Get the compression method of this header.
 
void set_compression_method (std::uint8_t compression_method)
 Set the compression method of this header.
 
std::uint8_t filter_method () const
 Get the filter method of this header.
 
void set_filter_method (std::uint8_t filter_method)
 Set the filter method of this header.
 
std::uint8_t interlace_method () const
 Get the interlace method of this header.
 
void set_interlace_method (std::uint8_t interlace_method)
 Set the filter method of this header.
 
PixelEnum pixel_type () const
 Get the pixel type associated with this PNG image.
 
std::size_t pixel_size () const
 Get the size, in bits, of the current pixel type.
 
std::size_t buffer_size () const
 Return the expected raw pixel data buffer size of the decompressed image data, in bytes.
 
- Public Member Functions inherited from facade::png::ChunkVec
 ChunkVec (const ChunkTag tag)
 
 ChunkVec (const ChunkTag tag, const void *ptr, std::size_t size)
 
 ChunkVec (const ChunkTag tag, const std::vector< std::uint8_t > &data)
 
 ChunkVec (const ChunkVec &other)
 
bool operator== (const ChunkVec &other) const
 
std::size_t length () const
 Return the length of this chunk's data.
 
ChunkTagtag ()
 Return the chunk tag reference associated with this chunk.
 
const ChunkTagtag () const
 Return a const chunk tag reference associated with this chunk.
 
std::vector< std::uint8_t > & data ()
 Return the chunk data reference associated with this chunk.
 
const std::vector< std::uint8_t > & data () const
 Return const chunk data reference associated with this chunk.
 
void set_data (std::vector< std::uint8_t > &data)
 Set the chunk data for this chunk.
 
std::uint32_t crc () const
 Calculate the CRC value of this chunk.
 
std::pair< std::vector< std::uint8_t >, ChunkPtrto_chunk_ptr () const
 Convert this ChunkVec to a facade::png::ChunkPtr.
 
template<typename T >
T & upcast ()
 Create a reference to a higher-level ChunkVec object, such as facade::png::Header.
 
template<typename T >
const T & upcast () const
 Create a const reference to a higher-level ChunkVec object, such as facade::png::Header.
 
ChunkVecas_chunk_vec ()
 Interpret this ChunkVec derivative as a ChunkVec object.
 
const ChunkVecas_chunk_vec () const
 Interpret this ChunkVec derivative as a const ChunkVec object.
 

Detailed Description

A PNG header object.

See also
facade::png::ChunkVec

Constructor & Destructor Documentation

◆ Header() [1/5]

facade::png::Header::Header ( )
inline

◆ Header() [2/5]

facade::png::Header::Header ( const void *  ptr,
std::size_t  size 
)
inline

◆ Header() [3/5]

facade::png::Header::Header ( const std::vector< std::uint8_t > &  vec)
inline

◆ Header() [4/5]

facade::png::Header::Header ( std::uint32_t  width,
std::uint32_t  height,
std::uint8_t  bit_depth,
std::uint8_t  color_type,
std::uint8_t  compression_method = 0,
std::uint8_t  filter_method = 0,
std::uint8_t  interlace_method = 0 
)
inline

◆ Header() [5/5]

facade::png::Header::Header ( const Header other)
inline

Member Function Documentation

◆ bit_depth()

std::uint8_t Header::bit_depth ( ) const

Get the bit depth of this header.

◆ buffer_size()

std::size_t Header::buffer_size ( ) const

Return the expected raw pixel data buffer size of the decompressed image data, in bytes.

◆ color_type()

std::uint8_t Header::color_type ( ) const

Get the color type of this header.

◆ compression_method()

std::uint8_t Header::compression_method ( ) const

Get the compression method of this header.

◆ filter_method()

std::uint8_t Header::filter_method ( ) const

Get the filter method of this header.

◆ height()

std::uint32_t Header::height ( ) const

Get the height value of this header.

◆ interlace_method()

std::uint8_t Header::interlace_method ( ) const

Get the interlace method of this header.

◆ pixel_size()

std::size_t Header::pixel_size ( ) const

Get the size, in bits, of the current pixel type.

Exceptions
facade::exception::InvalidPixelType

◆ pixel_type()

PixelEnum Header::pixel_type ( ) const

Get the pixel type associated with this PNG image.

See also
facade::png::PixelEnum
Exceptions
facade::exception::InvalidBitDepth
facade::exception::InvalidColorType

◆ set()

void Header::set ( std::uint32_t  width,
std::uint32_t  height,
std::uint8_t  bit_depth,
std::uint8_t  color_type,
std::uint8_t  compression_method = 0,
std::uint8_t  filter_method = 0,
std::uint8_t  interlace_method = 0 
)

Set the values of this header all at once.

Parameters
widthSet the width, in pixels, of this PNG image.
heightSet the height, in pixels, of this PNG image.
bit_depthSet the bit depth of the image. Valid values are 1, 2, 4, 8 and 16, depending on color type.
color_typeSet the color type of this image. Use facade::png::ColorType for valid values.
compression_methodSet the compression method. The only valid type is 0.
filter_methodSet the filter method of this PNG image. The only currently supported type is 0.
interlace_methodSet the interlace method of this PNG image. The only currently supported type is 0.
Warning
This interface explicitly allows you to set invalid types! If you set an invalid type, you may encounter exceptions when parsing or creating an image.

◆ set_bit_depth()

void Header::set_bit_depth ( std::uint8_t  bit_depth)

Set the bit depth of this header.

◆ set_color_type()

void Header::set_color_type ( std::uint8_t  color_type)

Set the color type of this header.

◆ set_compression_method()

void Header::set_compression_method ( std::uint8_t  compression_method)

Set the compression method of this header.

◆ set_filter_method()

void Header::set_filter_method ( std::uint8_t  filter_method)

Set the filter method of this header.

◆ set_height()

void Header::set_height ( std::uint32_t  height)

Set the height value of this header.

◆ set_interlace_method()

void Header::set_interlace_method ( std::uint8_t  interlace_method)

Set the filter method of this header.

◆ set_width()

void Header::set_width ( std::uint32_t  width)

Set the width value of this header.

◆ width()

std::uint32_t Header::width ( ) const

Get the width value of this header.


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