In an Android application that I've written using Processing 2 I have the following:
void setup() {
if (cam == null) cam = new KetaiCamera(this, camWidth, camHeight, 30);
}
void draw() {
img = cam.get();
img.loadPixels();
img.updatePixels();
// render the original image to screen, seems to be necessary before resizing...
image(img, width/2, height/2, height, width);
img.resize(7, 5);
img.loadPixels();
// render the scaled image over the original one
image(img, width/2, height/2, height, width);
}
This has always worked fine for me while using the Processing 2 Android lib. Now I'm trying to port this to Processing 3. I had to change some details (e.g. width
, height
have become displayWidth
, displayHeight
) but what bothers me most is that I'm not able to display the scaled image over the original one. I suspecting it's related to resize()
not working quite as expected but I don't know for sure. I am simply not seeing the image though I don't get an error. For testing purposes I checked the color of the first pixel of the resized image - I'm always getting 0, 0, 0 which is certainly not right but doesn't explain why I'm not seeing the image.
Does anyone know what might cause the problem? Have there been any changes between p2 and 3 regarding how resize()
works?
Thanks very much, Stefan