<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual C++ Tips &#187; RGB</title>
	<atom:link href="http://weseetips.com/tag/rgb/feed/" rel="self" type="application/rss+xml" />
	<link>http://weseetips.com</link>
	<description>Gold mine of Visual C++ tricks!</description>
	<lastBuildDate>Thu, 11 Mar 2010 09:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Convert colors in RGB to HLS and vice versa.</title>
		<link>http://weseetips.com/2008/05/22/convert-color-in-rgb-to-hls-and-vice-versa/</link>
		<comments>http://weseetips.com/2008/05/22/convert-color-in-rgb-to-hls-and-vice-versa/#comments</comments>
		<pubDate>Thu, 22 May 2008 18:34:56 +0000</pubDate>
		<dc:creator>Jijo Raj</dc:creator>
				<category><![CDATA[Codeproject]]></category>
		<category><![CDATA[GDI & GDI+]]></category>
		<category><![CDATA[color space]]></category>
		<category><![CDATA[ColorHLSToRGB()]]></category>
		<category><![CDATA[ColorRGBToHLS()]]></category>
		<category><![CDATA[HLS]]></category>
		<category><![CDATA[Hue]]></category>
		<category><![CDATA[Luminance]]></category>
		<category><![CDATA[RGB]]></category>
		<category><![CDATA[Saturation]]></category>
		<category><![CDATA[Shlwapi.h]]></category>
		<category><![CDATA[Shlwapi.lib]]></category>

		<guid isPermaLink="false">http://weseetips.wordpress.com/?p=128</guid>
		<description><![CDATA[RGB doesn&#8217;t need and introduction and If you are experienced in adobe photoshop, then you might be already familiar with HLS too. RGB All of us know about RGB. RGB is a color space in which, colors are represented by Red, Green and Blue components. Each component can vary from 0-255 in value. See the [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align:left;"><img class="alignnone size-medium wp-image-11" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" alt="" width="166" height="32" /><br />
<span style="color:#0000ff;">RGB </span>doesn&#8217;t need and introduction and If you are experienced in adobe photoshop, then you might be already familiar with <span style="color:#0000ff;">HLS </span>too.</p>
<p style="text-align:left;"><span style="text-decoration:underline;"><strong>RGB</strong></span><br />
All of us know about RGB. RGB is a color space in which, colors are represented by <span style="color:#0000ff;">Red, Green and Blue</span> components. Each component can vary from 0-255 in value. See the RGB color space below. (Thanks to MSDN for the pic)</p>
<p style="text-align:left;"><img class="alignnone size-medium wp-image-129" src="http://siteground205.com/~weseetip/wp-content/uploads/2008/05/rgb_colorspace.png?w=267" alt="" width="267" height="220" /></p>
<p style="text-align:left;"><span style="text-decoration:underline;"><strong>HLS<br />
</strong></span>HLS is also a Color space similar to RGB. But instead of red, green and blue components, HLS contain <span style="color:#0000ff;">Hue, Luminance &amp; Saturation </span>components. Its a color space in which the Hue, saturation and luminance of a color can be separated and modified. See the HLS color space below.( Thanks to Wiki for the pic. )</p>
<p style="text-align:left;"><img class="alignnone size-medium wp-image-130" src="http://siteground205.com/~weseetip/wp-content/uploads/2008/05/hls_colorspace.jpg?w=300" alt="" width="300" height="240" /></p>
<p style="text-align:left;"><img class="alignnone size-medium wp-image-12" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" alt="" width="220" height="32" /><br />
Well, how can you convert RGB color to HLS and vice versa? You can use the api&#8217;s &#8211; <span style="color:#0000ff;">ColorRGBToHLS()</span> and <span style="color:#0000ff;">ColorHLSToRGB()</span>. See the sample code snippet below.</p>
<pre>#include "Shlwapi.h"
...
// Red color in RGB
COLORREF RgbColor = RGB( 255, 0, 0 );

// Convert to HLS Color space
WORD Hue = 0;
WORD Luminance = 0;
WORD Saturation = 100;
ColorRGBToHLS( RgbColor, &amp;Hue, &amp;Luminance, &amp;Saturation );

// Its converted to Hue, Luminance and Saturation.
// You can adjust the parameters according to your wish.

// Now convert back to RGB.
RgbColor = ColorHLSToRGB( Hue, Luminance, Saturation );</pre>
<p><img class="alignnone size-medium wp-image-18" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" alt="" width="94" height="32" /><br />
You can generate a wide variety of effects by adjusting HLS parameters which cannot be done by using RGB. Designers always use these HLS components for generating creative images. Take Photoshop and have a try!</p>
<p>BTW, don&#8217;t forget to add <span style="color:#0000ff;">Shlwapi.lib</span> to project settings.</p>
<p><img class="alignnone size-medium wp-image-53" src="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248" alt="" width="248" height="32" /><br />
Targeted Audience &#8211; Intermediate.</p>
]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2008/05/22/convert-color-in-rgb-to-hls-and-vice-versa/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

