Problem with PImage resize
in
Android Processing
•
8 months ago
Hi everyone,
I'm trying to display an image with the same resolution of the screen. For this I use this code:
I'm trying to display an image with the same resolution of the screen. For this I use this code:
- PImage img;
- public void setup() {
- size(displayWidth, displayHeight);
- img=loadImage("image.jpg");
- fondo.resize(width,height);
- }
- public void draw() {
- image(img,0,0);
- }
But I get this:
FATAL EXCEPTION: Animation Thread
java.lang.NullPointerException
at android.graphics.Bitmap.checkPixelsAccess(Bitmap.java:834)
at android.graphics.Bitmap.setPixels(Bitmap.java:892)
at processing.core.PGraphicsAndroid2D.imageImpl(Unknown Source)
at processing.core.PGraphics.image(Unknown Source)
at processing.core.PApplet.image(Unknown Source)
at processing.test.takeone.TakeOne.draw(TakeOne.java:27)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:1019)
If I comment the line of resize, this problem doesn't appear.
Note: In the Processing IDE, the resize method is turned in bold, but any other method not.
Thanks a lot
FATAL EXCEPTION: Animation Thread
java.lang.NullPointerException
at android.graphics.Bitmap.checkPixelsAccess(Bitmap.java:834)
at android.graphics.Bitmap.setPixels(Bitmap.java:892)
at processing.core.PGraphicsAndroid2D.imageImpl(Unknown Source)
at processing.core.PGraphics.image(Unknown Source)
at processing.core.PApplet.image(Unknown Source)
at processing.test.takeone.TakeOne.draw(TakeOne.java:27)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:1019)
If I comment the line of resize, this problem doesn't appear.
Note: In the Processing IDE, the resize method is turned in bold, but any other method not.
Thanks a lot
1