-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIcon.hpp
156 lines (138 loc) · 3.85 KB
/
Icon.hpp
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#ifndef ICON_HPP
#define ICON_HPP
#define INCL_GPIBITMAPS
#define INCL_GPI
#include <os2.h>
#include "IconsVar.hpp"
#include "IconImage.hpp"
static inline int calcStride(int w, int bpp)
{
int stride;
// Convert pixel to bits
stride = w * bpp;
// Conver to bytes
stride = (stride + 7) / 8;
// Align with 4 bytes boundary
stride = (stride + 3) & ~3;
return stride ;
}
static inline int calcImageSize(int w, int h, int bpp)
{
return calcStride(w, bpp) * h;
}
struct IconError{
const char* msg;
const char* function;
const char* file;
unsigned long line;
};
class Icon{
public:
virtual int getAlto() = 0;
virtual int getAncho() = 0;
private:
int identidad;
};
class WinIcon:public Icon{
public:
WinIcon(){}
int getAlto();
int getAncho();
private:
int nImagen;
};
class Os2Icon:public Icon{
public:
Os2Icon(){
iafh = new IconAFH;
ibfh = new IconBFH;
ibih = new IconBIH;
Mibih= new IconBIH;
};
int getAlto(){return 0;};
int getAncho(){return 0;};
int ipow(int b, int e);
ULONG sizePaleta();
ULONG getSizeImage();
IconBIH* getIbih();
void setDataImage(PBYTE datos, int tamanio);
void setDataImage(PBYTE data){pImgData = data;};
PBYTE getDataImage(){ return pImgData; };
void setMaskData(PBYTE datos);
PBYTE getMaskData(){ return pMaskData; };
int getMaskSize(){return maskSize;};
USHORT getBitsXPixel(){return ibih->getCBitCount();};
int getNumBitsColores(){return numColores;};
void setNumBitsColores(int bits){numColores = bits;};
IconBIH *ibih;
IconBIH *Mibih;
IconBFH *ibfh;
IconAFH *iafh;
protected:
int paletaSizeBW;
int paletaSizeColor;
int maskSize;
bool fSoloONo;
int dataSize;
private:
ULONG getSizeMaskImage();
int numColores;
PBYTE pImgData;
PBYTE pMaskData;
};
class Os2Icon12:public Os2Icon{
public:
Os2Icon12(){
bih = new BITMAPINFOHEADER;
pArray = new BITMAPARRAYFILEHEADER;
pHead = new BITMAPFILEHEADER;
};
Os2Icon12(IconImage *imagenWin);
ULONG getSizePicture();
RGB *getPPaletaBW(int i){ return pPaletaBW;};
BITMAPARRAYFILEHEADER* getPArray(){ return pArray; };
BITMAPFILEHEADER* getPHead(){ return pHead; };
RGB *getPPaletaColor(){ return pPaletaColor;};
int getAlto();
int getAncho(){return pHead->bmp.cx;};
void setPArray(BITMAPARRAYFILEHEADER *pArrayIn){pArray = pArrayIn;};
void setPHead(BITMAPFILEHEADER *pHeadIn){pHead = pHeadIn;};
void setPaletaBW(RGB *paletaIn){pPaletaBW = paletaIn;};
void setPPaletaColor(RGB *paletaIn){pPaletaColor = paletaIn;};
private:
void convPal(RgbQuad *bpaleta, int colores);
int setArray();
int setXorAnd(IconImage *datos);
int setPalBW();
int setDatos(IconImage *datos);
BITMAPARRAYFILEHEADER *pArray;
BITMAPINFOHEADER *bih;
BITMAPFILEHEADER *pHead;
RGB *pPaletaBW;
RGB *pPaletaColor;
};
class Os2Icon20:public Os2Icon{
public:
Os2Icon20(){
bih = new BITMAPINFOHEADER2;
pArray = new BITMAPARRAYFILEHEADER2;
pHead = new BITMAPFILEHEADER2;
};
ULONG getSizePicture();
RGB2 *getPPaletaBW(int i){ return pPaletaBW;};
BITMAPARRAYFILEHEADER2* getPArray(){ return pArray; };
BITMAPFILEHEADER2* getPHead(){ return pHead; };
RGB2 *getPPaletaColor(){ return pPaletaColor;};
private:
void convPal(RgbQuad *bpaleta, int colores);
int setArray();
int setXorAnd(IconImage *datos);
int setPalBW();
int setDatos(IconImage *datos);
BITMAPARRAYFILEHEADER2 *pArray;
BITMAPINFOHEADER2 *bih;
BITMAPFILEHEADER2 *pHead;
RGB2 *pPaletaBW;
RGB2 *pPaletaColor;
};
#endif