1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#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() {};
~Image()
{
delete image;
}
jin::graphics::Texture* image;
};
} // graphics
} // lua
} // jin
#endif // __JIN_LUA_GRAPHICS_IMAGE_H
|