From 50084b0b3451328a4dfe6db65c78a225e9c8f288 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 6 Sep 2018 19:57:40 +0800 Subject: +bitmap --- src/libjin/Graphics/Bitmap.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/libjin/Graphics/Bitmap.h (limited to 'src/libjin/Graphics/Bitmap.h') 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 -- cgit v1.1-26-g67d0