summaryrefslogtreecommitdiff
path: root/source/libs/asura-lib-core/graphics/image.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/libs/asura-lib-core/graphics/image.h')
-rw-r--r--source/libs/asura-lib-core/graphics/image.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/source/libs/asura-lib-core/graphics/image.h b/source/libs/asura-lib-core/graphics/image.h
new file mode 100644
index 0000000..2dd3a4a
--- /dev/null
+++ b/source/libs/asura-lib-core/graphics/image.h
@@ -0,0 +1,76 @@
+#ifndef __ASURA_ENGINE_IMAGE_H__
+#define __ASURA_ENGINE_IMAGE_H__
+
+#include "../math/vector2.hpp"
+#include "../scripting/portable.hpp"
+#include "../fileSystem/reloadable.h"
+#include "../stringmap.hpp"
+#include "../manager.hpp"
+
+#include "texture.h"
+#include "color.h"
+#include "image_data.h"
+#include "render_state.h"
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ class ImageFactory;
+
+ ///
+ /// ImageͼƬڴ󣬶ȡϷ󱣴ĽһImageڴ桢ԴֻᱣһݣҪ
+ /// imageêλãźתǶȣʹspriteһֻࡣҪǿǵeditorengineʹòͬķװ
+ ///
+ class Image ASURA_FINAL
+ : public Drawable
+ , public Scripting::Portable<Image>
+ , public Filesystem::Reloadable
+ {
+ public:
+
+ Image();
+
+ ~Image();
+
+ ///
+ /// bufferimageϢmPixelsΪգݡ¹imageʹglTexImage2Dύimage
+ /// ݡ
+ ///
+ bool Load(ImageData* data);
+
+ uint GetWidth();
+ uint GetHeight();
+ Math::Vector2u GetSize();
+
+ ///
+ /// ijһλõ
+ ///
+ Color32 GetPixel(uint x, uint y);
+
+ void Render(const RenderTarget* rt, const RenderState& state) override;
+
+ void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) override;
+
+ private:
+
+ ImageData* mImageData;
+
+ Math::Vector2u mSize;
+
+ public:
+
+ LUAX_DECL_FACTORY(SimImage);
+
+ LUAX_DECL_METHOD(l_Load);
+ LUAX_DECL_METHOD(l_GetWidth);
+ LUAX_DECL_METHOD(l_GetHeight);
+ LUAX_DECL_METHOD(l_GetSize);
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file