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 CopyRect und CopyMode (https://www.delphipraxis.net/93287-copyrect-und-copymode.html)

bidi 3. Jun 2007 20:57


CopyRect und CopyMode
 
Hallo!

Ich würde gern eine Monochrom-Bitmap mittels OR auf eine andere kopieren. Nach studium der Hilfe war ich der Meinung, dass es so gehen müßte:
Delphi-Quellcode:
with image6.Picture.Bitmap do
    begin
      Canvas.CopyMode := cmSrcPaint;
      Canvas.CopyRect(Rect(0,0,Width,Height),Image5.Picture.Bitmap.Canvas,Rect(0,0,Width,Height));
    end;
Tut es aber nicht. Das gewünschte Ergebniss lieftert folgender Code, allerdings viel zu langsam:
Delphi-Quellcode:
    for a := 0 to Image2.Picture.Bitmap.Height-1 do
      for b := 0 to Image2.Picture.Bitmap.Width-1 do
        if Image5.Picture.Bitmap.Canvas.Pixels[b,a] = clBlack then Image6.Picture.Bitmap.Canvas.Pixels[b,a] := clBlack;
Warum funktioniert also die 1. Variante nicht? Was mache ich da falsch?

MfG
bidi

Hawkeye219 3. Jun 2007 21:21

Re: CopyRect und CopyMode
 
Hallo bidi,

nach deiner Beschreibung würde ich den Operator AND erwarten:

Delphi-Quellcode:
with Image6.Picture.Bitmap do
begin
  Canvas.CopyMode := cmSrcAnd;
  Canvas.Draw (0, 0, Image5.Picture.Bitmap);
end;
Gruß Hawkeye


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:01 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