<?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[HBITMAP verkleinern und Tranparent darstellen]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie die Überschrift schon sagt möchte ich das Bild verkleinert und mithilfe eines Colorkeys ohne Ränder darstellen. Das Bild ist Korrekt geladen und lässt sich auch darstellen (mit BitBlt). Bisher habe ich Folgendes:</p>
<pre><code class="language-cpp">void BltImage(const HBITMAP bmp, HDC hdc, int x, int y, int xsize, int ysize)
{
	BITMAP bm;
	GetObject((HANDLE)bmp, sizeof(bm), static_cast&lt;void *&gt;(&amp;bm));
	x -= xsize / 2; // (x/y( gibt die Mitte des Bildes an
	y -= ysize / 2;
	HDC temp = CreateCompatibleDC(hdc);
	HDC temp2 = CreateCompatibleDC(hdc);
	SelectObject(temp, bmp);

	StretchBlt(temp2, 0, 0, xsize, ysize, temp, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
	TransparentBlt(hdc, x, y, xsize, ysize, temp2, 0, 0, xsize, ysize, RGB(0, 0, 0));

	DeleteDC(temp);
	DeleteDC(temp2);
}
</code></pre>
<p>wenn ich eine der Beiden Zeilen auskommentiere funktioniert alles wie es soll, d.h. ich kann enweder verkleinern <strong>oder</strong> Transparent darstellen. Es soll aber beides <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Wie bekomme ich das hin ?</p>
<p>mfg Helferlein</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/217510/hbitmap-verkleinern-und-tranparent-darstellen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 09:22:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/217510.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Jul 2008 10:50:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HBITMAP verkleinern und Tranparent darstellen on Tue, 08 Jul 2008 10:50:24 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie die Überschrift schon sagt möchte ich das Bild verkleinert und mithilfe eines Colorkeys ohne Ränder darstellen. Das Bild ist Korrekt geladen und lässt sich auch darstellen (mit BitBlt). Bisher habe ich Folgendes:</p>
<pre><code class="language-cpp">void BltImage(const HBITMAP bmp, HDC hdc, int x, int y, int xsize, int ysize)
{
	BITMAP bm;
	GetObject((HANDLE)bmp, sizeof(bm), static_cast&lt;void *&gt;(&amp;bm));
	x -= xsize / 2; // (x/y( gibt die Mitte des Bildes an
	y -= ysize / 2;
	HDC temp = CreateCompatibleDC(hdc);
	HDC temp2 = CreateCompatibleDC(hdc);
	SelectObject(temp, bmp);

	StretchBlt(temp2, 0, 0, xsize, ysize, temp, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
	TransparentBlt(hdc, x, y, xsize, ysize, temp2, 0, 0, xsize, ysize, RGB(0, 0, 0));

	DeleteDC(temp);
	DeleteDC(temp2);
}
</code></pre>
<p>wenn ich eine der Beiden Zeilen auskommentiere funktioniert alles wie es soll, d.h. ich kann enweder verkleinern <strong>oder</strong> Transparent darstellen. Es soll aber beides <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Wie bekomme ich das hin ?</p>
<p>mfg Helferlein</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1543287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1543287</guid><dc:creator><![CDATA[Helferlein]]></dc:creator><pubDate>Tue, 08 Jul 2008 10:50:24 GMT</pubDate></item><item><title><![CDATA[Reply to HBITMAP verkleinern und Tranparent darstellen on Tue, 08 Jul 2008 10:53:18 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void BltImage(const HBITMAP bmp, HDC hdc, int x, int y, int xsize, int ysize)
{
	BITMAP bm;
	GetObject((HANDLE)bmp, sizeof(bm), static_cast&lt;void *&gt;(&amp;bm));
	x -= xsize / 2;
	y -= ysize / 2;
	HDC temp = CreateCompatibleDC(hdc);
	HDC temp2 = CreateCompatibleDC(hdc);
	HBITMAP bmp2 = CreateCompatibleBitmap(hdc, xsize, ysize);
	SelectObject(temp, bmp);
	SelectObject(temp2, bmp2);

	StretchBlt(temp2, 0, 0, xsize, ysize, temp, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
	TransparentBlt(hdc, x, y, xsize, ysize, temp2, 0, 0, xsize, ysize, RGB(0, 0, 0));

	DeleteObject(bmp2);
	DeleteDC(temp);
	DeleteDC(temp2);
}
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1543294</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1543294</guid><dc:creator><![CDATA[bitmap]]></dc:creator><pubDate>Tue, 08 Jul 2008 10:53:18 GMT</pubDate></item></channel></rss>