png++
0.2.9
|
Pixel buffer, that stores pixels as continuous memory chunk. solid_pixel_buffer is useful when user whats to open png, do some changes and fetch to buffer to draw (as texture for example). More...
#include <solid_pixel_buffer.hpp>
Classes | |
struct | row_traits |
Public Types | |
typedef pixel_traits< pixel > | pixel_traits_t |
typedef row_traits::row_access | row_access |
A row of pixel data. More... | |
typedef row_traits::row_const_access | row_const_access |
typedef row_access | row_type |
Public Member Functions | |
solid_pixel_buffer () | |
Constructs an empty 0x0 pixel buffer object. More... | |
solid_pixel_buffer (uint_32 width, uint_32 height) | |
Constructs an empty pixel buffer object. More... | |
uint_32 | get_width () const |
uint_32 | get_height () const |
void | resize (uint_32 width, uint_32 height) |
Resizes the pixel buffer. More... | |
row_access | get_row (size_t index) |
Returns a reference to the row of image data at specified index. More... | |
row_const_access | get_row (size_t index) const |
Returns a const reference to the row of image data at specified index. More... | |
row_access | operator[] (size_t index) |
The non-checking version of get_row() method. More... | |
row_const_access | operator[] (size_t index) const |
The non-checking version of get_row() method. More... | |
void | put_row (size_t index, row_const_access r) |
Replaces the row at specified index. More... | |
pixel | get_pixel (size_t x, size_t y) const |
Returns a pixel at (x,y) position. More... | |
void | set_pixel (size_t x, size_t y, pixel p) |
Replaces a pixel at (x,y) position. More... | |
const std::vector< byte > & | get_bytes () const |
Provides easy constant read access to underlying byte-buffer. More... | |
std::vector< byte > | fetch_bytes () |
Moves the buffer to client code (c++11 only) . More... | |
Protected Attributes | |
uint_32 | m_width |
uint_32 | m_height |
size_t | m_stride |
std::vector< byte > | m_bytes |
Static Protected Attributes | |
static const size_t | bytes_per_pixel |
Pixel buffer, that stores pixels as continuous memory chunk. solid_pixel_buffer is useful when user whats to open png, do some changes and fetch to buffer to draw (as texture for example).
typedef pixel_traits< pixel > png::solid_pixel_buffer< pixel >::pixel_traits_t |
typedef row_traits::row_access png::solid_pixel_buffer< pixel >::row_access |
A row of pixel data.
typedef row_traits::row_const_access png::solid_pixel_buffer< pixel >::row_const_access |
typedef row_access png::solid_pixel_buffer< pixel >::row_type |
|
inline |
Constructs an empty 0x0 pixel buffer object.
|
inline |
Constructs an empty pixel buffer object.
References png::solid_pixel_buffer< pixel >::resize().
|
inline |
References png::solid_pixel_buffer< pixel >::m_width.
|
inline |
References png::solid_pixel_buffer< pixel >::m_height.
|
inline |
Resizes the pixel buffer.
If new width or height is greater than the original, expanded pixels are filled with value of pixel().
References png::solid_pixel_buffer< pixel >::bytes_per_pixel, png::solid_pixel_buffer< pixel >::m_bytes, png::solid_pixel_buffer< pixel >::m_height, png::solid_pixel_buffer< pixel >::m_stride, and png::solid_pixel_buffer< pixel >::m_width.
Referenced by png::solid_pixel_buffer< pixel >::solid_pixel_buffer().
|
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
.
References png::solid_pixel_buffer< pixel >::m_bytes, and png::solid_pixel_buffer< pixel >::m_stride.
Referenced by png::solid_pixel_buffer< pixel >::put_row().
|
inline |
Returns a const reference to the row of image data at specified index.
The checking version.
References png::solid_pixel_buffer< pixel >::m_bytes, and png::solid_pixel_buffer< pixel >::m_stride.
|
inline |
The non-checking version of get_row() method.
References png::solid_pixel_buffer< pixel >::m_bytes, and png::solid_pixel_buffer< pixel >::m_stride.
|
inline |
The non-checking version of get_row() method.
References png::solid_pixel_buffer< pixel >::m_bytes, and png::solid_pixel_buffer< pixel >::m_stride.
|
inline |
Replaces the row at specified index.
References png::solid_pixel_buffer< pixel >::get_row(), and png::solid_pixel_buffer< pixel >::m_width.
|
inline |
Returns a pixel at (x,y) position.
References png::solid_pixel_buffer< pixel >::bytes_per_pixel, png::solid_pixel_buffer< pixel >::m_bytes, and png::solid_pixel_buffer< pixel >::m_width.
|
inline |
Replaces a pixel at (x,y) position.
References png::solid_pixel_buffer< pixel >::bytes_per_pixel, png::solid_pixel_buffer< pixel >::m_bytes, and png::solid_pixel_buffer< pixel >::m_width.
|
inline |
Provides easy constant read access to underlying byte-buffer.
References png::solid_pixel_buffer< pixel >::m_bytes.
|
inline |
Moves the buffer to client code (c++11 only) .
References png::solid_pixel_buffer< pixel >::m_bytes, png::solid_pixel_buffer< pixel >::m_height, png::solid_pixel_buffer< pixel >::m_stride, and png::solid_pixel_buffer< pixel >::m_width.
|
staticprotected |
Referenced by png::solid_pixel_buffer< pixel >::get_pixel(), png::solid_pixel_buffer< pixel >::resize(), and png::solid_pixel_buffer< pixel >::set_pixel().
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by png::solid_pixel_buffer< pixel >::fetch_bytes(), png::solid_pixel_buffer< pixel >::get_bytes(), png::solid_pixel_buffer< pixel >::get_pixel(), png::solid_pixel_buffer< pixel >::get_row(), png::solid_pixel_buffer< pixel >::operator[](), png::solid_pixel_buffer< pixel >::resize(), and png::solid_pixel_buffer< pixel >::set_pixel().