31#ifndef PNGPP_PIXEL_BUFFER_HPP_INCLUDED
32#define PNGPP_PIXEL_BUFFER_HPP_INCLUDED
58 template<
typename pixel,
112 for (
typename row_vec::iterator
r =
m_rows.begin();
195 template<
typename pixel >
212 template<
typename pixel >
230 template<
class pixel,
typename reference >
260 int const bits = pixel::get_bit_depth();
266 return 8 / pixel::get_bit_depth();
273 template<
class pixel >
284 template<
class pixel >
307 template<
typename reference >
317 & ~(pixel::get_bit_mask() << this->
m_shift))
332 template<
class pixel >
354 m_vec.resize(
size / get_pixels_per_byte()
355 + (
size % get_pixels_per_byte() ? 1 : 0));
385 return pixel_proxy(m_vec.at(index / get_pixels_per_byte()),
405 return pixel_proxy(m_vec[index / get_pixels_per_byte()],
419 static size_t get_pixels_per_byte()
421 return 8 / pixel::get_bit_depth();
424 std::vector< byte > m_vec;
432 template<
typename pixel >
441 return row.get_data();
452 packed_pixel_row< packed_gray_pixel
477 packed_pixel_row< packed_index_pixel
The basic class template to represent image pixel data.
Definition pixel_buffer.hpp:62
void resize(uint_32 width, uint_32 height)
Resizes the pixel buffer.
Definition pixel_buffer.hpp:107
std::vector< row_type > row_vec
Definition pixel_buffer.hpp:188
uint_32 get_height() const
Definition pixel_buffer.hpp:96
row_type & row_access
Definition pixel_buffer.hpp:68
void set_pixel(size_t x, size_t y, pixel p)
Replaces a pixel at (x,y) position.
Definition pixel_buffer.hpp:180
traits row_traits
Definition pixel_buffer.hpp:70
row_type const & row_const_access
Definition pixel_buffer.hpp:69
row_access get_row(size_t index)
Returns a reference to the row of image data at specified index.
Definition pixel_buffer.hpp:128
row_vec m_rows
Definition pixel_buffer.hpp:189
uint_32 m_height
Definition pixel_buffer.hpp:187
void put_row(size_t index, row_type const &r)
Replaces the row at specified index.
Definition pixel_buffer.hpp:163
basic_pixel_buffer()
Constructs an empty 0x0 pixel buffer object.
Definition pixel_buffer.hpp:75
row row_type
A row of pixel data.
Definition pixel_buffer.hpp:67
row_const_access get_row(size_t index) const
Returns a const reference to the row of image data at specified index.
Definition pixel_buffer.hpp:139
basic_pixel_buffer(uint_32 width, uint_32 height)
Constructs an empty pixel buffer object.
Definition pixel_buffer.hpp:84
row_access operator[](size_t index)
The non-checking version of get_row() method.
Definition pixel_buffer.hpp:147
uint_32 get_width() const
Definition pixel_buffer.hpp:91
row_const_access operator[](size_t index) const
The non-checking version of get_row() method.
Definition pixel_buffer.hpp:155
pixel get_pixel(size_t x, size_t y) const
Returns a pixel at (x,y) position.
Definition pixel_buffer.hpp:172
uint_32 m_width
Definition pixel_buffer.hpp:186
Definition pixel_buffer.hpp:232
reference m_ref
Definition pixel_buffer.hpp:269
basic_packed_pixel_proxy(reference ref)
Definition pixel_buffer.hpp:234
static size_t get_pixels_per_byte()
Definition pixel_buffer.hpp:264
static size_t get_shift(size_t index)
Definition pixel_buffer.hpp:258
basic_packed_pixel_proxy(reference ref, size_t index)
Definition pixel_buffer.hpp:240
size_t m_shift
Definition pixel_buffer.hpp:270
Definition pixel_buffer.hpp:276
const_packed_pixel_proxy(byte const &ref, size_t index)
Definition pixel_buffer.hpp:278
Definition pixel_buffer.hpp:287
basic_packed_pixel_proxy< pixel, byte & > basic_proxy
Definition pixel_buffer.hpp:289
packed_pixel_proxy & operator=(pixel p)
Definition pixel_buffer.hpp:314
packed_pixel_proxy(byte &ref, size_t index)
Definition pixel_buffer.hpp:291
packed_pixel_proxy(packed_pixel_proxy const &other)
Definition pixel_buffer.hpp:296
packed_pixel_proxy & operator=(packed_pixel_proxy const &other)
Definition pixel_buffer.hpp:302
packed_pixel_proxy & operator=(basic_packed_pixel_proxy< pixel, reference > const &other)
Definition pixel_buffer.hpp:309
The packed gray pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.
Definition gray_pixel.hpp:58
The packed indexed pixel class template. The available specializations are for 1-,...
Definition index_pixel.hpp:68
The packed pixel row class template.
Definition pixel_buffer.hpp:334
size_t size() const
Definition pixel_buffer.hpp:344
pixel_proxy operator[](size_t index)
Returns n mutable proxy the to the pixel at index. The non-checking version.
Definition pixel_buffer.hpp:403
byte * get_data()
Returns the starting address of the row.
Definition pixel_buffer.hpp:412
detail::const_packed_pixel_proxy< pixel > const_pixel_proxy
The immutable packed pixel proxy type.
Definition pixel_buffer.hpp:362
pixel_proxy at(size_t index)
Returns a mutable proxy the to the pixel at index.
Definition pixel_buffer.hpp:383
detail::packed_pixel_proxy< pixel > pixel_proxy
The mutable packed pixel proxy type.
Definition pixel_buffer.hpp:367
const_pixel_proxy at(size_t index) const
Returns an immutable proxy the to the pixel at index.
Definition pixel_buffer.hpp:373
const_pixel_proxy operator[](size_t index) const
Returns an immutable proxy the to the pixel at index. The non-checking version.
Definition pixel_buffer.hpp:393
packed_pixel_row(size_t size=0)
Constructs a pixel row object for size packed pixels.
Definition pixel_buffer.hpp:339
void resize(size_t size)
Resizes the pixel row to hold up to size packed pixels.
Definition pixel_buffer.hpp:352
pixel_buffer(uint_32 width, uint_32 height)
Definition pixel_buffer.hpp:463
packed_gray_pixel< bits > pixel_type
Definition pixel_buffer.hpp:456
packed_pixel_row< pixel_type > pixel_row_type
Definition pixel_buffer.hpp:457
pixel_buffer()
Definition pixel_buffer.hpp:459
packed_pixel_row< pixel_type > pixel_row_type
Definition pixel_buffer.hpp:482
packed_index_pixel< bits > pixel_type
Definition pixel_buffer.hpp:481
pixel_buffer(uint_32 width, uint_32 height)
Definition pixel_buffer.hpp:488
pixel_buffer()
Definition pixel_buffer.hpp:484
Definition pixel_buffer.hpp:215
pixel_buffer()
Definition pixel_buffer.hpp:217
pixel_buffer(uint_32 width, uint_32 height)
Definition pixel_buffer.hpp:221
The PNG reader class template. This is the low-level reading interface–use image class or consumer cl...
Definition reader.hpp:67
static byte * get_data(packed_pixel_row< pixel > &row)
Returns the starting address of the row.
Definition pixel_buffer.hpp:439
static pixel * get_data(std::vector< pixel > &vec)
Returns the starting address of the row.
Definition pixel_buffer.hpp:202
The pixel row traits class template. Provides a common way to get starting address of the row for pac...
Definition pixel_buffer.hpp:53
png_byte byte
Definition types.hpp:39