From 208e23de77ad6d104f13a0bb591ae16c4a805fe9 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 26 Oct 2021 23:20:45 +0800 Subject: *load image async --- Runtime/FileSystem/ImageJobs.h | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Runtime/FileSystem/ImageJobs.h (limited to 'Runtime/FileSystem/ImageJobs.h') diff --git a/Runtime/FileSystem/ImageJobs.h b/Runtime/FileSystem/ImageJobs.h new file mode 100644 index 0000000..77e48e0 --- /dev/null +++ b/Runtime/FileSystem/ImageJobs.h @@ -0,0 +1,46 @@ +#pragma once +#include +#include "Runtime/Threading/Job.h" +#include "Runtime/Lua/LuaHelper.h" +#include "Runtime/Threading/JobSystem.h" + +struct ImageDataBridge +{ + void* pixels; + int width; + int height; + int channels; +}; + +// in: string +// out: ImageData +class ReadImageFileJob : public Job +{ +public: + ReadImageFileJob(LuaBind::VM* vm, int indexOfCallback, const char* path); + ~ReadImageFileJob(); + + void Dispacth(void* param) override; + void Process() override; + bool IsFinished() override; + +private: + std::string path; + bool isFinished; + ImageDataBridge bridge; + LuaBind::StrongRef callback; // 完成后的回调函数 +}; + +// in: string[] +// out: ImageData[] +class ReadImageFilesJob : public Job +{ + +}; + +// in: DataBuffer[] +// out: ImageData[] +class DecodeImageFilesJob : public Job +{ + +}; \ No newline at end of file -- cgit v1.1-26-g67d0