HSL to RGB?

  • Thread starter Thread starter PJ6
  • Start date Start date
P

PJ6

I have a color I need to convert to RGB from HSL
(hue/saturation/luminosity).

Can't find anything built in. Anyone know how it's done?

TIA,
Paul
 
Surprised there's nothing built in to the Framework for that.

I got his code to work after I realized I needed to divide everything by
255.

Thanks,
Paul
 
The convention in notation for such colour spaces is to define the range
between 0 and 1 using floats or doubles to provide the fractions.

RGB is often described in this way too in "real" graphics systems such as
OpenGL or other 2D / 3D rendering systems. GDI+ has a lot of GDI's legacy
oddness about it.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top