libpng++  v0.2.5-1
C++ library for PNG images
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
png::writer< ostream > Class Template Reference

PNG writer class template. More...

#include <writer.hpp>

Inheritance diagram for png::writer< ostream >:
Collaboration diagram for png::writer< ostream >:

Public Member Functions

 writer (ostream &stream)
 Constructs a writer prepared to write PNG image into a stream. More...
 
 ~writer ()
 
size_t get_bit_depth () const
 
color_type get_color_type () const
 
compression_type get_compression_type () const
 
end_infoget_end_info ()
 
end_info const & get_end_info () const
 
filter_type get_filter_type () const
 
size_t get_height () const
 
image_info const & get_image_info () const
 
infoget_info ()
 
info const & get_info () const
 
interlace_type get_interlace_type () const
 
png_struct * get_png_struct () const
 
size_t get_width () const
 
bool has_chunk (chunk id)
 
void set_bit_depth (size_t bit_depth)
 
void set_color_type (color_type color_space)
 
void set_compression_type (compression_type compression)
 
void set_filter_type (filter_type filter)
 
void set_height (size_t height)
 
void set_image_info (image_info const &info)
 
void set_interlace_type (interlace_type interlace)
 
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_width (size_t width)
 
void write_end_info () const
 Reads ending info about PNG image. More...
 
void write_info () const
 Write info about PNG image. More...
 
void write_png () const
 
void write_row (byte *bytes)
 Writes a row of image data at a time. More...
 

Protected Member Functions

void * get_io_ptr () const
 
bool is_error () const
 
void raise_error ()
 
void reset_error ()
 
void set_error (char const *message)
 

Static Protected Member Functions

static void raise_error (png_struct *png, char const *message)
 

Protected Attributes

end_info m_end_info
 
std::string m_error
 
info m_info
 
png_struct * m_png
 

Static Private Member Functions

static void flush_data (png_struct *png)
 
static void write_data (png_struct *png, byte *data, size_t length)
 

Detailed Description

template<class ostream>
class png::writer< ostream >

PNG writer class template.

This is the low-level writing interface–use image class or generator class to actually write images.

The ostream template parameter specifies the type of output stream to work with. The ostream class should implement the minimum of the following interface:

class my_ostream
{
public:
void write(char const*, size_t);
void flush();
bool good();
};

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

See Also
image, reader, generator, io_base

Constructor & Destructor Documentation

template<class ostream>
png::writer< ostream >::writer ( ostream &  stream)
inlineexplicit

Constructs a writer prepared to write PNG image into a stream.

References png::writer< ostream >::flush_data(), png::io_base::m_png, and png::writer< ostream >::write_data().

Here is the call graph for this function:

template<class ostream>
png::writer< ostream >::~writer ( )
inline

Member Function Documentation

template<class ostream>
static void png::writer< ostream >::flush_data ( png_struct *  png)
inlinestaticprivate

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

Referenced by png::writer< ostream >::writer().

Here is the call graph for this function:

Here is the caller graph for this function:

compression_type png::io_base::get_compression_type ( ) const
inlineinherited

References png::image_info::get_compression_type(), and png::io_base::m_info.

Here is the call graph for this function:

end_info& png::io_base::get_end_info ( )
inlineinherited
end_info const& png::io_base::get_end_info ( ) const
inlineinherited
filter_type png::io_base::get_filter_type ( ) const
inlineinherited

References png::image_info::get_filter_type(), and png::io_base::m_info.

Here is the call graph for this function:

size_t png::io_base::get_height ( ) const
inlineinherited

References png::image_info::get_height(), and png::io_base::m_info.

Here is the call graph for this function:

image_info const& png::io_base::get_image_info ( ) const
inlineinherited

References png::io_base::m_info.

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

Here is the caller graph for this function:

info& png::io_base::get_info ( )
inlineinherited

References png::io_base::m_info.

Referenced by png::detail::convert_color_space_impl< rgb_pixel >::handle_palette().

Here is the caller graph for this function:

info const& png::io_base::get_info ( ) const
inlineinherited

References png::io_base::m_info.

interlace_type png::io_base::get_interlace_type ( ) const
inlineinherited

References png::image_info::get_interlace_type(), and png::io_base::m_info.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void* png::io_base::get_io_ptr ( ) const
inlineprotectedinherited

References png::io_base::m_png.

png_struct* png::io_base::get_png_struct ( ) const
inlineinherited

References png::io_base::m_png.

size_t png::io_base::get_width ( ) const
inlineinherited

References png::image_info::get_width(), and png::io_base::m_info.

Here is the call graph for this function:

bool png::io_base::has_chunk ( chunk  id)
inlineinherited

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

Referenced by png::detail::convert_color_space_impl< rgb_pixel >::handle_alpha().

Here is the call graph for this function:

Here is the caller graph for this function:

bool png::io_base::is_error ( ) const
inlineprotectedinherited
void png::io_base::raise_error ( )
inlineprotectedinherited
static void png::io_base::raise_error ( png_struct *  png,
char const *  message 
)
inlinestaticprotectedinherited

References png::io_base::raise_error(), and png::io_base::set_error().

Here is the call graph for this function:

void png::io_base::reset_error ( )
inlineprotectedinherited
void png::io_base::set_bit_depth ( size_t  bit_depth)
inlineinherited

References png::io_base::m_info, and png::image_info::set_bit_depth().

Referenced by png::detail::convert_color_space_impl< rgb_pixel >::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

void png::io_base::set_color_type ( color_type  color_space)
inlineinherited

References png::io_base::m_info, and png::image_info::set_color_type().

Referenced by png::detail::convert_color_space_impl< rgb_pixel >::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

void png::io_base::set_compression_type ( compression_type  compression)
inlineinherited

References png::io_base::m_info, and png::image_info::set_compression_type().

Here is the call graph for this function:

void png::io_base::set_error ( char const *  message)
inlineprotectedinherited
void png::io_base::set_filter_type ( filter_type  filter)
inlineinherited

References png::io_base::m_info, and png::image_info::set_filter_type().

Here is the call graph for this function:

void png::io_base::set_height ( size_t  height)
inlineinherited

References png::io_base::m_info, and png::image_info::set_height().

Here is the call graph for this function:

void png::io_base::set_image_info ( image_info const &  info)
inlineinherited

References png::io_base::m_info.

Referenced by png::generator< pixel, pixel_generator, image_info_ref_holder, true >::write().

Here is the caller graph for this function:

void png::io_base::set_interlace_type ( interlace_type  interlace)
inlineinherited

References png::io_base::m_info, and png::image_info::set_interlace_type().

Here is the call graph for this function:

void png::io_base::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
inlineinherited

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

Referenced by png::detail::convert_color_space_impl< rgb_pixel >::handle_rgb().

Here is the caller graph for this function:

void png::io_base::set_width ( size_t  width)
inlineinherited

References png::io_base::m_info, and png::image_info::set_width().

Here is the call graph for this function:

template<class ostream>
static void png::writer< ostream >::write_data ( png_struct *  png,
byte data,
size_t  length 
)
inlinestaticprivate

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

Referenced by png::writer< ostream >::writer().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class ostream>
void png::writer< ostream >::write_end_info ( ) const
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::write().

Referenced by png::generator< pixel, pixel_generator, image_info_ref_holder, true >::write().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class ostream>
void png::writer< ostream >::write_info ( ) const
inline

Write info about PNG image.

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

Referenced by png::generator< pixel, pixel_generator, image_info_ref_holder, true >::write().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class ostream>
void png::writer< ostream >::write_png ( ) const
inline

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

Here is the call graph for this function:

template<class ostream>
void png::writer< ostream >::write_row ( byte bytes)
inline

Writes a row of image data at a time.

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

Referenced by png::generator< pixel, pixel_generator, image_info_ref_holder, true >::write().

Here is the caller graph for this function:

Member Data Documentation


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