/** * @nowebref * @param x1 x-coordinate of the upper-left corner * @param y1 y-coordinate of the upper-left corner * @param x2 width of the region * @param y2 height of the region */ public void updatePixels(int x1, int y1, int x2, int y2) { g.updatePixels(x1, y1, x2, y2); }
public void updatePixels() { g.updatePixels(); }
public void updatePixels(int x1, int y1, int x2, int y2) { g.updatePixels(x1, y1, x2, y2); }
/** * ( begin auto-generated from updatePixels.xml ) * * Updates the display window with the data in the <b>pixels[]</b> array. * Use in conjunction with <b>loadPixels()</b>. If you're only reading * pixels from the array, there's no need to call <b>updatePixels()</b> * unless there are changes. * <br/><br/> renderers may or may not seem to require <b>loadPixels()</b> * or <b>updatePixels()</b>. However, the rule is that any time you want to * manipulate the <b>pixels[]</b> array, you must first call * <b>loadPixels()</b>, and after changes have been made, call * <b>updatePixels()</b>. Even if the renderer may not seem to use this * function in the current Processing release, this will always be subject * to change. * <br/> <br/> * Currently, none of the renderers use the additional parameters to * <b>updatePixels()</b>, however this may be implemented in the future. * * ( end auto-generated ) * @webref image:pixels * @see PApplet#loadPixels() * @see PApplet#pixels */ public void updatePixels() { g.updatePixels(); }
PGraphics setAlpha(PGraphics g){ g.loadPixels(); for (int x = 0; x < g.width; x++ ) { for (int y = 0; y < g.height; y++ ) { // Calculate the 1D pixel location int loc = x + y*g.width; g.pixels[loc]=color(0,0); } } g.updatePixels(); return g; }
public void scalePixels(double wRatio,double hRatio, PGraphics viewPort) { viewPort.loadPixels(); int[] PixelsArrayNew = viewPort.pixels.clone(); double x_ratio = wRatio ; double y_ratio = hRatio ; double px, py ; for (int i=0;i<viewPort.height;i++) { for (int j=0;j<viewPort.width;j++) { px = Math.floor(j%(wRatio*viewPort.width)/x_ratio) ; py = Math.floor(i%(hRatio*viewPort.height)/y_ratio) ; viewPort.pixels[(int)(i*viewPort.width)+j] = PixelsArrayNew[(int)((py*viewPort.width)+px)] ; } } viewPort.updatePixels(); }