This repository has been archived by the owner on Jul 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Crest.h
70 lines (53 loc) · 1.37 KB
/
Crest.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once
class Crest;
typedef shared_ptr<Crest> CrestPtr;
class CrestLoader;
typedef shared_ptr<CrestLoader> CrestLoaderPtr;
class CrestSource;
typedef shared_ptr<CrestSource> CrestSourcePtr;
class CrestSource : public enable_shared_from_this<CrestSource>
{
public:
explicit CrestSource(LPCTSTR);
static vector<CrestSourcePtr> Enumerate();
HRESULT Load();
vector<CrestPtr> Scan();
private:
static const TCHAR DIRECTORY[];
static const TCHAR WILDCARD[];
tstring m_path;
LARGE_INTEGER m_size;
unique_ptr<BYTE, MappedViewDeleter<BYTE>> m_data;
};
class CrestLoader
{
public:
HRESULT Initialize();
IDirect3DDevice9Ex* GetDevice() const { return m_dev; };
IWICImagingFactory* GetWIC() const { return m_wic; };
private:
CComPtr<IDirect3D9Ex> m_d3d;
CComPtr<IDirect3DDevice9Ex> m_dev;
CComPtr<IWICImagingFactory> m_wic;
};
class Crest
{
public:
Crest(const CrestSourcePtr&, LPCTSTR, const BYTE*, DWORD);
const tstring& GetName() const { return m_name; }
static vector<CrestPtr> Enumerate(const CrestLoaderPtr&);
void SetLoader(const CrestLoaderPtr&);
bool CanLoad() const;
HRESULT Load();
void Disconnect();
HRESULT CreateBitmap(UINT, UINT, HBITMAP*);
HRESULT GetImage(IImageList*, int);
HRESULT Save(IStream*);
private:
CrestSourcePtr m_source;
CrestLoaderPtr m_loader;
tstring m_name;
const BYTE* m_data;
DWORD m_size;
CComPtr<IWICBitmap> m_bitmap;
};