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 >
146 read(stream, transform_identity());
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 >
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));
255 #endif // PNGPP_CONSUMER_HPP_INCLUDED int get_bit_depth() const
Definition: io_base.hpp:150
The pixel row traits class template. Provides a common way to get starting address of the row for pac...
Definition: pixel_buffer.hpp:53
Base class for PNG reader/writer classes.
Definition: io_base.hpp:62
void read_info()
Reads info about PNG image.
Definition: reader.hpp:108
pixel_traits< pixel > traits
Definition: consumer.hpp:129
color_type get_color_type() const
Definition: io_base.hpp:140
The PNG reader class template. This is the low-level reading interface–use image class or consumer c...
Definition: reader.hpp:65
Pixel traits class template.
Definition: pixel_traits.hpp:48
image_info const & get_info() const
Definition: streaming_base.hpp:107
uint_32 get_height() const
Definition: image_info.hpp:77
Holds information about PNG image.
Definition: image_info.hpp:47
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
png_uint_32 uint_32
Definition: types.hpp:41
A base class template for consumer and generator classes. Provides default reset() method implementat...
Definition: streaming_base.hpp:90
Pixel consumer class template.
Definition: consumer.hpp:125
void read(istream &stream, transformation const &transform)
Reads an image from the stream using custom io transformation.
Definition: consumer.hpp:158
int set_interlace_handling() const
Definition: io_base.hpp:376
void update_info()
Definition: reader.hpp:141
Holds information about PNG image. Adapter class for IO image operations.
Definition: info.hpp:45
consumer(image_info &info)
Constructs a consumer object using passed image_info object to store image information.
Definition: consumer.hpp:218
image_info const & get_image_info() const
Definition: io_base.hpp:97
interlace_type get_interlace_type() const
Definition: io_base.hpp:160
void read(istream &stream)
Reads an image from the stream using default io transformation.
Definition: consumer.hpp:144
Exception class to represent runtime errors related to png++ operation.
Definition: error.hpp:57
streaming_base< pixel, info_holder > base
Definition: consumer.hpp:212
void set_swap() const
Definition: io_base.hpp:312