<?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[Farbverlauf zwischen zwei COLORREFS?]]></title><description><![CDATA[<p>Moin, moin,</p>
<p>Colorref[0] = Startfarbe z.B. GELB<br />
Colorref[100] = Endfarbe z.B. ROT</p>
<p>Wie berechne ich die Elemente 1 - 99 als Farbverlauf von GELB nach ROT?</p>
<p>Ideen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/161620/farbverlauf-zwischen-zwei-colorrefs</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 07:46:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/161620.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 08 Oct 2006 18:19:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Farbverlauf zwischen zwei COLORREFS? on Sun, 08 Oct 2006 18:19:14 GMT]]></title><description><![CDATA[<p>Moin, moin,</p>
<p>Colorref[0] = Startfarbe z.B. GELB<br />
Colorref[100] = Endfarbe z.B. ROT</p>
<p>Wie berechne ich die Elemente 1 - 99 als Farbverlauf von GELB nach ROT?</p>
<p>Ideen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1151606</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151606</guid><dc:creator><![CDATA[timmix]]></dc:creator><pubDate>Sun, 08 Oct 2006 18:19:14 GMT</pubDate></item><item><title><![CDATA[Reply to Farbverlauf zwischen zwei COLORREFS? on Sun, 08 Oct 2006 18:45:05 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Mit der WinAPI Funktion <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_8oa4.asp" rel="nofollow">GradientFill(...) (<em>MSDN</em>)</a> kannst du einen vollständigen Farbverlauf zeichnen.</p>
<p>Wenns dir aber nur ums berechnen geht...Wo ist das Problem ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1151618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151618</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 08 Oct 2006 18:45:05 GMT</pubDate></item><item><title><![CDATA[Reply to Farbverlauf zwischen zwei COLORREFS? on Sun, 08 Oct 2006 23:31:30 GMT]]></title><description><![CDATA[<p>Einfach die Farbkomponenten in einem Farbraum (RGB, HSV, CIE-XYZ) linear interpolieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1151725</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151725</guid><dc:creator><![CDATA[MichiK]]></dc:creator><pubDate>Sun, 08 Oct 2006 23:31:30 GMT</pubDate></item><item><title><![CDATA[Reply to Farbverlauf zwischen zwei COLORREFS? on Sat, 14 Oct 2006 14:30:08 GMT]]></title><description><![CDATA[<p>MichiK schrieb:</p>
<blockquote>
<p>Einfach die Farbkomponenten in einem Farbraum (RGB, HSV, CIE-XYZ) linear interpolieren.</p>
</blockquote>
<p>Ich habs jetzt so gemacht:</p>
<pre><code class="language-cpp">static void ColorBell(COLORREF scolor, COLORREF ecolor, struct state *st){

	int rDelta;
	int gDelta;
	int bDelta;

	int rShift;
	int gShift;
	int bShift;

	bool rSinus;
	bool gSinus;
	bool bSinus;

	int rVal1 = GetRValue(scolor);
	int gVal1 = GetGValue(scolor);
	int bVal1 = GetBValue(scolor);

	int rVal2 = GetRValue(ecolor);
	int gVal2 = GetGValue(ecolor);
	int bVal2 = GetBValue(ecolor);

	////////////////////////////////////////////////////////////////////////
	// RED 
	if (rVal1 &lt; rVal2) {			// Traditional bell?
		rSinus	= true;
		rDelta	= rVal2 - rVal1;
		rShift	= rVal1;
	} else {						// Or bottom up?
		rSinus	= false;
		rDelta	= rVal1 - rVal2;
		rShift	= rVal2;
	}

	////////////////////////////////////////////////////////////////////////
	// GREEN 
	if (gVal1 &lt; gVal2) {
		gSinus	= true;
		gDelta	= gVal2 - gVal1;
		gShift	= gVal1;
	} else {
		gSinus	= false;
		gDelta	= gVal1 - gVal2;
		gShift	= gVal2;
	}

	////////////////////////////////////////////////////////////////////////
	// BLUE
	if (bVal1 &lt; bVal2) {
		bSinus	= true;
		bDelta	= bVal2 - bVal1;
		bShift	= bVal1;
	} else {
		bSinus	= false;
		bDelta	= bVal1 - bVal2;
		bShift	= bVal2;
	}

	////////////////////////////////////////////////////////////////////////
	// computing
	float r, g, b;

	for (int i=0; i &lt;= st-&gt;ncolours; i++) {

		// RED
		if (rSinus)
			r = (rDelta * pow(sin((i*M_PI)/st-&gt;ncolours),2)) + rShift;  // ok, traditional bell!
		else
			r = (rDelta * pow(cos((i*M_PI)/st-&gt;ncolours),2)) + rShift;  // oh, a top down bell!

		// GREEN
		if (gSinus)
			g = (gDelta * pow(sin((i*M_PI)/st-&gt;ncolours),2)) + gShift;
		else
			g = (gDelta * pow(cos((i*M_PI)/st-&gt;ncolours),2)) + gShift;

		// BLUE
		if (bSinus)
			b = (bDelta * pow(sin((i*M_PI)/st-&gt;ncolours),2)) + bShift;
		else
			b = (bDelta * pow(cos((i*M_PI)/st-&gt;ncolours),2)) + bShift;

		// and out!
		st-&gt;colours[i] = RGB((int)r, (int)g, (int)b);
	}
}
</code></pre>
<p>Die Struktur &quot;st&quot; enthält unter anderem:</p>
<p>st-&gt;colours[] // COLORREF Array<br />
st-&gt;ncolours // Anzahl der Farben</p>
<p>Der Verlauf ist jetzt glockenförmig von Quellfarbe zu Zielfarbe und zurück nach Quellfarbe. Sieht gut aus! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> Linear wäre sicher einfacher.</p>
<p>Wenn jemand Lust hat, kann er ja mal den Code vereinfachen - ich stecke noch in den Anfängen von C-Programmierung und ich stehe auf AHA-Erlebnisse. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1154659</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1154659</guid><dc:creator><![CDATA[timmix]]></dc:creator><pubDate>Sat, 14 Oct 2006 14:30:08 GMT</pubDate></item></channel></rss>