aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Bitmap.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-09-06 19:57:40 +0800
committerchai <chaifix@163.com>2018-09-06 19:57:40 +0800
commit50084b0b3451328a4dfe6db65c78a225e9c8f288 (patch)
tree020e5b6c834b792aada4cd23cd2551a6b81c22dc /src/libjin/Graphics/Bitmap.h
parent7281a70b1e38fc2bdfb2d4b6d8f7daf7ceedbd1a (diff)
+bitmap
Diffstat (limited to 'src/libjin/Graphics/Bitmap.h')
-rw-r--r--src/libjin/Graphics/Bitmap.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/libjin/Graphics/Bitmap.h b/src/libjin/Graphics/Bitmap.h
new file mode 100644
index 0000000..d050c43
--- /dev/null
+++ b/src/libjin/Graphics/Bitmap.h
@@ -0,0 +1,43 @@
+#ifndef __JIN_BITMAP_H
+#define __JIN_BITMAP_H
+#include "../modules.h"
+#if JIN_MODULES_RENDER
+
+#include "../Math/Vector2.h"
+#include "../3rdparty/GLee/GLee.h"
+#include "Color.h"
+namespace jin
+{
+namespace graphics
+{
+
+ class Bitmap
+ {
+ public:
+ static Bitmap* createBitmap(const void* imgData, size_t size);
+ static Bitmap* createBitmap(int w, int h);
+
+ ~Bitmap();
+
+ void bindPixels(Color* pixels, int w, int h);
+ void setPixels(Color* pixels, int w, int h);
+ void setPixel(const Color& pixel, int x, int y);
+ Color getPixel(int x, int y);
+ const Color* getPixels();
+ inline int getWidth() { return width; }
+ inline int getHeight() { return height; }
+
+ private:
+ Bitmap();
+ Bitmap(int w, int h);
+
+ Color * pixels;
+ int width, height;
+
+ };
+
+}
+}
+
+#endif
+#endif \ No newline at end of file