Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Mal wieder CopyRect (https://www.delphipraxis.net/76805-mal-wieder-copyrect.html)

zyrano80 10. Sep 2006 11:54


Mal wieder CopyRect
 
Hallo,

habe eben schon einmal geschrieben, die Elektronik hat das anscheinend verschluckt. Also habe jetzt mehrere Stunden erfolglos mit CopyRect probiert, die bereits vorhandenen Threads dazu halfen mir nicht. Wäre super, falls ihr mir helft.

Da ich jetzt nicht alles noch einmal schreiben will die Kurzfornm: Also ich lasse in eine Canvas mehrere Bitmaps zeichnen, danach möchte ich von dieser Canvas ein Thumbnail anlegen. Das Thumbnail lasse ich mir als Bild testweise anzeigen. Allerdings bleibt es immer komplett schwarz, weiß jemand woran das liegt. Code siehe unten, allerdings nur der fragliche Abschnitt. Bevor weitere Anmerkungen dazu kommen: die canvas-objekte sind beide mit create instanziert, das porgramm läuft ansonsten fehlerfrei und wird asuch ohne fehlermeldungen kompiliert.

bild_thumbnail.Canvas.Create;
rec_bild :=bounds(0,0, bild.Canvas.Width, bild.Canvas.Height);
rec_thumbnail :=bounds(bild_thumbnail.Left,bild_thumbnail.Top, bild_thumbnail.Width,
bild_thumbnail.Height);
bild_thumbnail.Canvas.CopyRect(rec_thumbnail, bild.canvas,rec_bild);

Vielen Dank im Voraus, gruß zyrano80

PS.: Auf Funktionen der win32-Api würde ich dabei gerne verzichten

Namenloser 10. Sep 2006 11:58

Re: Mal wieder CopyRect
 
Zitat:

Zitat von zyrano80
bild_thumbnail.Canvas.Create;

Diese Zeile tut nix. Es muss heißen:
bild_thumbnail.canvas := TCanvas.Create;

Wenn bild_thumbnail ein bitmap ist:

bild_thumbnail := TBitmap.Create;

zyrano80 10. Sep 2006 12:10

Re: Mal wieder CopyRect
 
Ok,

danke für den Hinweis, allerdings erhalte ich jetzt den Compilerfehler "No member is provided to access property" . bild_thumbnail ist vom Typ TImage.

Gruß zyrano

DGL-luke 10. Sep 2006 12:15

Re: Mal wieder CopyRect
 
Delphi-Quellcode:
 bild_thumbnail.Canvas.Create;
falsch.
das canvas wird automatisch erzeugt, wenn das bild ausmaße größer (0,0) hat.

Delphi-Quellcode:
rec_bild :=bounds(0,0, bild.Canvas.Width, bild.Canvas.Height);
falsch.
angenommen, das wären TBitmaps, wenn dan soo:
Delphi-Quellcode:
rec_bild.SetBounds(...)
Delphi-Quellcode:
rec_thumbnail :=bounds(bild_thumbnail.Left,bild_thumbnail.Top, bild_thumbnail.Width,
bild_thumbnail.Height);
dito
Delphi-Quellcode:
bild_thumbnail.Canvas.CopyRect(rec_thumbnail, bild.canvas,rec_bild);
falsch. Copyrect skaliert nicht. nimm stretchdraw, müsste bei TBitmap member sein.

Namenloser 10. Sep 2006 12:17

Re: Mal wieder CopyRect
 
Zitat:

Zitat von zyrano80
Ok,

danke für den Hinweis, allerdings erhalte ich jetzt den Compilerfehler "No member is provided to access property" . bild_thumbnail ist vom Typ TImage.

Gruß zyrano

Aso.

DGL-luke 10. Sep 2006 12:19

Re: Mal wieder CopyRect
 
Bei TImage müsstest du auf Picture.TBitmap zugreifen können, WENN ein bitmap vorliegt.

Namenloser 10. Sep 2006 12:28

Re: Mal wieder CopyRect
 
Wenn noch nichts anderes in das TPicture geladen wurde, liegt aber standartmäßig immer ein bitmap vor.

DGL-luke 10. Sep 2006 12:32

Re: Mal wieder CopyRect
 
nö... standardmäßig liegt da überhaupt nix... :gruebel:

EDIT: Stretchdraw kann man ja direkt übers TGraphic laufen lassen, dann is es eh wurscht.


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