blip  0.1
Pixmap.hpp
Go to the documentation of this file.
1 #ifndef __blip_Pixmap_hpp
2 #define __blip_Pixmap_hpp
3 
4 #include <blip/Blip.hpp>
5 #include <blip/Size.hpp>
6 
7 namespace blip {
8 
58 class Pixmap
59 {
60  public:
61 
63  static const uint_t DEFAULT_ALIGNMENT;
64 
66 
78  Pixmap(Format format, uint_t width, uint_t height,
79  uint_t alignment = DEFAULT_ALIGNMENT);
80 
82  ~Pixmap() throw();
83 
85  inline uint_t getWidth() const throw()
86  { return(_size.getWidth()); }
87 
89  inline uint_t getHeight() const throw()
90  { return(_size.getHeight()); }
91 
93  inline Size getSize() const throw()
94  { return(_size); }
95 
102  void setImageSize(const Size& imageSize) throw();
103 
108  inline const Size& getImageSize() const throw()
109  { return(_imageSize); }
110 
114  inline int getImageWidth() const throw()
115  { return(_imageSize.getWidth()); }
116 
120  inline int getImageHeight() const throw()
121  { return(_imageSize.getHeight()); }
122 
127  inline uint_t getRowStride() const throw()
128  { return(_rowStride); }
129 
131  inline Format getFormat() const throw()
132  { return(_format); }
133 
137  inline const byte_t* getData() const throw()
138  { return(_data); }
139 
143  inline byte_t* getData() throw()
144  { return(_data); }
145 
147  inline const size_t getDataLength() const throw()
148  { return(_dataLength); }
149 
151  inline uint_t getAlignment() const throw()
152  { return(_alignment); }
153 
155  void clear() throw();
156 
158  bool isNull() const throw();
159 
160  private:
161 
162  Format _format;
163  Size _size;
164  Size _imageSize;
165  uint_t _rowStride;
166  uint_t _alignment;
167  byte_t* _data;
168  size_t _dataLength;
169  size_t _pixelSize;
170 
171  CCXX_COPY_DECLS(Pixmap);
172 };
173 
174 } // namespace blip
175 
176 #endif // __blip_Pixmap_hpp
const byte_t * getData() const
Get a pointer to the beginning (the bottom-left corner) of the pixel data.
Definition: Pixmap.hpp:137
Format
Definition: Pixmap.hpp:65
uint_t getHeight() const
Get the height.
Definition: Size.hpp:35
uint_t getAlignment() const
Get the storage alignment.
Definition: Pixmap.hpp:151
Size getSize() const
Get the size of the pixmap.
Definition: Pixmap.hpp:93
A rectangular size that has a width and a height.
Definition: Size.hpp:13
int getImageWidth() const
Get the width of the image that is currently being stored in the Pixmap, in pixels.
Definition: Pixmap.hpp:114
static const uint_t DEFAULT_ALIGNMENT
The default alignment for pixel data for the host platform.
Definition: Pixmap.hpp:63
void setImageSize(const Size &imageSize)
Set the size of the image that is currently being stored in the Pixmap.
Definition: Pixmap.cpp:58
uint_t getWidth() const
Get the width.
Definition: Size.hpp:27
Definition: Pixmap.hpp:65
WAV file format details at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
Definition: AccelerometerSensorEvent.cpp:3
~Pixmap()
Destructor.
Definition: Pixmap.cpp:50
byte_t * getData()
Get a pointer to the beginning (the bottom-left corner) of the pixel data.
Definition: Pixmap.hpp:143
bool isNull() const
Test if the Pixmap is null, that is, a Pixmap with 0x0 size.
Definition: Pixmap.cpp:67
uint_t getWidth() const
Get the width of the Pixmap, in pixels.
Definition: Pixmap.hpp:85
const Size & getImageSize() const
Get the size of the image that is currently being stored in the Pixmap.
Definition: Pixmap.hpp:108
uint_t getRowStride() const
Get the row stride for the Pixmap, i.e., the number of bytes occupied by one row of pixel data...
Definition: Pixmap.hpp:127
Definition: Pixmap.hpp:65
int getImageHeight() const
Get the height of the image that is currently being stored in the Pixmap, in pixels.
Definition: Pixmap.hpp:120
uint_t getHeight() const
Get the height of the Pixmap, in pixels.
Definition: Pixmap.hpp:89
Format getFormat() const
Get the image format.
Definition: Pixmap.hpp:131
A buffer for two-dimensional pixel data, stored in inverted row order (bottom row first...
Definition: Pixmap.hpp:58
void clear()
Clear the Pixmap.
Definition: Pixmap.cpp:75
Pixmap(Format format, uint_t width, uint_t height, uint_t alignment=DEFAULT_ALIGNMENT)
Construct a new pixmap with the specified pixel format, size, and alignment.
Definition: Pixmap.cpp:10
const size_t getDataLength() const
Get the length of the pixel data, in bytes.
Definition: Pixmap.hpp:147