From 593b184a2ca017f005c676ece37671bb3e373429 Mon Sep 17 00:00:00 2001 From: benfry Date: Fri, 14 Mar 2008 02:14:26 +0000 Subject: [PATCH] add loadPixels() to mask() as well --- core/src/processing/core/PImage.java | 8 ++++---- core/todo.txt | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/processing/core/PImage.java b/core/src/processing/core/PImage.java index 01f2bd8fb..ddf569ab8 100644 --- a/core/src/processing/core/PImage.java +++ b/core/src/processing/core/PImage.java @@ -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 " + diff --git a/core/todo.txt b/core/todo.txt index ec06c2daa..2f66c6930 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -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