Loading...
Logo
Processing Forum
mids95's Profile
1 Posts
2 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    Hi everyone,

    I'm trying to display an image with the same resolution of the screen. For this I use this code:

    1.   PImage img;
    2.    public void setup() {
    3.      size(displayWidth, displayHeight);
    4.      img=loadImage("image.jpg");
    5.       fondo.resize(width,height);
    6.         }
    7.     public void draw() {
    8.      image(img,0,0);
    9.       }
    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