-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmp_tcx.h
43 lines (43 loc) · 1.37 KB
/
bmp_tcx.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
#pragma once
class CBMP32x
{public:
unsigned short int Signature;
unsigned int FileLength;
unsigned int Zero;
unsigned int Ptr;
unsigned int Version;
int Width;
int Height;
unsigned short int Planes;
unsigned short int BitsPerPixel;
unsigned int Compression;
unsigned int SizeImage;
unsigned int XPelsPerMeter;
unsigned int YPelsPerMeter;
unsigned int ClrUsed;
unsigned int ClrImportant;
unsigned char pal[256][4];
int CheckTmp;
//do not include pointers up to this line
union
{
unsigned int **v;
unsigned char (**c)[4];
};
unsigned int **g;
unsigned int **bg;
unsigned int *t,*t2;
CBMP32x(){SetZero();}
CBMP32x(int nx,int ny,unsigned char InitialValueR=255,unsigned char InitialValueG=255,unsigned char InitialValueB=255);//{SetZero();Width=nx;Height=ny;v=(unsigned int**)allocate_2D_Arrayx(Height,Width,4,1);}
CBMP32x(const char *sf){SetZero();Load(sf);}
CBMP32x(const CBMP32x &b){SetZero();CopyOnly(b);}
~CBMP32x(){Clean();}
void SetZero(){v = 0;g = 0;t = 0;t2 = 0;bg = 0;}
void Clean(){if(v != 0) { delete[] v; delete[] g; delete[] t; delete[] t2; delete[] bg; SetZero(); } }
int Load(const char *sf,double k=1);
int Save(const char *sf);
void MakeGrayFromColor();
void MakeColorFromGray();
CBMP32x &operator=(const CBMP32x &b);
void CopyOnly(const CBMP32x &b);
};