1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Bug in colors library?

Posted by Mark M on Feb 16, 2008

Hello,

I could always be doing something wrong, but I think there is a slight bug in the way the colors library handles gradient fills for objects living in the negative areas of the coordinate system.

I expected these squares s1 and s2 to have the same gradient, but in my version (1.9.4 / intel / leopard ) the one in the negative quadrant is coming out black:

ximport("colors")
translate(200, 200)
s1 = rect(-100, -100, 100, 101)
s2 = rect(100, 100, 100, 100)
 
clr1 = colors.hsb(0.5, 0.5,  0.5)
clr2 = colors.hsb(0,0, 0)
 
for d in (s1, s2):
    colors.gradientfill(d,
                        clr1,
                        clr2, type="linear", dx=0, dy=0, spread=1.0, angle=0, alpha=1.0)


 
Posted by Tom De Smedt on Feb 18, 2008

Gradients rendered outside the visible area will crash NodeBox when exporting to a PDF, so at some point the library checks if the gradient is onscreen and aborts if it isn't. There's indeed a bug there but it can be fixed fairly easy so I'll release an update as soon as possible.



Posted by Tom De Smedt on Feb 25, 2008

Hi Mark, you can download the latest version. The bug should be fixed.



Posted by Mark M on Feb 25, 2008

That was quick...thanks Tom.