Bug 1203 : fill with alpha irregular behavior
Last modified: 2009-03-13 09:09




Status:
RESOLVED
Resolution:
INVALID -
Priority:
P2
Severity:
normal

 

Reporter:
jedierikb
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2009-03-13 05:17
1.0.3

void setup ()
{
size( 400, 400 );
background( 0 );

fill( 255, 0, 0 );
rect( width/4, height/4, width/2, height/2 );

loop();
}

void draw( )
{
fill( 0, 255, 0, 1 );
rect( 0, 0, width, height );
}


(1). This has different results when run from in mac jar viewer / Sketch-Run then it
does viewed from the mac browser plugin (or vista jar viewer/browser plugins / Sketch-
Run (1.6_12, natch) ).

(2). This is strange behavior, no? Why doesn't the red rect eventually get painted
over? If we increase the alpha on the loop's rect method to 3, it will eventually paint
over the red rectangle (however, it appears to pause a bit towards the end, like its
making up its mind). Alpha values over 3 cover that red rect up right quick.
Additional Comment #1 From fry 2009-03-13 09:09
Nope, that's just fun with math, and differences on how blending is
implemented on different platforms/different versions of Java.

If you have 8 bits of resolution that gives you 256 levels of alpha. So
multiplying a pixel by (1.0 / 255.0) for alpha value '1' means that it'll
change by ~0.4% (as in value * 0.0039) on each iteration. Depending on what
the input values are, you're gonna get different results. Different
versions of Java probably just handle the rounding differently (this is
handled inside Java2D, not by Processing).