POV-Ray : Newsgroups : povray.programming : [bug] Non-critical: ALPHA handling in parser Server Time
22 Dec 2024 17:11:47 EST (-0500)
  [bug] Non-critical: ALPHA handling in parser (Message 1 to 1 of 1)  
From: Wolfgang Wieser
Subject: [bug] Non-critical: ALPHA handling in parser
Date: 24 Jan 2004 09:06:43
Message: <40127bf2@news.povray.org>
I found a non-critical bug in parstxtr.cpp around line 479:

The code reads: 

-------------------<parstxtr.cpp:471>---------------------------------
     CASE (OFFSET_TOKEN)
       Parse_UV_Vect (Image->Offset);
       Image->Offset[U] *= (DBL)-Image->iwidth;
       Image->Offset[V] *= (DBL)-Image->iheight;
     END_CASE

     CASE (ALPHA_TOKEN)
       Warning(155, "Keyword ALPHA discontinued. Use FILTER instead.");

     CASE (COLOUR_KEY_TOKEN)
       switch(Token.Function_Id)
         {
          case FILTER_TOKEN:
            EXPECT
              CASE (ALL_TOKEN)
----------------------------------------------------------------------

This does not work as expected: ALPHA_TOKEN will never get selected 
because putting "alpha" into an image_map will result in COLOUR_KEY_TOKEN 
getting parsed instead. Please apply the following patch to fix that: 

-------------------<parstxtr.cpp:471>---------------------------------
     CASE (OFFSET_TOKEN)
       Parse_UV_Vect (Image->Offset);
       Image->Offset[U] *= (DBL)-Image->iwidth;
       Image->Offset[V] *= (DBL)-Image->iheight;
     END_CASE

     CASE (COLOUR_KEY_TOKEN)
       switch(Token.Function_Id)
         {
          case ALPHA_TOKEN:
            Warning(155, "Keyword ALPHA discontinued. Use FILTER instead.");
            break;                               <-- (***)
          case FILTER_TOKEN:
            EXPECT
              CASE (ALL_TOKEN)
----------------------------------------------------------------------

The break; statement in the line marked with (***) can be left away 
if "alpha" can be parsed like "filter". Otherwise one should at least 
parse (and ignore) the argument for "alpha". 

Cheers,
Wolfgang


Post a reply to this message

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