We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have a PGraphics object in a costume class, everything works fine, until I try drawing it with the image() function. This returns an ArrayIndexOutOfBoundsException, makes no sense.
Answers
Seems to be related to the pixelDensity() setting.
Try using
image((PImage)x);
, where x is the PGraphics object.Are you calling
pixelDensity()
only once, and immediately aftersize()
, as per the pixelDensity reference page?The ArrayIndexOutOfBoundsException usually means that something expected your PGraphics / PImage to be one size, but when it tried reading discovered that it was actually a different size. Adding an explicit size at creation time -- or co-ercing it into another form, like a PImage -- or avoiding the resizing/redensity-ing that caused the mismatch in the first place -- these might be solutions.
A possibly related open bug: