POV-Ray : Newsgroups : povray.general : a macro : a macro Server Time
2 Aug 2024 12:21:51 EDT (-0400)
  a macro  
From: Aeroslin
Date: 31 Oct 2004 01:10:00
Message: <web.418480e1dfacac47946614380@news.povray.org>
Hello everyone.

I had a desire to pull color values from Paintshop Pro in order to use them
in POV.  The native color format is RGB-255 which, according to the help,
doesn't support 255 values, only 0 - 1 values.  In order to translate
between the two formats I created my first macro and to my surprise, it
works!

Of course, it's possible that it wasn't necessary to do this but I wanted to
anyhow.

I'm not sure if posting code is ok here but I'm going to go out on a limb
and post it anyways.

#macro hexRGB2povRGB(RGB)
        #local R = RGB.red;
        #local G = RGB.blue;
        #local B = RGB.green;
        #local povR = (R / 2.55) / 100;
        #local povG = (G / 2.55) / 100;
        #local povB = (B / 2.55) / 100;
        <povR,povG,povB>
#end

To use it, put it into a pigment statement like this:
pigment { color hexRGB2povRGB(<255,255,255>) }

Well, there you have it.

Aeroslin


Post a reply to this message

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