summaryrefslogtreecommitdiff
path: root/Runtime/FileSystem/ImageJobs.h
blob: 77e48e0190b5a311bae4cb6c4f9b25614b30d599 (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
#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
{

};