User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
isp:hsl-_rgb [2019/05/27 23:42] – [Detailed algorithm] Igor Yefmovisp:hsl-_rgb [2019/05/27 23:51] Igor Yefmov
Line 10: Line 10:
   * \(H\) (hue) is a signed ''14''-bit field that maps into \([-180°..+180°]\) range   * \(H\) (hue) is a signed ''14''-bit field that maps into \([-180°..+180°]\) range
   * \(S\) (saturation) is an ''8''-bit unsigned value which maps into \([0\%..100\%]\) range   * \(S\) (saturation) is an ''8''-bit unsigned value which maps into \([0\%..100\%]\) range
-  * \(L\) (luminosity) is a ''9''-bit unsigned value that maps into \([0\%..100\%]\) range just like the \(saturation\) above+  * \(L\) (luminosity) is a ''9''-bit unsigned value that maps into \([0\%..100\%]\) range, very much like the \(saturation\) above
  
 The output of this conversion is an \(RGB\) triplet ''24''-bits wide with ''8'' bits unsigned value per color channel in range \([0..255]\) The output of this conversion is an \(RGB\) triplet ''24''-bits wide with ''8'' bits unsigned value per color channel in range \([0..255]\)
Line 28: Line 28:
  
 The last part, losing the 14 LSB, doesn't have to be done right away and with the goal of preserving as much precision as possible this operation can be postponed until later time (just need to remember that the "real" value is now augmented by that \(2^{14}\) factor and adjust accordingly). The last part, losing the 14 LSB, doesn't have to be done right away and with the goal of preserving as much precision as possible this operation can be postponed until later time (just need to remember that the "real" value is now augmented by that \(2^{14}\) factor and adjust accordingly).
-===== Step-by-step algorithm ===== 
  
-==== Precise calculations ====+===== Precise calculations =====
 As a refresher this is how [[https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB|Wikipedia]] lists the way to convert HSL to RGB: As a refresher this is how [[https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB|Wikipedia]] lists the way to convert HSL to RGB:
  
Line 59: Line 58:
 \[(R,G,B)=(R_1+m,G_1+m,B_1+m)\] \[(R,G,B)=(R_1+m,G_1+m,B_1+m)\]
  
-==== Detailed algorithm ====+===== Step-by-step algorithm =====
 Armed with the above information we can now compile the necessary sequence of calculations and format it into an easy-to-use table: Armed with the above information we can now compile the necessary sequence of calculations and format it into an easy-to-use table:
  

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information