Autor Beitrag
Jojojoxx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mo 13.04.09 11:00 
Hallo!

Ich habe eine TImage Komponente, die Bilder mittels den Eigenschaften "proportional" und "Stretch" automatisch skaliert. Ist es irgendwie möglich die Abmessungen des skalierten Bildes herauszukriegen?
Danke euch!
mfg

Jojo
Xabitire
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Mo 13.04.09 11:07 
Mit Image1.Picture.Graphic.Width und Image1.Picture.Graphic.Height kannst du das auslesen.

MFG Blackbird8690
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mo 13.04.09 11:19 
Hi!

Danke erstmal für deine Antwort.
Ich habe das gerade ausprobiert aber zurückgegeben werden immer nur die Werte des Ursprungbildes.
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Mo 13.04.09 11:21 
ich denk mal, du könntest über den Faktor den du Skalierst die Größe ausrechnen.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 13.04.09 11:30 
Wenn du dir den Quelltext von TImage anschaust, dann siehst du auch, dass es keine andere Möglichkeit geben kann. Denn es wird schlich und einfach über die Methode DestRect bei jedem Zeichenvorgang das Zielrechteck berechnet und darauf per StretchDraw gezeichnet.

Es gibt also nirgends zwischengespeicherte Daten oder so über das tatsächlich gezeichnete Bild, das wird direkt auf den geerbten Canvas gezeichnet per inherited Canvas.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mo 13.04.09 11:33 
Mhhh, gibt es denn irgendwie eine gute Möglichkeit die Höhe und Breite der TImage-Komponente exakt auf das skalierte Bild anzupassen?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 13.04.09 11:34 
Nimm einfach die selbe Berechnung aus TImage, schau nach was da wann passiert, dann weißt du es genau. ;-)

Oder leite ein eigenes TImage ab und mach DestRect public (das ist nämlich in TImage protected).
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mo 13.04.09 11:47 
Wie finde ich denn den Quelltext von DestRect?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 13.04.09 11:49 
Indem du Strg festhält und auf TImage oben in der Deklaration des Formulars klickst. Dann bist du im Quelltext von TImage. Und dann schau nach DestRect (Zeile 133 müsste das sein) und drück Strg + Shift + Pfeil hoch (oder runter).

Oder hast du ne Personal Edition ohne Quelltext? Dann hol dir Turbo Delphi...