-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCBmpFile.h
More file actions
60 lines (45 loc) · 1.13 KB
/
CBmpFile.h
File metadata and controls
60 lines (45 loc) · 1.13 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
// $Id: CBmpFile.h,v 1.1 2008/03/29 03:13:43 samn Exp $
// CBmpFile is Copyright (c)1998 Jonathan Nix
// All Rights Reserved.
#pragma once
#include <Windows.h>
#include <mmsystem.h> // incase MFC
// This lib supports 24bpp and only 24bpp.
// You can convert to other formats using the GDI.
struct PIXEL
{
BYTE red, green, blue;
};
typedef PIXEL *LPRGB;
class CBmpFile
{
public:
BITMAPINFO* GetBitmapInfo();
int GetFileSize();
int GetBpp();
int Width(); // Pixels...
int Height();
CBmpFile();
CBmpFile(LPSTR szFilename);
~CBmpFile();
bool Load(LPSTR szFilename);
bool Load(HANDLE hFile);
bool Load(BITMAPINFOHEADER* p);
bool Save(LPSTR szFilename);
bool Save(HANDLE hFile);
LPRGB GetRGB();
bool IsValid() { return m_nIsValid==1; }
DWORD GetNumPixels() { return m_nNumPixels; }
BOOL Maskify(PIXEL rgbBkgColor);
BOOL BlueScreen(PIXEL rgbSetTo, PIXEL rgbThreshold);
HBITMAP CreateHandle(HDC hDC);
protected:
int m_nNumPixels;
void Init();
void Destroy();
int m_nIsValid;
BITMAPFILEHEADER m_bmFileHeader;
BITMAPINFOHEADER m_bmInfoHeader;
LPRGB m_pRGB;
private:
};