26 : width(0), height(0), image(0)
52 image =
new(__FILE__,__LINE__) DWORD [pixels];
54 if (
image && pixels) {
55 for (
int i = 0; i < pixels; i++)
72 fopen_s(&f, filename,
"rb");
100 image =
new(__FILE__,__LINE__) DWORD[pixels];
104 for (
int row = height-1; row >= 0; row--) {
105 for (
int col = 0; col <
width; col++) {
106 BYTE index = fgetc(f);
119 image =
new(__FILE__,__LINE__) DWORD[pixels];
123 for (
int row = height-1; row >= 0; row--) {
124 for (
int col = 0; col <
width; col++) {
125 DWORD blue = fgetc(f);
126 DWORD green = fgetc(f);
127 DWORD red = fgetc(f);
129 image[row*width+col] = 0xff000000 | (red << 16) | (green << 8) | blue;
171 image =
new(__FILE__,__LINE__) DWORD[pixels];
175 for (
int row = height-1; row >= 0; row--) {
176 for (
int col = 0; col <
width; col++) {
190 image =
new(__FILE__,__LINE__) DWORD[pixels];
194 for (
int row = height-1; row >= 0; row--) {
195 for (
int col = 0; col <
width; col++) {
200 image[row*width+col] = 0xff000000 | (red << 16) | (green << 8) | blue;
217 fopen_s(&f, filename,
"wb");
232 for (
int row =
height-1; row >= 0; row--) {
233 for (
int col = 0; col <
width; col++) {
234 DWORD pixel =
image[row*width+col];
236 BYTE blue = (BYTE) ((pixel & 0x000000ff) >> 0);
237 BYTE green = (BYTE) ((pixel & 0x0000ff00) >> 8);
238 BYTE red = (BYTE) ((pixel & 0x00ff0000) >> 16);
240 fwrite(&blue, 1, 1, f);
241 fwrite(&green, 1, 1, f);
242 fwrite(&red, 1, 1, f);