-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBitmapPicker.h
More file actions
38 lines (32 loc) · 831 Bytes
/
BitmapPicker.h
File metadata and controls
38 lines (32 loc) · 831 Bytes
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
#pragma once
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstdint>
#include <string>
using namespace std;
#define ConvLE_uint32(BIN, I) ((uint32_t)BIN[I] + ((uint32_t)BIN[I + 1] << 8) + ((uint32_t)BIN[I + 2] << 16) + ((uint32_t)BIN[I + 3] << 24))
#define ConvLE_uint16(BIN, I) (uint16_t)((uint16_t)BIN[I] + ((uint16_t)BIN[I + 1] << 8))
typedef struct BitmapHeader
{
uint32_t size;
uint32_t offBits;
uint32_t width, height;
uint16_t bitCount;
} BitmapFileHeader;
class BitmapPicker
{
string path;
BitmapHeader header;
unsigned char *data;
public:
BitmapPicker(string bmpfile);
~BitmapPicker();
int Width();
int Height();
void Pick(int size, int x, int y, unsigned char result[]);
private:
BitmapPicker(BitmapPicker &);
BitmapPicker &operator =(const BitmapPicker &);
void LoadImage();
};