Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Bitmap: Bildgröße ändern (https://www.delphipraxis.net/99830-bitmap-bildgroesse-aendern.html)

KPBecker 18. Sep 2007 13:41


Bitmap: Bildgröße ändern
 
Hallo, Delphi-Praktiker,

ich möchte ein Bitmap gegebener Größe auf andere Größen umrechnen `(kleiner und größer, nicht einfach klippen).
Z.B. von der Kamera kommt 1920 x 1440, das soll auf 640 x 480 gebracht werden. Wie das zu interpolieren wäre ist mir schon klar.

Die Frage hier ist: Gibt es eine vorhandene procedure / Methode in Delphi, die genau dieses macht ?

Vielen Dank,
K.-P. Becker

ken_jones 18. Sep 2007 13:51

Re: Bitmap: Bildgröße ändern
 
Salut, hiermit wäre sowas möglich:

Delphi-Quellcode:
SetStretchBltMode(TrgBMP.Canvas.Handle,HALFTONE);
StretchBlt(TrgBMP.Canvas.Handle,0,0,TrgBMP.Width,TrgBMP.Height,SrcBMP.Canvas.Handle,0,0,SrcBMP.Width,SrcBMP.Height,SRCCOPY);
Gruss,
Ken

KPBecker 18. Sep 2007 13:59

Re: Bitmap: Bildgröße ändern
 
Hallo, Ken,

wo kommen denn diese Funktionen her ? Die Delphi-Hilfe kennt beide nicht. (StretchBlt)

KPB

ken_jones 18. Sep 2007 14:06

Re: Bitmap: Bildgröße ändern
 
Aus der Unit: Windows

und die Delphi Hilfe (aktuell auf meinem NB unter BDS2006) kennt beide Befehle sauber dokumentiert.

Hier ein kleiner Auszug aus der Delphi Hilfe für StretchBlt:

Zitat:

Zitat von Delphi Hilfe
StretchBlt
The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.

BOOL StretchBlt(
HDC hdcDest, // handle to destination DC
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
int nWidthDest, // width of destination rectangle
int nHeightDest, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXOriginSrc, // x-coord of source upper-left corner
int nYOriginSrc, // y-coord of source upper-left corner
int nWidthSrc, // width of source rectangle
int nHeightSrc, // height of source rectangle
DWORD dwRop // raster operation code
);


KPBecker 18. Sep 2007 14:29

Re: Bitmap: Bildgröße ändern
 
Jetzt hab' ich's auch: Windows SDK

Danke,
K.-P. Becker

KPBecker 19. Sep 2007 15:32

Re: Bitmap: Bildgröße ändern
 
Hallo, Delphi-Praktiker,

leider funktioniert das nicht so, wie ich es mir dachte.

Das Programm läßt sich ohne StretchBlt fehlerfrei compilieren.
Baue ich StretchBlt ein, wird dieser Bezeichner nicht erkannt - was zu erwarten ist.

Füge ich 'uses ..., windows' dazu, werden alle mit TBitmap definierten Bezeicher nicht mehr richtig erkannt:
z.B. MyBitmap.Height --> undefinierter Bezeichner
(Wie gesagt, ohne 'uses ..., windows' tritt diese Meldung nicht auf.)

- Ist in windows TBitmap anders definiert ?
- Ist 'windows' nicht die richtige Angabe in uses ?
- Wie kann ich diesen Fehler vermeiden ?

Vielen Dank,
K.-P. Becker

SirThornberry 19. Sep 2007 15:37

Re: Bitmap: Bildgröße ändern
 
das liegt daran das TBitmap in der unit Windows und in der Unit Graphics definiert sind. Die unit die als letztes eingebunden wird ist maßgebend. Du musst also einfachnur dafür sorgen das die unit windows vor der unit graphics aufgeführt ist in den uses

DeddyH 19. Sep 2007 15:38

Re: Bitmap: Bildgröße ändern
 
Oder in der Variablen-Deklaration TBitmap in Graphics.TBitmap ändern.

KPBecker 19. Sep 2007 15:46

Re: Bitmap: Bildgröße ändern
 
Hallo, Jens & Deddy !

1. Was es nicht alles gibt !
2. Woher Ihr das bloß alles wißt !

Besten Dank,
Klaus-Peter


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