Go to the documentation of this file.
10 #include <type_traits>
12 #include <boost/operators.hpp>
13 #include <boost/shared_ptr.hpp>
14 #include <boost/utility.hpp>
25 using Ptr = boost::shared_ptr<BitmapSurface>;
29 boost::shared_ptr<unsigned char>
const data;
32 static Ptr create(
int width,
int height, cairo_format_t format);
33 static Ptr create(
int width,
int height, cairo_format_t format,
int stride, boost::shared_ptr<unsigned char>
const&
data);
41 cairo_surface_t*
get();
45 BitmapSurface(
int width,
int height, cairo_format_t format,
int stride, boost::shared_ptr<unsigned char>
const&
data);
60 template <
typename ConstBase>
61 class SampleIterator :
public boost::addable2<SampleIterator<ConstBase>, unsigned int>
64 using Base =
typename std::remove_const<ConstBase>::type;
66 static const int bitsPerBase{8 *
sizeof(ConstBase) /
sizeof(
byte)};
77 static Base mask(
int bps) {
return (((ConstBase(1) << (
bps - 1)) - 1) << 1) | 1; }
Base operator*()
Definition: bitmap-helpers.hh:153
void set(ConstBase value)
Definition: bitmap-helpers.hh:108
Definition: bitmap-helpers.hh:61
SampleIterator & operator+=(unsigned int x)
Definition: bitmap-helpers.hh:142
const boost::shared_ptr< unsigned char > data
Definition: bitmap-helpers.hh:29
boost::shared_ptr< BitmapSurface > Ptr
Definition: bitmap-helpers.hh:25
static Base mask(int bps)
Definition: bitmap-helpers.hh:77
BitmapSurface & operator=(const BitmapSurface &)=delete
SampleIterator & operator++()
Definition: bitmap-helpers.hh:114
static Ptr create(int width, int height, cairo_format_t format)
Definition: bitmap-helpers.cc:13
SampleIterator operator++(int)
Definition: bitmap-helpers.hh:127
Base get()
Definition: bitmap-helpers.hh:105
const int bps
Definition: bitmap-helpers.hh:68
static const int bitsPerBase
Definition: bitmap-helpers.hh:66
cairo_surface_t *const surface
Definition: bitmap-helpers.hh:28
SampleIterator(div_t d, ConstBase *base, int bps_)
Definition: bitmap-helpers.hh:79
SampleIterator(ConstBase *base, int offset=0, int bps_=1)
Definition: bitmap-helpers.hh:99
const int pixelOffset
Definition: bitmap-helpers.hh:70
cairo_surface_t * get()
Definition: bitmap-helpers.cc:26
~BitmapSurface()
Definition: bitmap-helpers.cc:24
int currentOffset
Definition: bitmap-helpers.hh:74
const ConstBase pixelMask
Definition: bitmap-helpers.hh:71
Definition: bitmap-helpers.hh:22
Definition: bitmap-helpers.hh:20
BitmapSurface(const BitmapSurface &)=delete
typename std::remove_const< ConstBase >::type Base
Definition: bitmap-helpers.hh:64
bool operator==(const SampleIterator< ConstBase > &other) const
Definition: bitmap-helpers.hh:155
ConstBase * currentBase
Definition: bitmap-helpers.hh:73
const int samplesPerBase
Definition: bitmap-helpers.hh:69