summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/graphics/image_data.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core/graphics/image_data.h')
-rw-r--r--source/modules/asura-core/graphics/image_data.h45
1 files changed, 31 insertions, 14 deletions
diff --git a/source/modules/asura-core/graphics/image_data.h b/source/modules/asura-core/graphics/image_data.h
index ea1d53a..b9d656c 100644
--- a/source/modules/asura-core/graphics/image_data.h
+++ b/source/modules/asura-core/graphics/image_data.h
@@ -7,8 +7,9 @@
#include <asura-utils/io/decoded_data.h>
#include <asura-utils/io/data_buffer.h>
#include <asura-utils/threading/thread.h>
+#include <asura-utils/threading/mutex.h>
-#include "pixel_format.h"
+#include "texture.h"
#include "color.h"
namespace AsuraEngine
@@ -29,27 +30,28 @@ namespace AsuraEngine
///
/// ͼƬļϢʧܣ׳쳣
///
- ImageData(const AEIO::DataBuffer& buffer);
+ ImageData();
~ImageData();
- void Load(const AEIO::DataBuffer& buffer);
- void LoadAsync(const AEIO::DataBuffer& buffer, AEThreading::Thread* thread);
+ void Decode(AEIO::DataBuffer& buffer) override;
+
+ void Lock();
+ void Unlock();
Color GetPixel(uint x, uint y);
- uint width, height;
- PixelFormat format;
- std::size_t size;
- byte* pixels;
+ //----------------------------------------------------------------------------//
- private:
+ uint width, height; // سߴ
+ ColorFormat format; // ʽ
+ byte* pixels; //
+ std::size_t size; // ݳ
- void Decode(const AEIO::DataBuffer& buffer) override;
+ //----------------------------------------------------------------------------//
- ///
- /// ڵһ׼image dataʱṩdecoderڼdecodersмѡԡ
- ///
- static std::list<ImageDecoder*> ImageDecoders;
+ private:
+
+ //----------------------------------------------------------------------------//
LUAX_DECL_METHOD(_New);
LUAX_DECL_METHOD(_GetPixel);
@@ -57,6 +59,21 @@ namespace AsuraEngine
LUAX_DECL_METHOD(_GetWidth);
LUAX_DECL_METHOD(_GetHeight);
LUAX_DECL_METHOD(_GetPixelFormat);
+ LUAX_DECL_METHOD(_Decode);
+ LUAX_DECL_METHOD(_DecodeAsync);
+ LUAX_DECL_METHOD(_IsAvailable);
+
+ //----------------------------------------------------------------------------//
+
+ ///
+ /// ڵһ׼image dataʱṩdecoderڼdecodersмѡԡ
+ ///
+ static std::list<ImageDecoder*> ImageDecoders;
+
+ ///
+ /// дݵ
+ ///
+ AEThreading::Mutex mMutex;
};