blob: cd2fe1a29abea6c301023ebfa89facd10866f080 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#ifndef _ASURA_ENGINE_IMAGEDATA_H_
#define _ASURA_ENGINE_IMAGEDATA_H_
#include <list>
#include <asura-utils/Scripting/Portable.hpp>
#include <asura-utils/IO/DecodedData.h>
#include <asura-utils/IO/DataBuffer.h>
#include <asura-utils/Threads/Thread.h>
#include <asura-utils/Threads/Mutex.h>
#include "../Graphics/Texture.h"
#include "../Graphics/Color.h"
namespace_begin(AsuraEngine)
namespace_begin(Image)
class ImageDecoder;
class ImageData ASURA_FINAL
: public Scripting::Portable<ImageData>
, public AEIO::DecodedData
{
public:
///
/// ͼƬļϢʧܣ׳쳣
///
ImageData();
~ImageData();
void Decode(AEIO::DataBuffer& buffer) override;
void Lock();
void Unlock();
AEGraphics::Color GetPixel(uint x, uint y);
//----------------------------------------------------------------------------//
uint width, height; // سߴ
AEGraphics::ColorFormat format; // ʽ
byte* pixels; //
std::size_t size; // ݳ
//----------------------------------------------------------------------------//
private:
///
/// ڵһimage dataʱṩdecoderڼdecodersмѡԡ
///
static std::list<ImageDecoder*> ImageDecoders;
///
/// дݵ
///
AEThreading::Mutex m_Mutex;
luaxport:
LUAX_DECL_FACTORY(ImageData);
LUAX_DECL_METHOD(_New);
LUAX_DECL_METHOD(_GetPixel);
LUAX_DECL_METHOD(_GetSize);
LUAX_DECL_METHOD(_GetWidth);
LUAX_DECL_METHOD(_GetHeight);
LUAX_DECL_METHOD(_GetPixelFormat);
LUAX_DECL_METHOD(_Decode);
LUAX_DECL_METHOD(_DecodeAsync);
LUAX_DECL_METHOD(_IsAvailable);
};
namespace_end
namespace_end
namespace AEImage = AsuraEngine::Image;
#endif
|