![]() |
AW: Größe in TImage
you have to change... is an Idea but can be wrong :zwinker:
Delphi-Quellcode:
var aPicture:TBitmap;
PictureName:string; aSourceRect:TRect; aDestinationRect; begin aPicture:=TBitmap.Create; try aPicture.Width:=100; // your cutted Size aPicture.Height:=100; // your cutted Size aDestinationRect:= (0,0,100,100); aSourceRect:=Rect(100,200,200,300); // your cutted Rect aPicture.Canvas.CopyRect(aDestinationRect, YourPaintBox.Canvas, aSourceRect); // Copy the Rect from the Paintbox to the Image PictureName:= 'MyPicture'; // define the Name aPicture.SaveToFile('YourFolder\' + PictureName + '.bmp'); finally aPicture.free; end |
AW: Größe in TImage
A short test:
Delphi-Quellcode:
As said before: Canvas.Pixels is quite slow, ScanLine is much faster, but you have to do some work yourself ;)
procedure TFormTest.Button1Click(Sender: TObject);
var XIndex, YIndex, XMin, XMax, YMin, YMax: integer; begin XMin := PaintBox1.ClientWidth; YMin := PaintBox1.ClientHeight; XMax := 0; YMax := 0; for YIndex := 0 to PaintBox1.ClientHeight - 1 do for XIndex := 0 to PaintBox1.ClientWidth - 1 do if PaintBox1.Canvas.Pixels[XIndex, YIndex] <> PaintBox1.Canvas.Brush.Color then begin if XIndex < XMin then XMin := XIndex; if YIndex < YMin then YMin := YIndex; if XIndex > XMax then XMax := XIndex; if YIndex > YMax then YMax := YIndex; end; PaintBox1.Canvas.Brush.Style := bsClear; PaintBox1.Canvas.Pen.Color := clBlue; PaintBox1.Canvas.Rectangle(XMin - 1, YMin - 1, XMax + 2, YMax + 2); end; |
AW: Größe in TImage
@DeddyH: Er hat den Ausschnitt, weiß nur nicht wie er ihn rauskriegt und in eine Datei ablegt... denke ich mal 8-)
|
AW: Größe in TImage
Dann lies #8 nochmal genau durch ;)
|
AW: Größe in TImage
ok... ich habe das "once" überlesen :oops: Aber mit beiden kann er was anfangen...
|
AW: Größe in TImage
I'm sorry, but I do not understand.
Where can I get the position Min_Top, Max_Top, Min_Left, Max_Left? The presented examples only draws me around the entire frame Paintbox and nothing else. We could use a Record? |
AW: Größe in TImage
Your Min_Top is my YMin and so on. Maybe the comparison in my example does not fit, you should check this.
|
AW: Größe in TImage
I love programming in Delphi and you are also friends.
The procedure was correct, but it wants to communicate with Paintbox, but only in the Image. A special thank you "DeddyH" :thumb: |
AW: Größe in TImage
No problem :)
|
AW: Größe in TImage
:thumb:
Please change your Delphi Version in your Profile... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:18 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz