Delphi-PRAXiS
Seite 1 von 5  1 23     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Bild an der x-aschse spiegeln (https://www.delphipraxis.net/109359-bild-der-x-aschse-spiegeln.html)

andiak 28. Feb 2008 18:16


Bild an der x-aschse spiegeln
 
Ich hoffe das die frage so inordnung ist
Ich würde nämlich gerne wissen mit welchem befehl/methode
Ich ein TImage einfach Spiegeln kann


[edit=Matze]Programmiersprache von "Delphi .NET" auf "Delphi Win32" geändert. MfG, Matze[/edit]
[edit=SirThornberry]Titel korrigiert - Mfg, SirThornberry[/edit]

STS301 28. Feb 2008 18:22

Re: Bild and er x-aschse spiegeln
 
versuche es einmal hiermit ob es auch unter .Net funktioniert ;)

andiak 28. Feb 2008 18:25

Re: Bild and er x-aschse spiegeln
 
danke :/ ich weiß garnicht was ich habe :/ also verwenden tue ich das programm Delphi 7

und eine Paintbox haben wir nicht nut Image1 : TImage wo das bild aufer form ist und wenn ich jetzt auf nen button klicke soll die x-achse umkehren wie ist das möglich?

rawsoul 28. Feb 2008 18:34

Re: Bild and er x-aschse spiegeln
 
Ich habe mir den Source nicht angeschaut, aber eine TImage Komponente hat auch einen Canvas.

STS301 28. Feb 2008 18:34

Re: Bild and er x-aschse spiegeln
 
dann ist es WIN32 was du machst ;)

schau dir doch einmal den Quelltext an den himitsu hineingestellt hat an, da wirst du bestimmt fündig

andiak 28. Feb 2008 19:07

Re: Bild and er x-aschse spiegeln
 
Diese Procedure ist fürs Spiegeln Horizontal verantwortlich sehe ich das richtig?
Delphi-Quellcode:
Procedure TForm1.Button1Click(Sender: TObject);
    Begin
      StretchBlt(BitMapPaintBox5.Canvas.Handle, 0, 0, BitMapPaintBox5.Width,
        BitMapPaintBox5.Height, BitMapPaintBox5.Canvas.Handle,
        BitMapPaintBox5.Width - 1, 0, -BitMapPaintBox5.Width,
        BitMapPaintBox5.Height, SRCCopy);
      PaintBox5Paint(Sender);
    End;

STS301 29. Feb 2008 07:18

Re: Bild and er x-aschse spiegeln
 
denke schon "try and error"

andiak 13. Mär 2008 16:17

Re: Bild an der x-aschse spiegeln
 
also irgendwie bin ich nicht weiter gekommen :/ da ich ja keine Paintbox habe sondern ein TImage ich hab ein bissl gewartet und hin und wieder was ausprobiert... ich habe es geschaft ein kleines stücken bild x,y von 0-50 die farbpigmente zu speichern und versetzt wieder zu schreiben
theoretisch müsste das doch auch gehen das ich alle abspeicherer und GENAU umgekehrt wieder auf die selbe stelle platziere...
also wenn das bild die mase
x 0-250pixel
y 0-250pixel

dass dann die farbpigmente von 249 bei 1 und von 248 bei 2... usw.

hat jemand eine idee wie ich das schaffe? bzw. ist der ansatz richtig?

Muetze1 14. Mär 2008 00:50

Re: Bild an der x-aschse spiegeln
 
Zitat:

Zitat von andiak
also irgendwie bin ich nicht weiter gekommen :/

Erstmal: ja, das ist die Funktion die dafür zuständig ist. Siehe auch StretchBlt() Dokumentation. Mit einer negativen Weiten- bzw. Höhenangabe wird entsprechend gespiegelt.

Zitat:

Zitat von andiak
da ich ja keine Paintbox habe sondern ein TImage

Ja und? Mal abgesehen davon, dass auf einem TImage nicht gemalt wird sondern es nur zum statischen anzeigen genutzt wird, hat es trotzdem alles was auch die PaintBox für die Funktion mitbringt.

TPaintBox.Canvas -> TImage.Picture.Bitmap.Canvas
TPaintBox.Width -> TImage.Picture.Width
TPaintBox.Height -> TImage.Picture.Height

Also, nochmal rumprobieren und fertig stellen...

andiak 14. Mär 2008 08:08

Re: Bild an der x-aschse spiegeln
 
Am Anfang hatte ich den Fehler das StretchBlt undefiniert ist dann habe ich mal alle Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
eingefügt... würde gerne wissen welche der oberen uses gebraucht wird um StretchBlt ausführen zu können

in der procedure steht jetzt
Delphi-Quellcode:
procedure Spiegele(Bild: TImage);

Begin
      StretchBlt(TImage.Bild.Bitmap.Canvas.Handle, 0, 0, TImage.Bild.Width,
         TImage.Bild.Height, TImage.Bild.Bitmap.Canvas.Handle,
         TImage.Bild.Width - 1, 0, - TImage.Bild.Width,
         TImage.Bild.Height, SRCCopy);
       TImage.Bild(Sender);
      end;
aber jetzt sagt er mir das "Bild" undefiniert ist aber normalerweise dürfte der doch vorhanden sein Bild ist TImage
Hier mal mein kompletter Quellcode. :/ wo liegt hier der fehler? Ich habe ausprobiert bei TImage.Bild immer das TImage zu enterfernen da Bild ja schon TImage ist :/ ist das richtig das zu entfernnen oder muss das da bleiben??

Delphi-Quellcode:
interface
uses ExtCtrls;

procedure Spiegele(Bild: TImage);

implementation
uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls ;


procedure Spiegele(Bild: TImage);

Begin
      StretchBlt(Bild.Bitmap.Canvas.Handle, 0, 0, TImage.Bild.Width,
         TImage.Bild.Height, TImage.Bild.Bitmap.Canvas.Handle,
         TImage.Bild.Width - 1, 0, - TImage.Bild.Width,
         TImage.Bild.Height, SRCCopy);
       TImage.Bild(Sender);
      end;

end.


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:04 Uhr.
Seite 1 von 5  1 23     Letzte »    

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