<?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[gdi+ mit LinearGradientBrush schräg füllen]]></title><description><![CDATA[<p>Hallo,<br />
ich benutze GDI+, und will jetzt mal mit FillRectangle einen Rechteck mit einem LinearGradientBrush schräg füllen, z.B. von Rechtsoben weiß nach links unten schwarz. Also 135°.<br />
Code:</p>
<pre><code>float rad = ((float)(135)/360.0f)*2*M_PI;
  int y = tan(rad) * 100;

  Gdiplus::LinearGradientBrush* newlBrush = new Gdiplus::LinearGradientBrush(Gdiplus::Point(0, 0), Gdiplus::Point(100,y), Gdiplus::Color::White, Gdiplus::Color::Black);
</code></pre>
<p>Problem: Das funktioniert nicht richtig. Es ist im falschen Winkel, und es fängt in den Ecken an den falschen Positionen an. (Bildbeschreibung: wenn man von der linken oberen Ecke nach rechts unten das Bild teilt, ist im linken Teil fast komplett schwarz, es geht von schwarz (an der hälfte) nach dunkel grau (links unten), in der rechten hälfte geht es von weiß nach hellgrau (rechts oben)).<br />
Bei 90° ist es komplett weiß.</p>
<p>Ich bin am verzweifeln. So helft mir doch! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>danke schonmal im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/90210/gdi-mit-lineargradientbrush-schräg-füllen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 21:46:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/90210.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 27 Oct 2004 09:27:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to gdi+ mit LinearGradientBrush schräg füllen on Wed, 27 Oct 2004 09:27:56 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich benutze GDI+, und will jetzt mal mit FillRectangle einen Rechteck mit einem LinearGradientBrush schräg füllen, z.B. von Rechtsoben weiß nach links unten schwarz. Also 135°.<br />
Code:</p>
<pre><code>float rad = ((float)(135)/360.0f)*2*M_PI;
  int y = tan(rad) * 100;

  Gdiplus::LinearGradientBrush* newlBrush = new Gdiplus::LinearGradientBrush(Gdiplus::Point(0, 0), Gdiplus::Point(100,y), Gdiplus::Color::White, Gdiplus::Color::Black);
</code></pre>
<p>Problem: Das funktioniert nicht richtig. Es ist im falschen Winkel, und es fängt in den Ecken an den falschen Positionen an. (Bildbeschreibung: wenn man von der linken oberen Ecke nach rechts unten das Bild teilt, ist im linken Teil fast komplett schwarz, es geht von schwarz (an der hälfte) nach dunkel grau (links unten), in der rechten hälfte geht es von weiß nach hellgrau (rechts oben)).<br />
Bei 90° ist es komplett weiß.</p>
<p>Ich bin am verzweifeln. So helft mir doch! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>danke schonmal im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/638609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/638609</guid><dc:creator><![CDATA[Salim]]></dc:creator><pubDate>Wed, 27 Oct 2004 09:27:56 GMT</pubDate></item><item><title><![CDATA[Reply to gdi+ mit LinearGradientBrush schräg füllen on Wed, 27 Oct 2004 09:44:30 GMT]]></title><description><![CDATA[<p>Jippiie, teilweise ist das Problem gelöst:</p>
<pre><code>Gdiplus::LinearGradientBrush* newlBrush = new Gdiplus::LinearGradientBrush(Gdiplus::Point(UDFrom-&gt;Position, 1), Gdiplus::Point(UDTo-&gt;Position-UDFrom-&gt;Position,1), Gdiplus::Color::White, Gdiplus::Color::Black);
  newlBrush-&gt;RotateTransform(Winkel);
</code></pre>
<p>Nur entsteht immernoch eine Art Rand wie vorher beschrieben bei Winkeln von über 90°.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/638619</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/638619</guid><dc:creator><![CDATA[Salim]]></dc:creator><pubDate>Wed, 27 Oct 2004 09:44:30 GMT</pubDate></item><item><title><![CDATA[Reply to gdi+ mit LinearGradientBrush schräg füllen on Wed, 27 Oct 2004 10:45:21 GMT]]></title><description><![CDATA[<p>Ich geb auf...</p>
<p>Gibts irgendwo eine ordentliche FillAPI?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/638672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/638672</guid><dc:creator><![CDATA[Salim]]></dc:creator><pubDate>Wed, 27 Oct 2004 10:45:21 GMT</pubDate></item></channel></rss>