-
Notifications
You must be signed in to change notification settings - Fork 0
/
lode_png.h
48 lines (41 loc) · 1.6 KB
/
lode_png.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
//********************************************************************
// Copyright (c) 2014 Daniel D Miller
// This class encapsulates the interface to the LodePNG library.
//********************************************************************
#include <vector>
//lint -esym(1714, LodePng::render_bitmap, LodePng::horiz_tiles, LodePng::vert_tiles)
//lint -esym(1714, LodePng::LodePng)
//lint -esym(1704, LodePng::LodePng)
class LodePng {
private:
std::vector<unsigned char> bmp ;
std::vector<unsigned char> img ;
char *img_name ;
HBITMAP hBitmap ;
uint sprite_dx ;
uint sprite_dy ;
uint tiles_x ;
uint tiles_y ;
// private functions
void encodeBMP(std::vector<unsigned char>& bmp, const unsigned char* image, int w, int h);
HBITMAP ConvertDibToHBitmap(void* bmpData);
HBITMAP load_png_to_bmp(void);
// disable the assignment operator and copy constructor
LodePng &operator=(const LodePng &src) ;
LodePng(const LodePng&);
// disable the default constructor
LodePng() ;
public:
// LodePng();
LodePng(char *new_img_name) ;
LodePng(char *new_img_name, uint dx, uint dy) ;
~LodePng();
void render_bitmap(HDC hdc, unsigned x, unsigned y);
// void render_bitmap(HDC hdc, uint xdest, uint ydest, uint xsrc, uint ysrc);
void render_bitmap(HDC hdc, uint xdest, uint ydest, uint sprite_col, uint sprite_row);
void render_bitmap(HDC hdc, uint xdest, uint ydest, uint tile_index);
uint horiz_tiles(void) const
{ return tiles_x ; } ;
uint vert_tiles(void) const
{ return tiles_y ; } ;
} ;