31 #ifndef PNGPP_SOLID_PIXEL_BUFFER_HPP_INCLUDED 32 #define PNGPP_SOLID_PIXEL_BUFFER_HPP_INCLUDED 53 template<
typename pixel >
65 return reinterpret_cast<byte*
>(row);
165 void put_row(
size_t index, row_const_access r)
178 return *
reinterpret_cast< const pixel*
>(&
m_bytes.at(index));
187 *
reinterpret_cast< pixel*
>(&
m_bytes.at(index)) = p;
198 #ifdef PNGPP_HAS_STD_MOVE 215 pixel_traits_t::bit_depth / CHAR_BIT;
223 #ifdef PNGPP_HAS_STATIC_ASSERT 224 static_assert(pixel_traits_t::bit_depth % CHAR_BIT == 0,
225 "Bit_depth should consist of integer number of bytes");
227 static_assert(
sizeof(pixel) * CHAR_BIT ==
228 pixel_traits_t::channels * pixel_traits_t::bit_depth,
229 "pixel type should contain channels data only");
243 #endif // PNGPP_solid_pixel_buffer_HPP_INCLUDED row_const_access operator[](size_t index) const
The non-checking version of get_row() method.
Definition: solid_pixel_buffer.hpp:157
solid_pixel_buffer()
Constructs an empty 0x0 pixel buffer object.
Definition: solid_pixel_buffer.hpp:80
std::vector< byte > fetch_bytes()
Moves the buffer to client code (c++11 only) .
Definition: solid_pixel_buffer.hpp:202
static const size_t bytes_per_pixel
Definition: solid_pixel_buffer.hpp:214
const std::vector< byte > & get_bytes() const
Provides easy constant read access to underlying byte-buffer.
Definition: solid_pixel_buffer.hpp:193
uint_32 get_width() const
Definition: solid_pixel_buffer.hpp:98
void resize(uint_32 width, uint_32 height)
Resizes the pixel buffer.
Definition: solid_pixel_buffer.hpp:114
row_traits::row_const_access row_const_access
Definition: solid_pixel_buffer.hpp:74
const pixel * row_const_access
Definition: solid_pixel_buffer.hpp:61
uint_32 m_height
Definition: solid_pixel_buffer.hpp:219
Definition: solid_pixel_buffer.hpp:58
row_access get_row(size_t index)
Returns a reference to the row of image data at specified index.
Definition: solid_pixel_buffer.hpp:130
pixel * row_access
Definition: solid_pixel_buffer.hpp:60
Pixel traits class template.
Definition: pixel_traits.hpp:48
void put_row(size_t index, row_const_access r)
Replaces the row at specified index.
Definition: solid_pixel_buffer.hpp:165
The packed pixel class template.
Definition: packed_pixel.hpp:54
row_traits::row_access row_access
A row of pixel data.
Definition: solid_pixel_buffer.hpp:73
row_const_access get_row(size_t index) const
Returns a const reference to the row of image data at specified index.
Definition: solid_pixel_buffer.hpp:141
size_t m_stride
Definition: solid_pixel_buffer.hpp:220
row_access row_type
Definition: solid_pixel_buffer.hpp:75
png_uint_32 uint_32
Definition: types.hpp:41
png_byte byte
Definition: types.hpp:39
solid_pixel_buffer(uint_32 width, uint_32 height)
Constructs an empty pixel buffer object.
Definition: solid_pixel_buffer.hpp:90
uint_32 m_width
Definition: solid_pixel_buffer.hpp:218
static byte * get_data(row_access row)
Definition: solid_pixel_buffer.hpp:63
void set_pixel(size_t x, size_t y, pixel p)
Replaces a pixel at (x,y) position.
Definition: solid_pixel_buffer.hpp:184
uint_32 get_height() const
Definition: solid_pixel_buffer.hpp:103
pixel_traits< pixel > pixel_traits_t
Definition: solid_pixel_buffer.hpp:57
pixel get_pixel(size_t x, size_t y) const
Returns a pixel at (x,y) position.
Definition: solid_pixel_buffer.hpp:175
Pixel buffer, that stores pixels as continuous memory chunk. solid_pixel_buffer is useful when user w...
Definition: solid_pixel_buffer.hpp:54
std::vector< byte > m_bytes
Definition: solid_pixel_buffer.hpp:221
row_access operator[](size_t index)
The non-checking version of get_row() method.
Definition: solid_pixel_buffer.hpp:149