+#ifndef _freeimage_bitmap_\r
+#define _freeimage_bitmap_\r
+\r
+#include <FreeImage.h>\r
+\r
+#include <string>\r
+#include <vector>\r
+\r
+namespace FreeImage\r
+{\r
+\r
+class Bitmap\r
+{\r
+public:\r
+ Bitmap();\r
+ Bitmap(const Bitmap &bmp);\r
+ Bitmap(const std::string &typestr, const std::string &filename);\r
+ Bitmap(FIBITMAP *bmp);\r
+ Bitmap(const int width, const int height, const int bpp);\r
+ ~Bitmap();\r
+\r
+ const bool Create(const int width, const int height, const int bpp);\r
+\r
+ inline const unsigned int Height() const { return m_bmp ? FreeImage_GetHeight(m_bmp) : 0 ; }\r
+ inline const unsigned int Width() const { return m_bmp ? FreeImage_GetWidth(m_bmp) : 0 ; }\r
+ inline const unsigned int BPP() const { return m_bmp ? FreeImage_GetBPP(m_bmp) : 0 ; }\r
+ void ConvertBPP(const int bpp);\r
+\r
+ void Clear(const RGBQUAD color);\r
+ void ClearTransparent();\r
+\r
+ const bool Save(const std::string &filename) const;\r
+ const bool SaveToMemory(const std::string &typestr, std::vector<unsigned char> &data) const;\r
+ const bool Load(const std::string &typestr, const std::string &filename);\r
+ const bool LoadFromMemory(const std::string &typestr, std::vector<unsigned char> &data);\r
+\r
+ void SetTransparent();\r
+ \r
+ void PutPixel(const int x, const int y, RGBQUAD color);\r
+ RGBQUAD GetPixel(const int x, const int y) const;\r
+ const int GetPixelIndex(const int x, const int y) const;\r
+ void Line(const int x1, const int y1, const int x2, const int y2, const RGBQUAD color);\r
+ void FastLine(const int x1, const int y1, const int x2, const int y2, const RGBQUAD color);\r
+ //void Arc(const int cx, const int cy, const int r, const float start, const float end, const RGBQUAD color);\r
+ void Rect(const int x1, const int y1, const int w, const int h, const bool filled, const RGBQUAD color);\r
+ void Rotate(const double angle, const int shiftx, const int shifty, const int originx, const int originy);\r
+ void HorizontalOffset(const int y, const double shift);\r
+ void VerticalOffset(const int x, const double shift);\r
+\r
+ void Blit(const Bitmap &bmp, const int destx, const int desty, const int sourcex, const int sourcey, const int w, const int h, const int alpha);\r
+ void BlitTrans(const Bitmap &bmp, const int destx, const int desty, const int sourcex, const int sourcey, const int w, const int h);\r
+\r
+ Bitmap &operator=(const Bitmap &rhs);\r
+\r
+private:\r
+ void Destroy();\r
+ void AALine(const int x1, const int y1, const int x2, const int y2, const RGBQUAD color);\r
+ double LineFunction(const double slopex, const double slopey, const int startx, const int starty, const double testx, const double texty);\r
+\r
+ FIBITMAP *m_bmp;\r
+\r
+};\r
+\r
+}\r
+\r
+#endif // _freeimage_bitmap_\r