summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Graphics/ImageData.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-01 08:50:34 +0800
committerchai <chaifix@163.com>2019-03-01 08:50:34 +0800
commit64d9d7b3eb7cece81da8b2cb56eb0f50d87a5964 (patch)
tree12bde99e5415f77f60f8873a66d09bfd3b84ec48 /Source/Asura.Engine/Graphics/ImageData.h
parente28a7d48d032fe7fd4c8789e95fbc659873a0adc (diff)
*misc
Diffstat (limited to 'Source/Asura.Engine/Graphics/ImageData.h')
-rw-r--r--Source/Asura.Engine/Graphics/ImageData.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/Source/Asura.Engine/Graphics/ImageData.h b/Source/Asura.Engine/Graphics/ImageData.h
new file mode 100644
index 0000000..925a5a0
--- /dev/null
+++ b/Source/Asura.Engine/Graphics/ImageData.h
@@ -0,0 +1,58 @@
+#ifndef __ASURA_ENGINE_IMAGEDATA_H__
+#define __ASURA_ENGINE_IMAGEDATA_H__
+
+#include <list>
+
+#include "Scripting/Luax.hpp"
+#include "Filesystem/DecodedData.h"
+#include "ImageDecoder.h"
+#include "PixelFormat.h"
+#include "Color.h"
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ class ImageData final : public Filesystem::DecodedData, public Scripting::Portable
+ {
+ public:
+
+ ///
+ /// ͼƬļϢʧܣ׳쳣
+ ///
+ ImageData(const Filesystem::DataBuffer* buffer);
+ ~ImageData();
+
+ Color GetPixel(uint x, uint y);
+
+ uint width, height;
+ PixelFormat format;
+ std::size_t size;
+ byte* pixels;
+
+ //----------------------------------------------------------------------------------------------------------
+
+ LUAX_DECL_FACTORY(ImageData);
+
+ LUAX_DECL_METHOD(l_GetPixel);
+ LUAX_DECL_METHOD(l_GetSize);
+
+ //----------------------------------------------------------------------------------------------------------
+
+ private:
+
+ // stbJPEGTGABMP,lodePNGpngͼƬ
+ void Decode(const Filesystem::DataBuffer* buffer) override;
+
+ ///
+ /// ڵһ׼image dataʱṩdecoderڼdecodersмѡԡ
+ ///
+ static std::list<ImageDecoder*> ImageDecoders;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file