POV-Ray : Newsgroups : povray.newusers : color modulation in textures : Re: color modulation in textures Server Time
30 Jul 2024 00:28:02 EDT (-0400)
  Re: color modulation in textures  
From: Tim Nikias
Date: 12 May 2005 05:39:52
Message: <42832468$1@news.povray.org>
> But when i want to use another imageformat (e.g. png), how can i send it
> as a parameter to the macro?
> Does anyone from the experienced users has some advices to make it even
> more flexible?

You could use some of the string-functionality to clip off everything until
the "." in the filename. Note that you can't just clip to the last 3, as
some might save with "JPEG" instead of plain, 3-digit "JPG". Then again, you
could tell that someone did that if the remaining 3 digits showed "PEG"...

Anyways, once you have the last three digits, use
strcmp(One_String,Another_String) and check if they're equal (if they are,
strcmp returns the value 0). Use the proper format according to the results.
(e.g. #if (strcmp(TestThis,"png")) png #end).

Of course, this won't work when somebody doesn't supply an ending for their
images, but shame on those that do that! :-)

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

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