summaryrefslogtreecommitdiff
path: root/Runtime/FileSystem/ImageJobs.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-26 23:20:45 +0800
committerchai <chaifix@163.com>2021-10-26 23:20:45 +0800
commit208e23de77ad6d104f13a0bb591ae16c4a805fe9 (patch)
tree29499de463a6d3407d2e555c1ad9b743f07097b1 /Runtime/FileSystem/ImageJobs.h
parent8b419dc90cb4e01fa1810e0f84dcdcfe2bd822ad (diff)
*load image async
Diffstat (limited to 'Runtime/FileSystem/ImageJobs.h')
-rw-r--r--Runtime/FileSystem/ImageJobs.h46
1 files changed, 46 insertions, 0 deletions
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 <vector>
+#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