Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Color conversions  (Read 5952 times)

0 Members and 1 Guest are viewing this topic.

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Color conversions
« on: July 10, 2011, 09:18:36 pm »
I would like to have the ability to change RGB to HTML (hex) and back to RGB again. But what I would really like is RGB to HSL and back to RGB again.  :)

//edit: Why HSL? Because than I can do color overlay effects like in Gimp.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
Color conversions
« Reply #1 on: July 10, 2011, 10:09:15 pm »

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Color conversions
« Reply #2 on: July 10, 2011, 10:46:59 pm »
What would also be nice is an operator on colors. For example that I do this:

Code: [Select]
sf::Color test(20,20,20);

test = test * 1.5;


and we get a brighter test color.  :)

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Color conversions
« Reply #3 on: July 11, 2011, 12:54:04 pm »
Quote from: "panithadrum"
I think that a custom function would be the best...
http://www.deadbeef.com/converting_rgb_to_hsv_in_c/
http://serennu.com/colour/rgbtohsl.php
http://130.113.54.154/~monger/hsl-rgb.html


If SFML won't support it, do you perhaps have the c++ code for that (RGB <-> HSL)? I tried google, but got strange C# stuff...

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Color conversions
« Reply #4 on: July 15, 2011, 02:50:37 pm »
So no HSL<->RGB convertion function?

 

anything