add loadPixels() to mask() as well

This commit is contained in:
benfry
2008-03-14 02:14:26 +00:00
parent e86262f30c
commit 593b184a2c
2 changed files with 7 additions and 4 deletions

View File

@@ -352,10 +352,9 @@ public class PImage implements PConstants, Cloneable {
int index = y*width + x;
int index2 = 0;
for (int row = y; row < y+h; row++) {
System.arraycopy(pixels, index,
newbie.pixels, index2, w);
index+=width;
index2+=w;
System.arraycopy(pixels, index, newbie.pixels, index2, w);
index += width;
index2 += w;
}
return newbie;
}
@@ -455,6 +454,7 @@ public class PImage implements PConstants, Cloneable {
* performing a proper luminance-based conversion.
*/
public void mask(int alpha[]) {
loadPixels();
// don't execute if mask image is different size
if (alpha.length != pixels.length) {
throw new RuntimeException("The PImage used with mask() must be " +

View File

@@ -23,6 +23,9 @@ _ undo this--may need to be better about specifying screen and all
X PImage mask doesn't work after first call
X http://dev.processing.org/bugs/show_bug.cgi?id=744
_ work through loadPixels in PImage, how consistent do we need to be?
_ with get() and set() methods, this gets really tricky (too slow)
_ change openStream() to createInput()
_ add createOutput() (and raw versions of the same, err.. no raw)
_ deprecate openStream() naming