-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImage.h
More file actions
94 lines (78 loc) · 1.96 KB
/
Image.h
File metadata and controls
94 lines (78 loc) · 1.96 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#pragma once
#include "config.h"
class Image
{
public:
enum IMAGE_LOAD_TYPE
{
Resource, // 프로젝트 자체에 포함 시킬 이미지
File, // 외부에서 로드할 이미지
Empty, // 자체 생산할 이미지
End
};
typedef struct tagImageInfo
{
DWORD resID; // 리소스의 고유 ID
HDC hMemDC; // 그리기를 주관하는 객체 핸들
HBITMAP hBitmap; // 이미지 정보
HBITMAP hOldBit; // 기존 이미지 정보
HDC hTempDC;
HBITMAP hTempBit;
HBITMAP hOldTemp;
int width; // 이미지 가로 크기
int height; // 이미지 세로 크기
BYTE loadType; // 로드 타입
// 애니메이션 관련
int maxFrameX;
int maxFrameY;
int frameWidth;
int frameHeight;
int currFrameX;
int currFrameY;
tagImageInfo()
{
resID = 0;
hMemDC = NULL;
hBitmap = NULL;
hOldBit = NULL;
width = 0;
height = 0;
loadType = IMAGE_LOAD_TYPE::Empty;
maxFrameX = 0;
maxFrameY = 0;
frameWidth = 0;
frameHeight = 0;
currFrameX = 0;
currFrameY = 0;
}
} IMAGE_INFO, * LPIMAGE_INFO;
private:
IMAGE_INFO* imageInfo;
bool isTransparent;
COLORREF transColor;
public:
// 빈 비트맵 이미지를 만드는 함수
HRESULT Init(int width, int height);
// 파일로부터 이미지를 로드하는 함수
HRESULT Init(const wchar_t* filePath, int width, int height,
bool isTransparent = FALSE, COLORREF transColor = FALSE);
// 파일로부터 이미지를 로드하는 함수
HRESULT Init(const wchar_t* filePath, int width, int height,
int maxFrameX, int maxFrameY,
bool isTransparent = FALSE, COLORREF transColor = FALSE);
// 화면에 출력
void Render(HDC hdc, int destX = 0, int destY = 0);
void Render(HDC hdc, int destX, int destY, int frameIndex, bool isFlip = false);
void FrameRender(HDC hdc, int destX, int destY, int frameX, int frameY, bool isFlip = false);
// 메모리 해제
void Release();
inline HDC GetMemDC() {
if (imageInfo)
{
return imageInfo->hMemDC;
}
return NULL;
}
inline int GetMaxFrameX() { return imageInfo->maxFrameX; }
inline int GetMaxFrameY() { return imageInfo->maxFrameY; }
};