Bug 522 : set(x, y, image) gives ArrayIndexOutOfBoundsException when canvas is smaller than image.
Last modified: 2007-06-18 19:59




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P3
Severity:
normal

 

Reporter:
chandler
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2007-02-21 10:50
Version: 123
Mac OS X

When using the set(x,y,PImage) syntax to draw an image that has pixels outside of the
canvas area, the user gets an ArrayIndexOutOfBoundsException. Although this does make
sense, it seems like a bug since image() doesn't do this, and it limits the usefulness of set
(x,y,PImage).

Steps to reproduce:

PImage img;
size(300, 300);
img = loadImage("300x300.jpg");
set(10, 10, img);

Changing either the size() or the x and y in set will load the image as expected.
Additional Comment #1 From fry 2007-02-21 12:12
yeah, this comes at the expense of making set() far more complicated and
much slower in those cases, but i think people will be confused when it
doesn't work properly.
Additional Comment #2 From chandler 2007-03-06 10:18
hrm, slow is no good. maybe catch the index out of bounds and throw it with more specific
details?


(In reply to comment #1)
>
>
>
> Additional Comment #1 From
> fry
> 2007-02-21 12:12
>
> <!--
> addReplyLink(1); //-->[reply]
>
>
>
>
> yeah, this comes at the expense of making set() far more complicated and
> much slower in those cases, but i think people will be confused when it
> doesn't work properly.
>
>

Additional Comment #3 From fry 2007-03-07 17:48
well, i think it'll have to be done, there should be a way to do it without
making too much of a mess.
Additional Comment #4 From fry 2007-06-18 19:59
this actually turned out to be a pair of dumb mistakes, so it's all fixed
for 0125.