Skip to content

Problems with blur/blend methods #1224

@processing-bugs

Description

@processing-bugs

Original author: andres.c...@gmail.com (August 16, 2012 16:23:17)

The following sketch:

PImage clean;
PGraphics pgr, pgb, pgg, pgp;
int lastTime = 0;
PFont myFont;
String renderer = P2D;

void setup() {
size(320, 240, renderer);
pgr = createGraphics( width, height, renderer);
pgg = createGraphics( width, height, renderer);
pgb = createGraphics( width, height, renderer);
pgp = createGraphics( width, height, renderer);
noSmooth();
myFont = createFont("Arial", 28);
textFont(myFont, 28);
}

void draw() {
background(0);
fill(255);
text("CODE", 20, 30);

noStroke();

fill(255, 255, 0);
ellipse( 70, 70, 20, 20);

fill(255, 0, 0);
rect( 100, 100, 10, 30);

fill(0, 255, 255);
ellipse( mouseX, mouseY, 20, 20 );

/// Post scene effects follow.

if ( mousePressed ) {
return;
}

clean = get();
background(0);

pgr.beginDraw();
pgr.tint(255, 0, 0);
pgr.image(clean, 0, 0);
pgr.endDraw();

pgg.beginDraw();
pgg.tint(0, 255, 0);
pgg.image(clean, 0, 0);
pgg.endDraw();

pgb.beginDraw();
pgb.tint(0, 0, 255);
pgb.image(clean, 0, 0);
pgb.endDraw();

if ( millis() > lastTime + 100 ) {
pgp.beginDraw();
pgp.background(255);
pgp.loadPixels();
for (int x=0; x<pgp.pixels.length; x++) {
pgp.pixels[x] = color( random(128) );
}
pgp.updatePixels();
pgp.endDraw();
lastTime = millis();
}

image( pgr.get(), -int(random(1, 4)), 0);
blend( pgg.get(), 0, 0, width, height, 0, 0, width, height, ADD);
blend( pgb.get(), int(random(1, 4)), 0, width, height, 0, 0, width, height, ADD);
blend( pgp.get(), 0, 0, width, height, 0, 0, width, height, SCREEN);

if ( random(1) < .5 ) {
filter( BLUR, int( random(2) ) );
}
}

generates entirely different outputs when using either JAVA2D (assumed to be the correct result) and P2D (see attached images).

This might be pointing to an issue with the blur and/or the blend methods.

Original issue: http://code.google.com/p/processing/issues/detail?id=1186

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions