# png::basic_pixel_buffer< pixel, row, traits > Class Template Reference

The basic class template to represent image pixel data. More...

`#include <pixel_buffer.hpp>`

List of all members.

## Public Types

typedef row | row_type
| A row of pixel data.
typedef traits | row_traits

## Public Member Functions

| basic_pixel_buffer ()
| Constructs an empty 0x0 pixel buffer object.
| basic_pixel_buffer (size_t width, size_t height)
| Constructs an empty pixel buffer object.
size_t | get_width () const
size_t | get_height () const
void | resize (size_t width, size_t height)
| Resizes the pixel buffer.
row_type & | get_row (size_t index)
| Returns a reference to the row of image data at specified index.
row_type const & | get_row (size_t index) const
| Returns a const reference to the row of image data at specified index.
row_type & | operator[] (size_t index)
| The non-checking version of get_row() method.
row_type const & | operator[] (size_t index) const
| The non-checking version of get_row() method.
void | put_row (size_t index, row_type const &r)
| Replaces the row at specified index.
pixel | get_pixel (size_t x, size_t y) const
| Returns a pixel at (x,y) position.
void | set_pixel (size_t x, size_t y, pixel p)
| Replaces a pixel at (x,y) position.

## Protected Types

typedef std::vector< row_type > | row_vec

## Protected Attributes

size_t | m_width
size_t | m_height
row_vec | m_rows

## Detailed Description

### template<typename pixel, typename row, class traits = row_traits< row >>
class png::basic_pixel_buffer< pixel, row, traits >

The basic class template to represent image pixel data.

## Member Typedef Documentation

template<typename pixel, typename row, class traits = row_traits< row >>

typedef row png::basic_pixel_buffer< pixel, row, traits >::row_type

A row of pixel data.

template<typename pixel, typename row, class traits = row_traits< row >>

typedef traits png::basic_pixel_buffer< pixel, row, traits >::row_traits

template<typename pixel, typename row, class traits = row_traits< row >>

typedef std::vector< row_type > png::basic_pixel_buffer< pixel, row, traits >::row_vec`[protected]`

## Constructor & Destructor Documentation

template<typename pixel, typename row, class traits = row_traits< row >>

png::basic_pixel_buffer< pixel, row, traits >::basic_pixel_buffer | ( | ) | `[inline]`

Constructs an empty 0x0 pixel buffer object.

template<typename pixel, typename row, class traits = row_traits< row >>

png::basic_pixel_buffer< pixel, row, traits >::basic_pixel_buffer | ( | size_t | width,
|  | size_t | height
| ) |  | `[inline]`

Constructs an empty pixel buffer object.

## Member Function Documentation

template<typename pixel, typename row, class traits = row_traits< row >>

size_t png::basic_pixel_buffer< pixel, row, traits >::get_width | ( | ) | const`[inline]`

Referenced by png::image< pixel >::get_width().

template<typename pixel, typename row, class traits = row_traits< row >>

size_t png::basic_pixel_buffer< pixel, row, traits >::get_height | ( | ) | const`[inline]`

Referenced by png::image< pixel >::get_height().

template<typename pixel, typename row, class traits = row_traits< row >>

void png::basic_pixel_buffer< pixel, row, traits >::resize | ( | size_t | width,
|  | size_t | height
| ) |  | `[inline]`

Resizes the pixel buffer.

If new width or height is greater than the original, expanded pixels are filled with value of pixel().

Referenced by png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::basic_pixel_buffer(), png::image< pixel >::pixel_consumer::reset(), and png::image< pixel >::resize().

template<typename pixel, typename row, class traits = row_traits< row >>

row_type& png::basic_pixel_buffer< pixel, row, traits >::get_row | ( | size_t | index ) | `[inline]`

Returns a reference to the row of image data at specified index.

Checks the index before returning a row: an instance of std::out_of_range is thrown if `index` is greater than `height`.

Referenced by png::image< pixel >::streaming_impl< generator< pixel, pixel_generator, image_info_ref_holder, true > >::get_next_row(), png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::get_pixel(), png::image< pixel >::get_row(), and png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::set_pixel().

template<typename pixel, typename row, class traits = row_traits< row >>

row_type const& png::basic_pixel_buffer< pixel, row, traits >::get_row | ( | size_t | index ) | const`[inline]`

Returns a const reference to the row of image data at specified index.

The checking version.

template<typename pixel, typename row, class traits = row_traits< row >>

row_type& png::basic_pixel_buffer< pixel, row, traits >::operator[] | ( | size_t | index ) | `[inline]`

The non-checking version of get_row() method.

template<typename pixel, typename row, class traits = row_traits< row >>

row_type const& png::basic_pixel_buffer< pixel, row, traits >::operator[] | ( | size_t | index ) | const`[inline]`

The non-checking version of get_row() method.

template<typename pixel, typename row, class traits = row_traits< row >>

void png::basic_pixel_buffer< pixel, row, traits >::put_row | ( | size_t | index,
|  | row_type const & | r
| ) |  | `[inline]`

Replaces the row at specified index.

template<typename pixel, typename row, class traits = row_traits< row >>

pixel png::basic_pixel_buffer< pixel, row, traits >::get_pixel | ( | size_t | x,
|  | size_t | y
| ) |  | const`[inline]`

Returns a pixel at (x,y) position.

Referenced by png::image< pixel >::get_pixel().

template<typename pixel, typename row, class traits = row_traits< row >>

void png::basic_pixel_buffer< pixel, row, traits >::set_pixel | ( | size_t | x,
|  | size_t | y,
|  | pixel | p
| ) |  | `[inline]`

Replaces a pixel at (x,y) position.

Referenced by png::image< pixel >::set_pixel().

## Member Data Documentation

template<typename pixel, typename row, class traits = row_traits< row >>

size_t png::basic_pixel_buffer< pixel, row, traits >::m_width`[protected]`

Referenced by png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::get_width(), png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::put_row(), and png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::resize().

template<typename pixel, typename row, class traits = row_traits< row >>

size_t png::basic_pixel_buffer< pixel, row, traits >::m_height`[protected]`

Referenced by png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::get_height(), and png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::resize().

template<typename pixel, typename row, class traits = row_traits< row >>

row_vec png::basic_pixel_buffer< pixel, row, traits >::m_rows`[protected]`

Referenced by png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::get_row(), png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::operator[](), png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::put_row(), and png::basic_pixel_buffer< packed_index_pixel< bits >, packed_pixel_row< packed_index_pixel< bits > > >::resize().

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

- pixel_buffer.hpp