Bug 1487 : for efficiency, resize() should use the android image resizing code
Last modified: 2010-03-08 10:55




Status:
ASSIGNED
Resolution:
-
Priority:
P5
Severity:
normal

 

Reporter:
fry
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2010-02-28 05:37
right now it's using the expensive copy() operation inside PImage. no need
to do that, and it's probably lower quality.
Additional Comment #1 From Lonnen 2010-03-06 13:43
I poked around the API and the android developers mailing list for resize code. The methods I see
all rely on createBitmap(), which throws an IllegalArgumentException if the new image is larger
than the image being resized. It doesn't look like the native android code allows the image to be
sized up.
Additional Comment #2 From fry 2010-03-08 10:55
interesting. good to know.

so that probably means the fix is to create a Bitmap of the new size, draw
the image into it (using Canvas if necessary) to fill it, then replace the
PImage.bitmap with the new one and dispose of the other.

though i wonder how that actually fares in comparison to the current method
(in terms of speed and memory use). might not be an outright win.
This bug is now being tracked here.