png::reader< istream > Class Template Reference

The PNG reader class template. This is the low-level reading interface–use image class or consumer class to actually read images. More...

`#include <reader.hpp>`

Inheritance diagram for png::reader< istream >:

## Public Member Functions

| reader (istream &stream)
| Constructs a reader prepared to read PNG image from a stream. More...
| ~reader ()
void | read_png ()
| Reads the whole PNG data stream into memory. Not particularly useful. More...
void | read_info ()
| Reads info about PNG image. More...
void | read_row (byte *bytes)
| Reads a row of image data at a time. More...
void | read_end_info ()
| Reads ending info about PNG image. More...
void | update_info ()
Public Member Functions inherited from png::io_base
| io_base (png_struct *png)
| ~io_base ()
png_struct * | get_png_struct () const
info & | get_info ()
info const & | get_info () const
image_info const & | get_image_info () const
void | set_image_info (image_info const &info)
end_info & | get_end_info ()
end_info const & | get_end_info () const
uint_32 | get_width () const
void | set_width (uint_32 width)
uint_32 | get_height () const
void | set_height (uint_32 height)
color_type | get_color_type () const
void | set_color_type (color_type color_space)
int | get_bit_depth () const
void | set_bit_depth (int bit_depth)
interlace_type | get_interlace_type () const
void | set_interlace_type (interlace_type interlace)
compression_type | get_compression_type () const
void | set_compression_type (compression_type compression)
filter_type | get_filter_type () const
void | set_filter_type (filter_type filter)
bool | has_chunk (chunk id)
void | set_gray_1_2_4_to_8 () const
void | set_palette_to_rgb () const
void | set_tRNS_to_alpha () const
void | set_bgr () const
void | set_gray_to_rgb () const
void | set_rgb_to_gray (rgb_to_gray_error_action error_action=rgb_to_gray_silent, double red_weight=-1.0, double green_weight=-1.0) const
void | set_rgb_to_gray (rgb_to_gray_error_action error_action=rgb_to_gray_silent, fixed_point red_weight=-1, fixed_point green_weight=-1) const
void | set_strip_alpha () const
void | set_swap_alpha () const
void | set_invert_alpha () const
void | set_filler (uint_32 filler, filler_type type) const
void | set_add_alpha (uint_32 filler, filler_type type) const
void | set_swap () const
void | set_packing () const
void | set_packswap () const
void | set_shift (byte red_bits, byte green_bits, byte blue_bits, byte alpha_bits=0) const
void | set_shift (byte gray_bits, byte alpha_bits=0) const
int | set_interlace_handling () const
void | set_invert_mono () const
void | set_strip_16 () const
void | set_read_user_transform (png_user_transform_ptr transform_fn)
void | set_user_transform_info (void *info, int bit_depth, int channels)

## Additional Inherited Members

Protected Member Functions inherited from png::io_base
void * | get_io_ptr () const
void | set_error (char const *message)
void | reset_error ()
bool | is_error () const
void | raise_error ()
Static Protected Member Functions inherited from png::io_base
static void | raise_error (png_struct *png, char const *message)
Protected Attributes inherited from png::io_base
png_struct * | m_png
info | m_info
end_info | m_end_info
std::string | m_error

## Detailed Description

### template<class istream>
class png::reader< istream >

The PNG reader class template. This is the low-level reading interface–use image class or consumer class to actually read images.

The `istream` template parameter specifies the type of input stream to work with. The `istream` class should implement the minimum of the following interface:

class my_istream
{
public:
void read(char*, size_t);
bool good();
};

With the semantics similar to the `std::istream`. Naturally, `std::istream` fits this requirement and can be used with the reader class as is.

See also
  image, consumer, writer, io_base

## Constructor & Destructor Documentation

## reader()

template<class istream>

png::reader< istream >::reader | ( | istream & | stream | ) |

inline explicit

Constructs a reader prepared to read PNG image from a stream.

References png::io_base::m_png.

## ~reader()

template<class istream>

png::reader< istream >::~reader | ( |  | ) |

inline

References png::info_base::get_png_info_ptr(), png::io_base::m_end_info, png::io_base::m_info, and png::io_base::m_png.

## Member Function Documentation

## read_png()

template<class istream>

void png::reader< istream >::read_png | ( |  | ) |

inline

Reads the whole PNG data stream into memory. Not particularly useful.

References png::info_base::get_png_info(), png::io_base::m_error, png::io_base::m_info, and png::io_base::m_png.

## read_info()

template<class istream>

void png::reader< istream >::read_info | ( |  | ) |

inline

Reads info about PNG image.

References png::io_base::m_error, png::io_base::m_info, png::io_base::m_png, and png::info::read().

Referenced by png::consumer< pixel, pixel_consumer, image_info_ref_holder, true >::read().

## read_row()

template<class istream>

void png::reader< istream >::read_row | ( | byte * | bytes | ) |

inline

Reads a row of image data at a time.

References png::io_base::m_error, and png::io_base::m_png.

Referenced by png::consumer< pixel, pixel_consumer, image_info_ref_holder, true >::consumer().

## read_end_info()

template<class istream>

void png::reader< istream >::read_end_info | ( |  | ) |

inline

Reads ending info about PNG image.

References png::io_base::m_end_info, png::io_base::m_error, png::io_base::m_png, and png::end_info::read().

Referenced by png::consumer< pixel, pixel_consumer, image_info_ref_holder, true >::read().

## update_info()

template<class istream>

void png::reader< istream >::update_info | ( |  | ) |

inline

References png::io_base::is_error(), png::io_base::m_info, png::io_base::raise_error(), png::io_base::reset_error(), png::io_base::set_error(), and png::info::update().

Referenced by png::consumer< pixel, pixel_consumer, image_info_ref_holder, true >::read().

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

- reader.hpp