summaryrefslogtreecommitdiff
path: root/Runtime/Graphics/ImageData.h
blob: fe26776d196f0816b38c9320b088e2281038a606 (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
#ifndef IMAGE_DATA_H
#define IMAGE_DATA_H

#include <vector>
#include "Runtime/Threading/Job.h"
#include "Runtime/Lua/LuaHelper.h"

enum EPixelFormat
{
	PixelFormat_RGBA,
	PixelFormat_RGB,
	PixelFormat_R,
	PixelFormat_RG,
	PixelFormat_BGR,
	PixelFormat_BGRA
};

enum EPixelElementType
{
	PixelType_UNSIGNED_BYTE,
	PixelType_UNSIGNED_INT,
	PixelType_BYTE,
	PixelType_INT,
	PixelType_FLOAT,
};

// 图片像素数据
class ImageData : public LuaBind::NativeClass<ImageData>
{
public:
    ImageData(LuaBind::VM* vm) 
        : LuaBind::NativeClass<ImageData>(vm) 
    {
    }

    void* pixels; // 像素数据,格式和类型参考 http://docs.gl/gl3/glTexImage2D pixel data的format和type
    EPixelFormat format;
    EPixelElementType type;
    int width, height;

private:
    LUA_BIND_DECL_CLASS(ImageData);

    LUA_BIND_DECL_METHOD(_GetWidth);
    LUA_BIND_DECL_METHOD(_GetHeight);
    LUA_BIND_DECL_METHOD(_GetSize);
};

#endif