summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Graphics/Image.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Asura.Engine/Graphics/Image.h')
-rw-r--r--Source/Asura.Engine/Graphics/Image.h42
1 files changed, 26 insertions, 16 deletions
diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h
index bdd7c1c..391d1c4 100644
--- a/Source/Asura.Engine/Graphics/Image.h
+++ b/Source/Asura.Engine/Graphics/Image.h
@@ -7,6 +7,7 @@
#include "Texture.h"
#include "Color.h"
#include "Factory.h"
+#include "SimClass.h"
namespace AsuraEngine
{
@@ -19,10 +20,19 @@ namespace AsuraEngine
/// ImageͼƬڴ󣬶ȡϷ󱣴ĽһImageڴ桢ԴֻᱣһݣҪ
/// imageêλãźתǶȣʹspriteһֻࡣҪǿǵeditorengineʹòͬķװ
///
- class Image final : public Texture
+ class Image final : public Texture, public SimClass
{
public:
+ Image();
+ ~Image();
+
+ ///
+ /// bufferimagemPixelsΪգݡ¹imageʹglTexImage2Dύimage
+ /// ݡ
+ ///
+ bool Load(const void* data, size_t size);
+
uint GetWidth();
uint GetHeight();
@@ -31,29 +41,29 @@ namespace AsuraEngine
///
Color GetPixel(uint x, uint y);
- private:
+ void Render(int x, int y, int sx, int sy, int ox, int oy, int r) override;
- friend class ImageFactory;
+ void Render(const Math::Rect& quad, int x, int y, int sx, int sy, int ox, int oy, int r) override;
- Image(Color* pixels, int width, int height);
- ~Image();
+ //----------------------------------------------------------------------------------------------------------
+
+ LUAX_DECL_FACTORY(SimImage);
+
+ LUAX_DECL_METHOD(l_Load);
+ LUAX_DECL_METHOD(l_GetPixel);
+ LUAX_DECL_METHOD(l_GetWidth);
+ LUAX_DECL_METHOD(l_GetHeight);
+
+ //----------------------------------------------------------------------------------------------------------
+
+ private:
///
/// СΪλ
///
uint mWidth, mHeight;
- Color* mPixels;
-
- ///
- /// ID
- ///
- uint mID;
-
- //----------------------------------------------------------------------------------------------------
- // ͼƬSim࣬ķװAsuraEngine.Image棬һԱAsuraEngine.SimImageAsuraEngine.Image
- // һ档
- LUAX_DECL_FACTORY(SimImage);
+ Color* mPixels;
};