31#ifndef PNGPP_CONSUMER_HPP_INCLUDED 
   32#define PNGPP_CONSUMER_HPP_INCLUDED 
  121    template< 
typename pixel,
 
  123              class info_holder = def_image_info_holder,
 
  124              bool interlacing_supported = 
false >
 
  143        template< 
typename istream >
 
  157        template< 
typename istream, 
class transformation >
 
  158        void read(istream& stream, transformation 
const& transform)
 
  164#if __BYTE_ORDER == __LITTLE_ENDIAN 
  167#ifdef PNG_READ_SWAP_SUPPORTED 
  170                throw error(
"Cannot read 16-bit image: recompile with PNG_READ_SWAP_SUPPORTED.");
 
  179#ifdef PNG_READ_INTERLACING_SUPPORTED 
  182                throw error(
"Cannot read interlaced image: interlace handling disabled.");
 
  194                throw std::logic_error(
"color type and/or bit depth mismatch" 
  195                                       " in png::consumer::read()");
 
  200            pixcon* pixel_con = 
static_cast< pixcon* 
>(
this);
 
  201            if (pass_count > 1 && !interlacing_supported)
 
  203                skip_interlaced_rows(rd, pass_count);
 
  206            read_rows(rd, pass_count, pixel_con);
 
 
  224        template< 
typename istream >
 
  227            typedef std::vector< pixel > row;
 
  229            row dummy_row(this->
get_info().get_width());
 
  230            for (
size_t pass = 1; pass < pass_count; ++pass)
 
  232                rd.
read_row(
reinterpret_cast< byte* 
> 
  233                            (row_traits_type::get_data(dummy_row)));
 
  237        template< 
typename istream >
 
  238        void read_rows(reader< istream >& rd, 
size_t pass_count,
 
  241            for (
size_t pass = 0; pass < pass_count; ++pass)
 
  243                pixel_con->reset(pass);
 
  247                    rd.read_row(pixel_con->get_next_row(pos));
 
 
Pixel consumer class template.
Definition consumer.hpp:127
void read(istream &stream, transformation const &transform)
Reads an image from the stream using custom io transformation.
Definition consumer.hpp:158
consumer(image_info &info)
Constructs a consumer object using passed image_info object to store image information.
Definition consumer.hpp:218
void read(istream &stream)
Reads an image from the stream using default io transformation.
Definition consumer.hpp:144
pixel_traits< pixel > traits
Definition consumer.hpp:129
streaming_base< pixel, info_holder > base
Definition consumer.hpp:212
Exception class to represent runtime errors related to png++ operation.
Definition error.hpp:59
Holds information about PNG image.
Definition image_info.hpp:48
uint_32 get_height() const
Definition image_info.hpp:77
Holds information about PNG image. Adapter class for IO image operations.
Definition info.hpp:48
Base class for PNG reader/writer classes.
Definition io_base.hpp:63
int set_interlace_handling() const
Definition io_base.hpp:376
int get_bit_depth() const
Definition io_base.hpp:150
image_info const & get_image_info() const
Definition io_base.hpp:97
color_type get_color_type() const
Definition io_base.hpp:140
void set_swap() const
Definition io_base.hpp:312
interlace_type get_interlace_type() const
Definition io_base.hpp:160
The PNG reader class template. This is the low-level reading interface–use image class or consumer cl...
Definition reader.hpp:67
void read_row(byte *bytes)
Reads a row of image data at a time.
Definition reader.hpp:120
void read_end_info()
Reads ending info about PNG image.
Definition reader.hpp:132
void read_info()
Reads info about PNG image.
Definition reader.hpp:108
void update_info()
Definition reader.hpp:141
The pixel row traits class template. Provides a common way to get starting address of the row for pac...
Definition pixel_buffer.hpp:53
A base class template for consumer and generator classes. Provides default reset() method implementat...
Definition streaming_base.hpp:91
image_info const & get_info() const
Definition streaming_base.hpp:107
@ interlace_none
Definition types.hpp:81
png_uint_32 uint_32
Definition types.hpp:41
Pixel traits class template.
Definition pixel_traits.hpp:48