velegno
YaBB Newbies
Offline
Posts: 10
PGraphics & image size
Nov 22nd , 2006, 11:50pm
Hi, I'm trying to place a image in a Pgraphics buffer. It works fine if the image isn't resized but if i try to assign any value to the image width and height values it just paint a white square of that size... in this code left-click to see the original image and right-click to see what (t.f.) happens when i try to resize it!. http://xs.to/xs.php?h=xs309&d=06473&f=03.gif I'm using this image . everything showed is first drew in the buffer and then showed by the " image(camp,0,0); " command... i think this is a bug of the PGraphics buffer but first i want to know if this is my bug. I'm usign pros-0121 windows xp sp2 java 1.5.0_08 Thanks!!!! (and sorry for my English) int panx = 32; int pany = 32; int cseg = 24; PGraphics camp = createGraphics(panx*10, pany*10, P2D); PImage im3; //int datapx[] = new int[32]; //int datapy[] = new int[32]; void setup() { im3 = loadImage("03.gif"); size((panx*10)+1,(pany*10)+1 ); background(0); frameRate = cseg; smooth(); ellipseMode(CENTER); noFill(); colorMode(HSB,255,255,255); camp.beginDraw(); camp.colorMode (RGB,255,255,255); camp.background (255); camp.strokeWeight(5); camp.stroke(255,0,0); camp.line(0,0,panx*10,pany*10); camp.endDraw(); image(camp,0,0); } // setup void draw (){ // if this code is enabled it will draw random lines in the Pgraphics and then in the normal screen. /* camp.beginDraw(); for(int ali=1;ali<6;ali++){ camp.stroke(random(255),random(255),random(255)); camp.line(random(320),random(320),random(320),random(320)); } camp.endDraw(); image(camp,0,0); */ } // draw void mousePressed (){ if(mouseButton == LEFT){ camp.beginDraw(); camp.image (im3,0,0); camp.endDraw(); image (camp,0,0); } if(mouseButton == RIGHT){ camp.beginDraw(); camp.image (im3,0,0,200,200); camp.endDraw(); image (camp,0,0); } } // mousePressed //*****************************************************************