Resize the Pgraphics!!!
in
Programming Questions
•
2 years ago
I am creating a PGraphics and on the mouse click ,I wish to increase the size of the graphics .But when I am trying to do so I am getting an error :
processing.app.debug.RunnerException: ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at processing.app.Sketch.placeException(Sketch.java:1543)
at processing.app.debug.Runner.findException(Runner.java:582)
at processing.app.debug.Runner.reportException(Runner.java:558)
at processing.app.debug.Runner.exception(Runner.java:498)
at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.IntegerInterleavedRaster.setDataElements(IntegerInterleavedRaster.java:404)
at processing.core.PGraphicsJava2D$ImageCache.update(Unknown Source)
at processing.core.PGraphicsJava2D.imageImpl(Unknown Source)
at processing.core.PGraphics.image(Unknown Source)
at processing.core.PApplet.image(Unknown Source)
at sketch_jun09a.draw(sketch_jun09a.java:32)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
and the code is
I will appreciate any help !!!
Thanks.
processing.app.debug.RunnerException: ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at processing.app.Sketch.placeException(Sketch.java:1543)
at processing.app.debug.Runner.findException(Runner.java:582)
at processing.app.debug.Runner.reportException(Runner.java:558)
at processing.app.debug.Runner.exception(Runner.java:498)
at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.IntegerInterleavedRaster.setDataElements(IntegerInterleavedRaster.java:404)
at processing.core.PGraphicsJava2D$ImageCache.update(Unknown Source)
at processing.core.PGraphicsJava2D.imageImpl(Unknown Source)
at processing.core.PGraphics.image(Unknown Source)
at processing.core.PApplet.image(Unknown Source)
at sketch_jun09a.draw(sketch_jun09a.java:32)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
and the code is
- PGraphics pg;
- void setup()
- {
- size(600,600);
- pg = createGraphics(200,200,P2D);
- }
- void draw()
- {
- pg.beginDraw();
- pg.background(0,255,0);
- pg.endDraw();
- image(pg,0,0);
- }
- void mousePressed()
- {
- pg.resize(300,300);
- println(pg.width);
- }
I will appreciate any help !!!
Thanks.
1