leeres bitmap erstellen
-
Wie kann ich ein leeres bitmap erstellen, das eine bestimmte höhe und breite hat?
Danke mattias.
-
guge doch di hilfe zu TBitmap an.
-
Die hab ich mir angeschaut, ich werde aber nicht ganz schlau daraus.
-
Graphics::TBitmap* neues_bitmap = new Graphics::TBitmap; neues_bitmap -> Width = 35; neues_bitmap -> Height = 35; delete neues_bitmap;
und wenn dus jetzt schwarz oder weiss füllen willst schau dir mal CopyRect mit Copymode cmBlackness oder cmWhiteness an.
-
Das hab ich zuvor schon ähnlich gemacht, ich habe aber eine AccessViolation zurückbekommen.
Graphics::TBitmap *cPicture = new Graphics::TBitmap(); PRGBTriple ptr; cPicture->Height = rows; cPicture->Width = cols; for(int y=0; y<cPicture->Height; y++) { ptr = (PRGBTriple) cPicture->ScanLine[y]; for(int x=0; x<cPicture->Width; x++) { ptr[x].rgbtBlue = 1; ptr[x].rgbtGreen = 1; ptr[x].rgbtRed = 10; } }
Kann es sein, dass das Objekt noch nicht erzeugt worden ist?
-
Ne das passt schon, du solltest dir die for-Schleifen aber nochmal anschauen
-
delete nicht vergessen!