POV-Ray : Newsgroups : povray.newusers : How to print a color generated by a macro? : How to print a color generated by a macro? Server Time
2 May 2024 18:40:01 EDT (-0400)
  How to print a color generated by a macro?  
From: wealthychef
Date: 25 Aug 2014 22:35:02
Message: <web.53fbf1308ac336b8784e7dc60@news.povray.org>
Hi, I have the following macro (simplified for brevity).

#macro ColorFromBurgers(burgers)
/* good 11-color map from http://colorbrewer2.org
  #warning concat("Got burgers value: ",str(burgers,0,0),"\n")
*/
  #switch(burgers)
 #range (-5,-1)
   rgb <141,211,199>/255.0
 #break
 #case (0)
   rgb <255,255,179>/255.0
 #break
 #case (10)
   rgb <190,186,218>/255.0
 #break
#end
#end

I want to print out the color my macro is returning somehow.
I've tried the following with no success:
First I tried:
#warning concat("The color is ",ColorFromBurgers(burger),"\n")
but I get an error about not having three arguments.
File Context (5 lines):
          rgb <251,128,114>/255.0
        #break
        #case (12)
          rgb <128,177,211>/255.0
        #
Parse Error: Expected 3 parameters but only 1 found.

Strange that none of the lines seems to be anything that needs 3 parameters.

Tried a couple other things, but nothing seems to work.
The last thing i just tried before giving up was this:
   #declare c = color ColorFromBurgers(burger);
   #declare s = CRGBStr(color c ,0,0);
   #warning concat("The color is ",s,"\n")

I get
          #declare c = color ColorFromBurgers
Parse Error: All #declares of float, vector, and color require semi-colon ';' at
 end if the language version is set to 3.5 or higher. Either add the semi-colon
 or set the language version to 3.1 or lower.

Help!  Thanks


Post a reply to this message

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