Bug 1245 : PImage cacheMap problem when using PImage.get()
Last modified: 2009-05-14 12:56



Assigned To:

Attachment Type Created Size Actions

Description:   Opened: 2009-05-14 00:42
I have been using core.jar from pde version 1.0.3 (how do I get the
revision number?), but the problem exists in the latest source too I
believe. Mac OS X, MacBook Pro

PImage.get() method uses Object.clone() and handles pixel array correctly,
but do not reset the cacheMap. E.g. when using OpenGL, texture is saved to
PImage's cacheMap once the image is drawn. When making copy of the PImage
with get() method, the cacheMap variable in new object points to the same
HashMap obejct as in original object. When doing some modifications to the
new object, (at least) OpenGL updates the cached texture in the HashMap,
which is same for the original and new. For that reason, when drawing
PImages to sketch (with PApplet.image()), the original and the new image
are the same.

I think the easiest way to correct this is to set cacheMap null in
PImage.get(). (I didn't know the process how to contribute to the core code
and I also think that somebody could verify this :)

If needed, I could try to provide some code examples, but the bug is pretty
clear in my opinion.
Additional Comment #1 From fry 2009-05-14 12:56
thanks, now fixed in svn for the next release (1.0.4).