
i'm trying to create a 256-color bitmap. when i do it with libgfl functions everything is fine, the code:
Code: Select all
GFL_BITMAP *b2 = gflAllockBitmap(GFL_COLORS, wh+2*margin, wh+2*margin, 4, NULL);
GFL_COLORMAP cm2;
cm2.Red[0]=0; cm2.Green[0]=0; cm2.Blue[0]=0;
cm2.Red[1]=255; cm2.Green[1]=255; cm2.Blue[1]=255;
cm2.Red[2]=255; cm2.Green[2]=0; cm2.Blue[2]=0;
b2->ColorMap = &cm2;
GFL_COLOR black1 = {0,0,0,0};
GFL_COLOR white1 = {255,255,255,0};
GFL_COLOR red1 = {255,0,0,0};
gflSetColorAt(b2, 0, 0, &black1);
gflSetColorAt(b2, 1, 0, &white1);
gflSetColorAt(b2, 2, 0, &red1);
GFL_SAVE_PARAMS sp1;
gflGetDefaultSaveParams(&sp1);
sp1.FormatIndex = gflGetFormatIndexByName("bmp");
e = gflSaveBitmap("b.bmp", b2, &sp1);
Code: Select all
GFLC_BITMAP b1(GFL_COLORS, wh+2*margin, wh+2*margin, 4);
GFL_COLORMAP cm1;
cm1.Red[0]=0; cm1.Green[0]=0; cm1.Blue[0]=0;
cm1.Red[1]=255; cm1.Green[1]=255; cm1.Blue[1]=255;
cm1.Red[2]=255; cm1.Green[2]=0; cm1.Blue[2]=0;
b1.getColorMap().set(&cm1);
GFLC_COLOR black(0,0,0);
GFLC_COLOR white(255,255,255);
GFLC_COLOR red(255,0,0);
b1.setPixel(0,0,black);
b1.setPixel(1,0,white);
b1.setPixel(2,0,red);
b1.saveIntoFile("a.bmp", "bmp");
gflGetVersion() = 2.71
gflGetVersionOfLibformat() = 4.79