You.i Engine
YiBitmap.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_BITMAP_H_
3 #define _YI_BITMAP_H_
4 
5 #include "framework/YiPredef.h"
6 
7 #include <memory>
8 
14 class CYIBitmapPriv;
15 class CYIColor;
16 
20 class CYIBitmap
21 {
22  friend class CYIBitmapPriv;
23 
24 public:
25  enum OWNERSHIP
26  {
29  };
30 
36  {
40  };
41 
47  {
50  };
51 
52  CYIBitmap();
53  virtual ~CYIBitmap();
54 
58  std::unique_ptr<CYIBitmap> Clone() const;
59 
64  virtual bool Create(int32_t nWidth, int32_t nHeight);
65 
72  void Draw(const CYIBitmap &srcImage, int32_t nDestX, int32_t nDestY);
73 
80  void Draw(const CYIBitmap &srcImage, int32_t nDestX, int32_t nDestY, const YI_RECT_REL &clipRegion);
81 
88  void Draw(const CYIBitmap &srcImage, int32_t nDestX, int32_t nDestY, int32_t nClipWidth, int32_t nClipHeight);
89 
96  void DrawScale(const CYIBitmap & srcImage, const YI_RECT_REL *pDest, const YI_RECT_REL *pSrc);
97 
101  void Fill(const CYIColor &color);
102 
106  void Fill(const CYIColor &color, const YI_RECT &region);
107 
112  const uint32_t *GetPixels() const;
113 
118  uint32_t *GetPixels();
119 
123  void FreePixels();
124 
125 
129  virtual int32_t GetHeight() const;
130 
136  void ReduceHeightTo(int32_t nNewHeight);
137 
141  virtual int32_t GetWidth() const;
142 
148  int32_t GetXPitch() const;
149 
155  int32_t GetYPitch() const;
156 
160  virtual int32_t GetDepth() const;
161 
165  uint32_t GetBytesPerPixel() const;
166 
170  virtual int32_t GetSize() const;
171 
180  void SetPixels(uint32_t *pBits, int32_t nWidth, int32_t nHeight, CYIBitmap::OWNERSHIP ownership = CYIBitmap::PRIVATE);
181 
185  void SetPixel(int32_t nX, int32_t nY, const CYIColor &color);
186 
192  virtual void SetPixelPacked(int32_t nX, int32_t nY, uint32_t color);
193 
199  void SetPixelRaw(int32_t nX, int32_t nY, uint32_t color);
200 
204  CYIColor GetPixel(int32_t nX, int32_t nY) const;
205 
211  virtual uint32_t GetPixelPacked(int32_t nX, int32_t nY) const;
212 
218  uint32_t GetPixelRaw(int32_t nX, int32_t nY) const;
219 
224  COLOR_MODE GetColorMode() const;
225 
229  std::unique_ptr<CYIBitmap> ToColorMode(COLOR_MODE eColorMode, DITHERING_MODE eDitheringMode = DITHERING_NONE) const;
230 
234  bool operator==(const CYIBitmap &other) const;
235 
239  bool operator!=(const CYIBitmap &other) const;
240 
241 private:
242  std::unique_ptr<CYIBitmapPriv> m_pPriv;
243  CYIBitmap(std::unique_ptr<CYIBitmapPriv> pPriv);
244  CYIBitmap(const CYIBitmap &other);
245  CYIBitmap &operator=(const CYIBitmap &other) = delete;
246 };
247 
250 #endif // _YI_BITMAP_H_
virtual ~CYIBitmap()
DITHERING_MODE
Definition: YiBitmap.h:46
int32_t GetXPitch() const
Definition: YiPredef.h:234
Definition: YiBitmap.h:28
Four channel color with 8 bits per color. The &#39;red&#39; component is at the lowest bits of the 32 bit wor...
Definition: YiBitmap.h:37
Definition: YiPredef.h:183
The core bitmap container class used by You.i Engine.
Definition: YiBitmap.h:20
void SetPixels(uint32_t *pBits, int32_t nWidth, int32_t nHeight, CYIBitmap::OWNERSHIP ownership=CYIBitmap::PRIVATE)
OWNERSHIP
Definition: YiBitmap.h:25
int32_t GetYPitch() const
virtual int32_t GetSize() const
bool operator!=(const CYIBitmap &other) const
void DrawScale(const CYIBitmap &srcImage, const YI_RECT_REL *pDest, const YI_RECT_REL *pSrc)
COLOR_MODE GetColorMode() const
bool operator==(const CYIBitmap &other) const
Indicates that Floyd-Steinberg dithering should be used.
Definition: YiBitmap.h:49
friend class CYIBitmapPriv
Definition: YiBitmap.h:22
CYIColor GetPixel(int32_t nX, int32_t nY) const
virtual bool Create(int32_t nWidth, int32_t nHeight)
void SetPixelRaw(int32_t nX, int32_t nY, uint32_t color)
std::unique_ptr< CYIBitmap > ToColorMode(COLOR_MODE eColorMode, DITHERING_MODE eDitheringMode=DITHERING_NONE) const
virtual int32_t GetHeight() const
virtual uint32_t GetPixelPacked(int32_t nX, int32_t nY) const
uint32_t GetBytesPerPixel() const
void ReduceHeightTo(int32_t nNewHeight)
void FreePixels()
virtual void SetPixelPacked(int32_t nX, int32_t nY, uint32_t color)
void SetPixel(int32_t nX, int32_t nY, const CYIColor &color)
void Draw(const CYIBitmap &srcImage, int32_t nDestX, int32_t nDestY)
Definition: YiBitmap.h:27
COLOR_MODE
Definition: YiBitmap.h:35
Four channel color with 4 bits per color. The &#39;red&#39; component is at the lowest bits of the 16 bit wor...
Definition: YiBitmap.h:38
Three channel color with 5 bits for the red channel, 6 bits for the green channel and 5 bits for the ...
Definition: YiBitmap.h:39
virtual int32_t GetDepth() const
virtual int32_t GetWidth() const
A class used to represent a color value.
Definition: YiColor.h:31
const uint32_t * GetPixels() const
uint32_t GetPixelRaw(int32_t nX, int32_t nY) const
std::unique_ptr< CYIBitmap > Clone() const
void Fill(const CYIColor &color)
No dithering.
Definition: YiBitmap.h:48