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 Problem mit Stretchblt (https://www.delphipraxis.net/136240-problem-mit-stretchblt.html)

R2009 26. Jun 2009 05:25


Problem mit Stretchblt
 
Hi,

warum funktioniert Stretchblt nicht wenn ich als Ziel image1.picture.bitmap angebe?
Nutze ich statt image1 den canvas einer Form funktioniert das einwandfrei.
( t ist als tbitmap deklariert und create ist aufgerufen).

Delphi-Quellcode:
  image1.picture.bitmap.Width:=500;image1.picture.bitmap.Height:=500;
  stretchblt(image1.picture.bitmap.handle,
    200,200,image1.picture.bitmap.width,image1.picture.bitmap.height,
    t.canvas.handle,
    100,100,t.width,t.height,
    SRCCOPY);
Vielen Dank im Vorraus!

R2009 26. Jun 2009 05:38

Re: Problem mit Stretchblt
 
Hi,

so funktioniert das Ganze. Ist mit aber nicht klar warum.

Delphi-Quellcode:
  image1.picture.bitmap.Width:=500;image1.picture.bitmap.Height:=500;
  stretchblt(image1.canvas.handle,
    0,0,sb1.position,sb1.position,//image1.picture.bitmap.width,image1.picture.bitmap.height,
    t.canvas.handle,
    100,100,t.width,t.height,
    SRCCOPY);
Der einzige Unterschied besteht darin dass ich einmal das handle der Bitmap als Ziel angebe und das andere Mal den Canvas von Image.

Kann mir jemand auf die Sprünge helfen?

Vielen Dank im Vorraus!

turboPASCAL 26. Jun 2009 06:08

Re: Problem mit Stretchblt
 
Zitat:

( t ist als tbitmap deklariert und create ist aufgerufen).
Ist es auch in Höhe und Breite initialisiert ?

jfheins 26. Jun 2009 09:21

Re: Problem mit Stretchblt
 
Sowohl ein Bitmap als auch ein Canvas haben ein Handle, für Stretchblt kannst du aber nur das Handle von einem Canvas benutzen! Bitmpa.Handle <> Bitmap.Canvas.Handle

Auch wenn beide in Delphi den gleichen Typ haben und zuweisungskompatibel sind, ist das eine ein HDC und das andere ein HBITMAP ;)

R2009 26. Jun 2009 10:59

Re: Problem mit Stretchblt
 
Hi,

ich bin ja soo doof!
Hätte ich auch selbst drauf kommen können!

Danke!


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