POV-Ray : Newsgroups : povray.beta-test : v3.8 beta 2. Bug with image_pattern use_index keyword. : v3.8 beta 2. Bug with image_pattern use_index keyword. Server Time
16 Jun 2024 15:16:47 EDT (-0400)
  v3.8 beta 2. Bug with image_pattern use_index keyword.  
From: William F Pokorny
Date: 14 Mar 2023 19:56:33
Message: <641109b1$1@news.povray.org>
In the function ParseImagePattern() there has long been an error with 
the use_index parsing.

CASE (USE_INDEX_TOKEN)
	image->Use = USE_INDEX; // Should be USE_NONE
END_CASE

Yes, the set up is strange, but USE_NONE means don't use the color 
and/or alpha channels - but rather use the palette indexes. The other 
image parsing options look to be correct setting USE_NONE on seeing 
use_index. The parsing is set up with respect to what color channels to 
use - so even defining USE_INDEX is odd. It's probably a remnant from 
old code.

Aside 1 : The index handling is hard coded to 8 bits (0-255) which is 
gif compatible and will work many png or tiff palette images, but png 
supports options with fewer bits and the de-facto standard tiff can use 
a 16 bit palette format.

Stick with 8 bit palettes would be the rule for use_index.

FWIW. I didn't test other than gif palette images.

In addition to some additional parse time checking for use_color, 
use_alpha and use_index - I added an exception if someone attempts to 
use use_index where none exists in the input image.

Aside 2: In a surprise to me, the use_alpha option uses the red channel 
when it cannot find an actual alpha channel for the return values.

Bill P.


Post a reply to this message

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