aboutsummaryrefslogtreecommitdiff
path: root/src/lua/graphics/Image.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-14 14:56:47 +0800
committerchai <chaifix@163.com>2018-08-14 14:56:47 +0800
commit5c9af043503f92852a1a765b6ecfbc1aea24d2e9 (patch)
treeeb371092c4137a672e7bfc13dc56ee777623ebfe /src/lua/graphics/Image.h
parent5162f84be0a4deb447c6ba1226722b049335d525 (diff)
*update
Diffstat (limited to 'src/lua/graphics/Image.h')
-rw-r--r--src/lua/graphics/Image.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/lua/graphics/Image.h b/src/lua/graphics/Image.h
new file mode 100644
index 0000000..689793a
--- /dev/null
+++ b/src/lua/graphics/Image.h
@@ -0,0 +1,59 @@
+#ifndef __JIN_LUA_GRAPHICS_IMAGE_H
+#define __JIN_LUA_GRAPHICS_IMAGE_H
+#include "libjin/jin.h"
+#include "../luaopen_types.h"
+
+namespace jin
+{
+namespace lua
+{
+namespace graphics
+{
+
+ class Image : public Object
+ {
+ public:
+ static Image* createImage(const char* file);
+ static Image* createImage(const void* mem, size_t size);
+
+ int getWidth()
+ {
+ return image->getWidth();
+ }
+ int getHeight()
+ {
+ return image->getHeight();
+ }
+ void setAnchor(int x, int y)
+ {
+ image->setAnchor(x, y);
+ }
+ jin::graphics::color getPixel(int x, int y)
+ {
+ return image->getPixel(x, y);
+ }
+ inline const jin::graphics::Texture* getRawImage() const
+ {
+ return image;
+ }
+
+ void draw(int x, int y, float sx, float sy, float r)
+ {
+ image->draw(x, y, sx, sy, r);
+ }
+
+ private:
+ ~Image()
+ {
+ delete image;
+ }
+
+ jin::graphics::Texture* image;
+
+ };
+
+} // graphics
+} // lua
+} // jin
+
+#endif \ No newline at end of file