POV-Ray : Newsgroups : povray.unofficial.patches : Color space conversion? : Color space conversion? Server Time
2 Sep 2024 06:19:58 EDT (-0400)
  Color space conversion?  
From: Vahur Krouverk
Date: 3 May 2000 02:09:00
Message: <390FC2E4.9A3348F@aetec.ee>
Hello!

I'm currently implementing color space conversion for my shader patch.
It includes conversion between rgb, xyz, xyY, hsv, hsl and yiq spaces.
It seemed to be good idea to put this conversion function to color.c
file (err, coloUr.c). Now I'm wondering,  whether it is good idea to
make those conversion functions available from POV-Ray as well? Is there
any use for them? One thing, that comes to my mind, is post-processing:
with conversion from rgb to hsl (or hsv) it would be easy to add or
reduce saturation, or change hue.
If this is good idea, then how should it be implemented? As functions?
Which form would be preferable:
rgb2hsv(COLOUR) or 
COLOUR rgb2hsv(COLOUR)? 
First modifies parameter given color, second returns converted color.
I think that in order to limit number of functions, "orthogonal"
approach should be used, i.e. conversion functions only from/to rgb
should be implemented (this is how my conversion currently works).

P.S. I know that there are macros for conversion between rgb and hsv
(and/or hsl), but as this conversion code will be there for shader
patch, then it would be good idea to reuse it.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.