Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Bitmap-Brush.Color Änderung hat keinen Effekt (https://www.delphipraxis.net/122829-bitmap-brush-color-aenderung-hat-keinen-effekt.html)

zarcaphii 22. Okt 2008 19:18


Bitmap-Brush.Color Änderung hat keinen Effekt
 
Hallo leibe Gemeinde.

Ich male im Moment mit Fingerfarben (MoveTo, LineTo) auf einigen Bitmaps rum. Habe auch schon TImage ausprobiert, da sitzt ja auch eine Bitmap hinter.

Mein Problem ist, dass ich die Zeichenfarbe zwar ändern kann, dies keinerlei Auswirkungen hat... Habe ich beim Brush vielleicht noch etwas zu beachten?

Hier mal der Code:
Delphi-Quellcode:
 
  fBitmap:=TBitmap.Create;
  fBitmap.Monochrome:=false;
  fBitmap.Height:=480;
  fBitmap.Width:=640;

  fBitmap.Canvas.Brush.Color:=clRed;
  //Debugger zeigt: Wert von Color ist jetzt 255 (--> 00,00,FF), passt

  fBitmap.Canvas.MoveTo(0,0);
  fBitmap.Canvas.LineTo(639,479);

  fBitmap.Canvas.Brush.Color:=clWhite;
  //Debugger zeigt: Wert von Color ist jetzt 16777215 (--> FF,FF,FF), passt

  fBitmap.Canvas.MoveTo(0,0);
  fBitmap.Canvas.LineTo(639,479);

  fBitmap.SaveToFile('C:/test.bmp');
  //test.bmp zeigt eine schwarze Diagonale auf weißem Grund

  Image.Picture.Bitmap:=Bitmap;
  //Anzeige auf der Form wie test.bmp
Ich vermute, dass es nur eine Kleinigkeit ist. Übrigens benutze ich Turbo Delphi.

Vielen Dank schonmal bis hier hin fürs Lesen. Ein passender Vorschlag wäre toll :cheers:

DeddyH 22. Okt 2008 19:21

Re: Bitmap-Brush.Color Änderung hat keinen Effekt
 
Setz statt Brush.Color mal Pen.Color.

zarcaphii 22. Okt 2008 19:24

Re: Bitmap-Brush.Color Änderung hat keinen Effekt
 
-.- Kleinigkeit, ich bin Hellseher.

Vielen Dank, das wars!

Wozu ist denn Brush da, wenn der Pen zu malen benutzt wird?

DeddyH 22. Okt 2008 19:32

Re: Bitmap-Brush.Color Änderung hat keinen Effekt
 
Brush.Color ist die Füllfarbe, Pen.Color die Malfarbe, mal lax ausgedrückt. In der OH steht aber in der Regel, welche Farbe bei welcher Methode zum Einsatz kommt.


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:25 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz