-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBitmapHandle.h
56 lines (43 loc) · 1.28 KB
/
BitmapHandle.h
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
50
51
52
53
54
55
56
#pragma once
#include "module/ModuleItem.h"
#include "Item.h"
#include <memory>
#include <vector>
#include <stdint.h>
#include "logger/logger.h"
#include <detex.h>
//NOTE: the mipmap level runs opposite to the resource index. MipMap 0 is the largest, but it uses the resource chunk with the highest index
class MipMap{
public:
uint8_t level;
uint16_t width;
uint16_t height;
};
class Frame{
public:
uint32_t width;
uint32_t height;
uint16_t format;
uint32_t mipmapCount;
Item* item;
std::vector<MipMap> mipMaps;
// get the raw data of this bitmap. Will need to be converted/decompressed for most usecases
// the returned buffer is allocated, so it has to be freed
void* getData(uint8_t level); // level: Mipmap level, starting at 0
// get the data of this bitmap in R8G8B8A8 format. This could lead to precision loss, but is the most useful for general applications
// the returned buffer is allocated, so it has to be freed
void* getR8G8B8A8Data(uint8_t level);
// return.data is allocated and has to be freed
detexTexture getDetexTexture(uint8_t level);
};
class BitmapHandle{
public:
BitmapHandle(ModuleItem* moduleItem, Logger* logger);
~BitmapHandle();
uint32_t frameCount;
std::vector<Frame> frames;
private:
ModuleItem* moduleItem;
Item* item;
Logger* logger;
};