falsche werte werden mit scanline geschrieben
-
kann mir jemand sagen wieso mit nachfolgendem code zwar bei i=0 ein schwarzes bitmap erzeugt wird, jedoch mit i=1 das bitmap den wert 43 beinhaltet?
for(int i = 0 ; i < 256 ; i++) { Graphics::TBitmap *smallImg = new Graphics::TBitmap(); smallImg->Width = 10; smallImg->Height = 14; smallImg->PixelFormat = pf8bit; unsigned char *ptr; int x=0, y=0; ptr = static_cast<BYTE*>(smallImg->ScanLine[y]); for(int j=0; j < (smallImg->Height * smallImg->Width); j++) { if(x == smallImg->Width) { y++; x = 0; ptr = static_cast<BYTE*>(smallImg->ScanLine[y]); } ptr[x]= (BYTE) colorValue; x++; } colorValue++; smallImg->Palette = grayPal; smallImg->SaveToFile("clusterColor_" + IntToStr(i) + ".bmp"); images->Insert(i, smallImg, NULL); }