31 #ifndef PNGPP_GENERATOR_HPP_INCLUDED 32 #define PNGPP_GENERATOR_HPP_INCLUDED 112 template<
typename pixel,
114 class info_holder = def_image_info_holder,
115 bool interlacing_supported =
false >
128 template<
typename ostream >
135 #if __BYTE_ORDER == __LITTLE_ENDIAN 138 #ifdef PNG_WRITE_SWAP_SUPPORTED 141 throw error(
"Cannot write 16-bit image: recompile with PNG_WRITE_SWAP_SUPPORTED.");
149 #ifdef PNG_WRITE_INTERLACING_SUPPORTED 150 if (interlacing_supported)
156 throw std::logic_error(
"Cannot write interlaced image: generator does not support it.");
159 throw error(
"Cannot write interlaced image: interlace handling disabled.");
166 pixgen* pixel_gen =
static_cast< pixgen*
>(
this);
167 for (
size_t pass = 0; pass < pass_count; ++pass)
169 pixel_gen->reset(pass);
173 wr.
write_row(pixel_gen->get_next_row(pos));
197 : base(width, height)
204 #endif // PNGPP_GENERATOR_HPP_INCLUDED
void write(ostream &stream)
Writes an image to the stream.
Definition: generator.hpp:129
generator(image_info &info)
Constructs a generator object using passed image_info object to store image information.
Definition: generator.hpp:187
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 set_image_info(image_info const &info)
Definition: io_base.hpp:102
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
int set_interlace_handling() const
Definition: io_base.hpp:376
void write_end_info() const
Reads ending info about PNG image.
Definition: writer.hpp:128
PNG writer class template. This is the low-level writing interface–use image class or generator clas...
Definition: writer.hpp:66
void write_info() const
Write info about PNG image.
Definition: writer.hpp:104
generator(size_t width, size_t height)
Constructs a generator object prepared to generate an image of specified width and height...
Definition: generator.hpp:196
Holds information about PNG image. Adapter class for IO image operations.
Definition: info.hpp:45
streaming_base< pixel, info_holder > base
Definition: generator.hpp:181
Exception class to represent runtime errors related to png++ operation.
Definition: error.hpp:57
Pixel generator class template.
Definition: generator.hpp:116
void write_row(byte *bytes)
Writes a row of image data at a time.
Definition: writer.hpp:116
void set_swap() const
Definition: io_base.hpp:312