Hello,
I have been writing a program in Processing that displays PNG's on a solid background color as PImages. I found that when I use rotate, and some times translate, when drawing these PImages the transparent pixels will blend with the nontransparent pixels, mixing their colors. This results in some visible discoloration of the pixels which makes for some odd looking edges of my PImages.
I have done some experimentation and found that rotating solid white images can have similar results, where borders become visible on a solid same colored background. Is this possibly related to the transparency blending, I don't know. Perhaps I should use another method to display the images rather than using PImage.
This may be related to this thread/topic: processing.org/discourse/yabb2/num_1202337325.html
Here is some code that demonstrates the effect I am trying to describe, at least with the borders becoming visible:
Code:import processing.opengl.*;
PImage exampleImage;
PImage test = new PImage();
void setup(){
size(200, 200, OPENGL);
hint(DISABLE_OPENGL_2X_SMOOTH);//enabled or disabled doesn't seem to have much effect either way
noSmooth();
exampleImage = createImage(width/8,height/8,ARGB);
int pixelCount = (width/8*height/8);
}
void draw(){
background(255,255,255);
for(int i = 0; i<width/8*height/8; i++){
exampleImage.pixels[i]= color(255,255,255,255);
}
pushMatrix();
translate(mouseX,mouseY);//some times colored boreders appear with translation.
rotate(mouseX/2); //colored borders appear with rotation.
image(exampleImage,0,0);
popMatrix();
}
Look carefully for the borders of a rectangle near the mouse when hovering/moving your moue over the canvas. When I do so I see about half of a dark outline of the white PImage over the white background.
My specs are: 32-Bit Windows XP, 2GB RAM, 256MB NVidia 7600GT, AMD X2 6000.
Any help in fixing this blending colors between transparent and non-transparent pixels and showing of borders would be much appreciated. Thank you.