Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: HSL Value .. Bug?  (Read 6845 times)

0 Members and 1 Guest are viewing this topic.

FogGobbler

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 228
    • View Profile
HSL Value .. Bug?
« on: August 17, 2007, 04:11:54 PM »

Hi!

I´ve probably found a small bug, but I´m not quite sure.

This ismy little test-code:
Code: [Select]
  H = GetHValue(MakeRGBA(255,0,255));
  S = GetSValue(MakeRGBA(255,0,255));
  L = GetLValue(MakeRGBA(255,0,255));
 
  Game.Msg("H: "+H); Sleep(200);
  Game.Msg("S: "+S);Sleep(200);
  Game.Msg("L: "+L);Sleep(200);

RGB (255,0,255) is a light pink color. If I look at the ambient light picker (in the scene editor) that calculates the HSL for a RGB color I get the following HSL : 213, 255, 128

My little test program results: 212, 255, 127
« Last Edit: September 08, 2007, 04:05:02 PM by Mnemonic »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: HSL Value .. Bug?
« Reply #1 on: August 19, 2007, 12:00:03 PM »

Considering how the color-space conversion works, there can be small imprecisions caused by rounding. For example if I set the same color in Paint Shop Pro, I get 212, 255, 127 just like in WME.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

jbw

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • View Profile
Re: HSL Value .. Bug?
« Reply #2 on: August 24, 2007, 01:53:23 AM »

Considering how the color-space conversion works, there can be small imprecisions caused by rounding.

Computing HSL as a double precission "fractions of one" I got: 0.833333..., 1, 0.5
Casted to 0..255 range it means 212.5, 255, 127,5 that imo should be rounded to 213, 255, 128

But obviously both methods does very rough estimation and never gives the same color when we convert between RGB & HSL forth and back.

Of course such differences are practically indistinguishable by human eye.
Logged
 

Page created in 0.021 seconds with 22 queries.