kontrol
Junior Member
Offline
Posts: 92
Bug or just me?
Jul 31st , 2007, 1:05am
I did or sketch that explodes an image in to definable pixels(or I modified an example). Fx, this sketch devides the image into small plusses. image: http://i210.photobucket.com/albums/bb264/Snooze_/Face.jpg. My problem is that all the small images(plusses/pixels), which are gifs, loose their transparency in some parts of the program, while they are maintained in most parts. I dont get it.. someone? import processing.opengl.*; PImage pixel; PImage img; // The source image int cellsize = 11; // Dimensions of each cell in the grid int COLS, ROWS; // Number of columns and rows in our system void setup() { size(530, 600, OPENGL); img = loadImage("face.jpg"); // Load the image pixel = loadImage("pixel.gif"); COLS = 486/cellsize; // Calculate # of columns ROWS = 552/cellsize; colorMode(RGB,255,255,255,100); // Setting the colormode } void draw() { background(0); // Begin loop for columns for ( int i = 1; i < COLS;i=i+1) { // Begin loop for rows for ( int j = 1 ; j < ROWS;j++) { int x = i*cellsize + cellsize/2; // x position int y = j*cellsize + cellsize/2; // y position int loc = x + y*486; // Pixel array location. y*width color c = img.pixels[loc]; // Grab the color // Calculate a z position as a function of mouseX and pixel brightness float z = 0.78 * brightness(img.pixels[loc]) - 100.0f; // Translate to the location, set fill and stroke, and draw the rect pushMatrix(); // strokeWeight(#); (only for boxes etc.) noFill(); noStroke(); // The location of the picture translate(x,y,z); tint(c); scale(0.5); image(pixel,0,0); popMatrix(); } } }