diff options
Diffstat (limited to 'source/modules/asura-core/graphics/binding')
-rw-r--r-- | source/modules/asura-core/graphics/binding/_image.cpp | 42 | ||||
-rw-r--r-- | source/modules/asura-core/graphics/binding/_image_data.cpp | 43 |
2 files changed, 56 insertions, 29 deletions
diff --git a/source/modules/asura-core/graphics/binding/_image.cpp b/source/modules/asura-core/graphics/binding/_image.cpp index cb008d3..1d43067 100644 --- a/source/modules/asura-core/graphics/binding/_image.cpp +++ b/source/modules/asura-core/graphics/binding/_image.cpp @@ -11,7 +11,7 @@ namespace AsuraEngine { LUAX_REGISTER_METHODS(state, { "New", _New }, - { "Load", _Load }, + { "Refresh", _Refresh }, { "GetWidth", _GetWidth }, { "GetHeight", _GetHeight }, { "GetSize", _GetSize }, @@ -25,66 +25,52 @@ namespace AsuraEngine } - // image = Image.New() + // Image.New() LUAX_IMPL_METHOD(Image, _New) { LUAX_STATE(L); - Image* image = new Image(); - image->PushLuaxUserdata(state); return 0; } - // successed = image:Load(image_data) - LUAX_IMPL_METHOD(Image, _Load) + // image:Refresh() + LUAX_IMPL_METHOD(Image, _Refresh) { LUAX_PREPARE(L, Image); - ImageData* imgdata = state.CheckUserdata<ImageData>(2); - bool loaded = self->Load(imgdata); - state.Push(loaded); - return 1; + return 0; } - // width = image:GetWidth() + // image:GetWidth() LUAX_IMPL_METHOD(Image, _GetWidth) { LUAX_PREPARE(L, Image); - state.Push(self->GetWidth()); - return 1; + return 0; } - // height = image:GetHeight() + // image:GetHeight() LUAX_IMPL_METHOD(Image, _GetHeight) { LUAX_PREPARE(L, Image); - state.Push(self->GetHeight()); - return 1; + return 0; } - // w, h = image:GetSize() + // image:GetSize() LUAX_IMPL_METHOD(Image, _GetSize) { LUAX_PREPARE(L, Image); - Math::Vector2u size = self->GetSize(); - state.Push(size.x); - state.Push(size.y); - return 2; + return 0; } - // color32 = image:GetPixel(x, y) + // image:GetPixel() LUAX_IMPL_METHOD(Image, _GetPixel) { LUAX_PREPARE(L, Image); - uint x = state.CheckValue<uint>(2); - uint y = state.CheckValue<uint>(3); - Color32* c32 = new Color32(self->GetPixel(x, y)); - c32->PushLuaxUserdata(state); - return 1; + return 0; } // image:Render() @@ -96,4 +82,4 @@ namespace AsuraEngine } } -}
\ No newline at end of file +} diff --git a/source/modules/asura-core/graphics/binding/_image_data.cpp b/source/modules/asura-core/graphics/binding/_image_data.cpp index 3ff38f9..ac9473b 100644 --- a/source/modules/asura-core/graphics/binding/_image_data.cpp +++ b/source/modules/asura-core/graphics/binding/_image_data.cpp @@ -1,6 +1,11 @@ +#include <asura-utils/threading/thread.h> +#include <asura-utils/io/data_buffer.h> + #include "../image_data.h" using namespace std; +using namespace AEThreading; +using namespace AEIO; namespace AsuraEngine { @@ -15,7 +20,10 @@ namespace AsuraEngine { "GetSize", _GetSize }, { "GetWidth", _GetWidth }, { "GetHeight", _GetHeight }, - { "GetPixelFormat", _GetPixelFormat } + { "GetPixelFormat", _GetPixelFormat }, + { "Decode", _Decode }, + { "DecodeAsync", _DecodeAsync }, + { "IsAvailable", _IsAvailable } ); } @@ -29,6 +37,7 @@ namespace AsuraEngine { LUAX_STATE(L); + return 0; } // imagedata:GetPixel() @@ -36,6 +45,7 @@ namespace AsuraEngine { LUAX_PREPARE(L, ImageData); + return 0; } // imagedata:GetSize() @@ -43,6 +53,7 @@ namespace AsuraEngine { LUAX_PREPARE(L, ImageData); + return 0; } // imagedata:GetWidth() @@ -50,6 +61,7 @@ namespace AsuraEngine { LUAX_PREPARE(L, ImageData); + return 0; } // imagedata:GetHeight() @@ -57,6 +69,7 @@ namespace AsuraEngine { LUAX_PREPARE(L, ImageData); + return 0; } // imagedata:GetPixelFormat() @@ -64,6 +77,34 @@ namespace AsuraEngine { LUAX_PREPARE(L, ImageData); + return 0; + } + + // imagedata:Decode() + LUAX_IMPL_METHOD(ImageData, _Decode) + { + LUAX_PREPARE(L, ImageData); + + return 0; + } + + // imagedata:DecodeAsync(thread, databuffer, callback) + LUAX_IMPL_METHOD(ImageData, _DecodeAsync) + { + LUAX_PREPARE(L, ImageData); + + Thread* thread = state.CheckUserdata<Thread>(2); + DataBuffer* buffer = state.CheckUserdata<DataBuffer>(3); + + return 0; + } + + // imagedata:IsAvailable() + LUAX_IMPL_METHOD(ImageData, _IsAvailable) + { + LUAX_PREPARE(L, ImageData); + + return 0; } } |