diff options
author | chai <chaifix@163.com> | 2019-03-19 23:06:27 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-19 23:06:27 +0800 |
commit | 1497dccd63a84b7ee2b229b1ad9c5c02718f2a78 (patch) | |
tree | f8d1bff50da13e126d08c7345653e002e293202d /source/libs/asura-lib-core/graphics/image.h | |
parent | 5e2a973516e0729b225da9de0b03015dc5854ac4 (diff) |
*rename
Diffstat (limited to 'source/libs/asura-lib-core/graphics/image.h')
-rw-r--r-- | source/libs/asura-lib-core/graphics/image.h | 76 |
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 |