Code: Select all
'' commenting out line 15 hides the bug
'' loop at the bottom (For i as long .. ) also seems to expose it
#define max( a, b) iif( (a)>(b), (a), (b) )
function palette_generalist( i as long, c as short = 8 ) as ulong
var u = max(c - 1, 1)
var gray_count = cint( log(sqr(c))/log(2) ) + 1
var in = i/ u
var partitions = max(gray_count - 1, 1)
var part_offs = (max(gray_count - 1, 1) / u)
if i = u then ? part_offs
var _pos = in*partitions
#define _sawtooth_base _pos
var _saw = _sawtooth_base - int(_sawtooth_base)
if i = u then
?
? "_pos";_pos
? "int(_pos)"; int(_pos)
endif
return -1
#undef _sawtooth_base
end function
var pal_size = 50, u = pal_size-1
for i as long = 0 to 49 '' also has something to do w/ loop
var col = palette_generalist( i, pal_size )
Next