<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Bilder(TPicture) auf TImage Größe skalieren, wie ?]]></title><description><![CDATA[<p>Hallo also ich mache ein art Galerie mit edm BC++ und bin eigentlich nun mit allem fertig bis auf :</p>
<p>Die Bilder, die ich in der Thumbnail-Vorschau angezeigt werden, werden wenn sie recht groß sind kaum angezeigt, da nur die obere Ecke, sagen wir mal die obere/linke Ecke mit dem Ausschnitt 160x160 angezeigt.</p>
<p>Die ist aber natürlich nicht sinnvoll. Angezeigt werden bmb(TPicture)/jpges(TJPEG) und gifs mit (TGIFIMAGE).</p>
<p>Nun die Frage :</p>
<p>Wie schaffe ich es, das die Bilder auf dei Größe des TImage, praktisch ihres Container skaliert werden un am anfang maximal für das richitge Seitenverhältnis beschnitten werden.</p>
<p>Der code sollte am besten nachedm greifen, wenn das Image schon in das TPicture geladen wird.</p>
<p>Also</p>
<pre><code>TPicture mypic = new TPicture(this);
.
.
loading pic
.
.

SIZING
</code></pre>
<p>So brauche ich das ganze nur hinter meine Bild-Lade funktionen zu setzen.</p>
<p>Danke im voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/99912/bilder-tpicture-auf-timage-größe-skalieren-wie</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 23:47:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/99912.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 02 Feb 2005 02:43:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bilder(TPicture) auf TImage Größe skalieren, wie ? on Wed, 02 Feb 2005 02:43:38 GMT]]></title><description><![CDATA[<p>Hallo also ich mache ein art Galerie mit edm BC++ und bin eigentlich nun mit allem fertig bis auf :</p>
<p>Die Bilder, die ich in der Thumbnail-Vorschau angezeigt werden, werden wenn sie recht groß sind kaum angezeigt, da nur die obere Ecke, sagen wir mal die obere/linke Ecke mit dem Ausschnitt 160x160 angezeigt.</p>
<p>Die ist aber natürlich nicht sinnvoll. Angezeigt werden bmb(TPicture)/jpges(TJPEG) und gifs mit (TGIFIMAGE).</p>
<p>Nun die Frage :</p>
<p>Wie schaffe ich es, das die Bilder auf dei Größe des TImage, praktisch ihres Container skaliert werden un am anfang maximal für das richitge Seitenverhältnis beschnitten werden.</p>
<p>Der code sollte am besten nachedm greifen, wenn das Image schon in das TPicture geladen wird.</p>
<p>Also</p>
<pre><code>TPicture mypic = new TPicture(this);
.
.
loading pic
.
.

SIZING
</code></pre>
<p>So brauche ich das ganze nur hinter meine Bild-Lade funktionen zu setzen.</p>
<p>Danke im voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/712546</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/712546</guid><dc:creator><![CDATA[maYer]]></dc:creator><pubDate>Wed, 02 Feb 2005 02:43:38 GMT</pubDate></item><item><title><![CDATA[Reply to Bilder(TPicture) auf TImage Größe skalieren, wie ? on Wed, 02 Feb 2005 08:19:46 GMT]]></title><description><![CDATA[<p>Schau dir mal die Eigenschaft <strong>Stretch</strong> von TImage an (dadurch wird das Bild aber nur optisch kleiner dargestellt). Wenn das Bild auch physisch kleiner sein soll, musst du das runterskalieren mit entsprechenden Algorithmen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/712596</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/712596</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Wed, 02 Feb 2005 08:19:46 GMT</pubDate></item><item><title><![CDATA[Reply to Bilder(TPicture) auf TImage Größe skalieren, wie ? on Wed, 02 Feb 2005 11:31:33 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Stretch habe ich schon länger entdeckt, zeigt bei mir aber keinerlei Wirkung.<br />
Wenn ich stretch auf true setze und ein Bild lade, passiert nichts.</p>
<p>Gibt es da noch andere Einstellungen/Möglichkeiten ?</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/712736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/712736</guid><dc:creator><![CDATA[maYer]]></dc:creator><pubDate>Wed, 02 Feb 2005 11:31:33 GMT</pubDate></item><item><title><![CDATA[Reply to Bilder(TPicture) auf TImage Größe skalieren, wie ? on Wed, 02 Feb 2005 12:33:54 GMT]]></title><description><![CDATA[<p>wenn du <strong>Stretch</strong> auf <strong>true</strong> und <strong>AutoSize</strong> auf <strong>false</strong> setzt, sollte bei einer grössen änderung des TImage das Bild sich automatisch anpassen/verzerren.<br />
ist jedenfalls bei mir so</p>
<p>BigNeal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/712779</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/712779</guid><dc:creator><![CDATA[BigNeal]]></dc:creator><pubDate>Wed, 02 Feb 2005 12:33:54 GMT</pubDate></item><item><title><![CDATA[Reply to Bilder(TPicture) auf TImage Größe skalieren, wie ? on Wed, 02 Feb 2005 13:31:35 GMT]]></title><description><![CDATA[<p>Für alle die auf diesen Thread stoßen...</p>
<p>Ja du hast bestimmt recht, wenn man das Bild über LoadFromFile/FormStream lädt.<br />
Nur dann wird das Bidl angepasst.</p>
<p>Ich muss jedoch eine eigene Ladefunktion nutzen um bmps, jpgs und gifs laden zu können.</p>
<p>Dabei wird das Bild in Picture-&gt;Bitmap gemalt (Canvas), nachdem es davor in einem temporören TPicture geladen wurde.</p>
<p>Die Lösung war nun, das ich das ganze nicht mit Picture-&gt;Canvas-&gt;Draw zeichne sondern mit StretchDraw.</p>
<pre><code>TPicture *TempPic = new TPicture;

	AnsiString pic_type =  (ExtractFileExt(Filepath)).LowerCase();

	if(pic_type == &quot;.bmp&quot; || pic_type == &quot;.gif&quot;)
	{
		TempPic-&gt;LoadFromFile(Filepath);
	}
	else if(pic_type == &quot;.jpg&quot; || pic_type == &quot;.jpeg&quot;)
	{                                                           
		TJPEGImage *JPEGImage = new TJPEGImage;

		JPEGImage-&gt;LoadFromFile(Filepath);

		TempPic-&gt;Assign(JPEGImage);
	}

    this-&gt;Picture-&gt;Bitmap-&gt;Height = this-&gt;Height;
	this-&gt;Picture-&gt;Bitmap-&gt;Width =  this-&gt;Width;

    // getting Pic proportions and setting the height/width for proportional StretchDraw
    double prop = double(double(TempPic-&gt;Height) / double(TempPic-&gt;Width));
    double pic_height;
    double pic_width;
    if(prop &gt; 1)
    {   //hochformat
       pic_height = this-&gt;Height;
       pic_width = double( double(this-&gt;Width)/prop);
    }
    else
    {  //Querformat
       pic_height = double( double(this-&gt;Height)*prop);
       pic_width = this-&gt;Width ;
    }
    // to center the image..

	long set_pic_Top = 0;
	long set_pic_Left = 0;

    int difheigth = this-&gt;Height -  pic_height;
	int difwidth = this-&gt;Width - pic_width;

	if(difwidth &gt; 0)
		set_pic_Left = difwidth/2;

	if(difheigth &gt; 0)
		set_pic_Top = difheigth/2;

    TRect ARect;
    ARect.Left = set_pic_Left;
    ARect.Top = set_pic_Top;
    ARect.Right = pic_width+set_pic_Left;
    ARect.Bottom = pic_height+set_pic_Top;

    // fullsize image
	this-&gt;backup_pic-&gt;Bitmap-&gt;Width =TempPic-&gt;Width;
	this-&gt;backup_pic-&gt;Bitmap-&gt;Height=TempPic-&gt;Height;
	this-&gt;backup_pic-&gt;Bitmap-&gt;Canvas-&gt;Draw(0,0,TempPic-&gt;Graphic);

    // showed picture
    this-&gt;Picture-&gt;Bitmap-&gt;Canvas-&gt;StretchDraw(ARect,TempPic-&gt;Graphic);
</code></pre>
<p>Hier ein kleiner Codeausschnitt um es besser verständlich zu machen.</p>
<p>Hoffe es hilft jemandem</p>
]]></description><link>https://www.c-plusplus.net/forum/post/712822</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/712822</guid><dc:creator><![CDATA[maYer]]></dc:creator><pubDate>Wed, 02 Feb 2005 13:31:35 GMT</pubDate></item></channel></rss>