Bug 1482 : copy and blend scale when unnecessary
Last modified: 2010-06-06 07:31



Assigned To:

Attachment Type Created Size Actions
Example sketch with image. application/x-zip-compressed 2010-02-26 23:11 1.03 KB

Description:   Opened: 2010-02-26 23:10
Processing 1.0.9

I believe the following code demonstrates a bug with respects to the copy and blend functions.
Given an image (in this case 32x32), if we use the image(PImage img, int dx, int dy) to copy an
image to a location the image is drawn accurately pixel for pixel without scaling. However if you use
one of the following calls:

copy(src, sx, sy, 32, 32, dx, dy, 32, 32)
blend(src, sx, sy, 32, 32, dx, dy, 32, 32, REPLACE)

the resulting image is bilaterally filtered an the results from the copy() and blend() don't look the
same as when the image() method is used. I've attached sample code below. Assume that
example.png is a 32x32 icon.


PImage myImage;

void setup()
myImage = loadImage("example.png");

size(300, 300);

void draw()
image(myImage, 32, 32);
copy(myImage, 0, 0, 32, 32, 0, 32, 32, 32);
blend(myImage, 0, 0, 32, 32, 64, 32, 32, 32, REPLACE);
Additional Comment #1 From animeaholic 2010-02-26 23:11
Example sketch with image.
Additional Comment #2 From fry 2010-03-01 04:40
thanks, will look into it. should be a simple fix.

though for the copy() and blend(... REPLACE) case, you can just use get()
or set(), which will be faster in the meantime.
Additional Comment #3 From Lonnen 2010-04-10 08:44
I just looked at the test sketch this seems to be fixed in Build 0183.
Additional Comment #4 From fry 2010-04-10 08:46
thanks for checking into it. close it.
Additional Comment #5 From fry 2010-06-06 07:31
*** Bug 1574 has been marked as a duplicate of this bug. ***