AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Größe in TImage

Ein Thema von danten · begonnen am 19. Feb 2012 · letzter Beitrag vom 19. Feb 2012
Antwort Antwort
Seite 2 von 3     12 3      
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.298 Beiträge
 
Delphi 12 Athens
 
#11

AW: Größe in TImage

  Alt 19. Feb 2012, 14:01
you have to change... is an Idea but can be wrong
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

Geändert von haentschman (19. Feb 2012 um 14:15 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#12

AW: Größe in TImage

  Alt 19. Feb 2012, 14:07
A short test:
Delphi-Quellcode:
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;
As said before: Canvas.Pixels is quite slow, ScanLine is much faster, but you have to do some work yourself
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.298 Beiträge
 
Delphi 12 Athens
 
#13

AW: Größe in TImage

  Alt 19. Feb 2012, 14:14
@DeddyH: Er hat den Ausschnitt, weiß nur nicht wie er ihn rauskriegt und in eine Datei ablegt... denke ich mal
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#14

AW: Größe in TImage

  Alt 19. Feb 2012, 14:16
Dann lies #8 nochmal genau durch
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.298 Beiträge
 
Delphi 12 Athens
 
#15

AW: Größe in TImage

  Alt 19. Feb 2012, 14:19
ok... ich habe das "once" überlesen Aber mit beiden kann er was anfangen...
  Mit Zitat antworten Zitat
danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#16

AW: Größe in TImage

  Alt 19. Feb 2012, 15:08
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?
Daniel

Geändert von danten (19. Feb 2012 um 15:13 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#17

AW: Größe in TImage

  Alt 19. Feb 2012, 15:13
Your Min_Top is my YMin and so on. Maybe the comparison in my example does not fit, you should check this.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#18

AW: Größe in TImage

  Alt 19. Feb 2012, 15:38
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"
Daniel
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#19

AW: Größe in TImage

  Alt 19. Feb 2012, 15:40
No problem
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.298 Beiträge
 
Delphi 12 Athens
 
#20

AW: Größe in TImage

  Alt 19. Feb 2012, 15:52

Please change your Delphi Version in your Profile...
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 3     12 3      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:57 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