From 9e0170c2bc6b03f18b86e09227b5704d1f0239f6 Mon Sep 17 00:00:00 2001 From: benfry Date: Fri, 26 Feb 2010 20:00:58 +0000 Subject: [PATCH] cleaning --- .../processing/core/PGraphicsAndroid2D.java | 122 +----------------- android/core/src/processing/core/PImage.java | 41 +----- 2 files changed, 4 insertions(+), 159 deletions(-) diff --git a/android/core/src/processing/core/PGraphicsAndroid2D.java b/android/core/src/processing/core/PGraphicsAndroid2D.java index 3125228bf..bd58975f2 100644 --- a/android/core/src/processing/core/PGraphicsAndroid2D.java +++ b/android/core/src/processing/core/PGraphicsAndroid2D.java @@ -924,127 +924,7 @@ public class PGraphicsAndroid2D extends PGraphics { } -// class ImageCache { -// PImage source; -// boolean tinted; -// int tintedColor; -// int tintedPixels[]; // one row of tinted pixels -// BufferedImage image; -// -// public ImageCache(PImage source) { -// this.source = source; -// // even if RGB, set the image type to ARGB, because the -// // image may have an alpha value for its tint(). -//// int type = BufferedImage.TYPE_INT_ARGB; -// //System.out.println("making new buffered image"); -//// image = new BufferedImage(source.width, source.height, type); -// } -// -// /** -// * Update the pixels of the cache image. Already determined that the tint -// * has changed, or the pixels have changed, so should just go through -// * with the update without further checks. -// */ -// public void update(boolean tint, int tintColor) { -// int bufferType = BufferedImage.TYPE_INT_ARGB; -// boolean opaque = (tintColor & 0xFF000000) == 0xFF000000; -// if (source.format == RGB) { -// if (!tint || (tint && opaque)) { -// bufferType = BufferedImage.TYPE_INT_RGB; -// } -// } -// boolean wrongType = (image != null) && (image.getType() != bufferType); -// if ((image == null) || wrongType) { -// image = new BufferedImage(source.width, source.height, bufferType); -// } -// -// WritableRaster wr = image.getRaster(); -// if (tint) { -// if (tintedPixels == null || tintedPixels.length != source.width) { -// tintedPixels = new int[source.width]; -// } -// int a2 = (tintColor >> 24) & 0xff; -// int r2 = (tintColor >> 16) & 0xff; -// int g2 = (tintColor >> 8) & 0xff; -// int b2 = (tintColor) & 0xff; -// -// if (bufferType == BufferedImage.TYPE_INT_RGB) { -// //int alpha = tintColor & 0xFF000000; -// int index = 0; -// for (int y = 0; y < source.height; y++) { -// for (int x = 0; x < source.width; x++) { -// int argb1 = source.pixels[index++]; -// int r1 = (argb1 >> 16) & 0xff; -// int g1 = (argb1 >> 8) & 0xff; -// int b1 = (argb1) & 0xff; -// -// tintedPixels[x] = //0xFF000000 | -// (((r2 * r1) & 0xff00) << 8) | -// ((g2 * g1) & 0xff00) | -// (((b2 * b1) & 0xff00) >> 8); -// } -// wr.setDataElements(0, y, source.width, 1, tintedPixels); -// } -// // could this be any slower? -//// float[] scales = { tintR, tintG, tintB }; -//// float[] offsets = new float[3]; -//// RescaleOp op = new RescaleOp(scales, offsets, null); -//// op.filter(image, image); -// -// } else if (bufferType == BufferedImage.TYPE_INT_ARGB) { -// int index = 0; -// for (int y = 0; y < source.height; y++) { -// if (source.format == RGB) { -// int alpha = tintColor & 0xFF000000; -// for (int x = 0; x < source.width; x++) { -// int argb1 = source.pixels[index++]; -// int r1 = (argb1 >> 16) & 0xff; -// int g1 = (argb1 >> 8) & 0xff; -// int b1 = (argb1) & 0xff; -// tintedPixels[x] = alpha | -// (((r2 * r1) & 0xff00) << 8) | -// ((g2 * g1) & 0xff00) | -// (((b2 * b1) & 0xff00) >> 8); -// } -// } else if (source.format == ARGB) { -// for (int x = 0; x < source.width; x++) { -// int argb1 = source.pixels[index++]; -// int a1 = (argb1 >> 24) & 0xff; -// int r1 = (argb1 >> 16) & 0xff; -// int g1 = (argb1 >> 8) & 0xff; -// int b1 = (argb1) & 0xff; -// tintedPixels[x] = -// (((a2 * a1) & 0xff00) << 16) | -// (((r2 * r1) & 0xff00) << 8) | -// ((g2 * g1) & 0xff00) | -// (((b2 * b1) & 0xff00) >> 8); -// } -// } else if (source.format == ALPHA) { -// int lower = tintColor & 0xFFFFFF; -// for (int x = 0; x < source.width; x++) { -// int a1 = source.pixels[index++]; -// tintedPixels[x] = -// (((a2 * a1) & 0xff00) << 16) | lower; -// } -// } -// wr.setDataElements(0, y, source.width, 1, tintedPixels); -// } -// // Not sure why ARGB images take the scales in this order... -//// float[] scales = { tintR, tintG, tintB, tintA }; -//// float[] offsets = new float[4]; -//// RescaleOp op = new RescaleOp(scales, offsets, null); -//// op.filter(image, image); -// } -// } else { -// wr.setDataElements(0, 0, source.width, source.height, source.pixels); -// } -// this.tinted = tint; -// this.tintedColor = tintColor; -// } -// } - - - + ////////////////////////////////////////////////////////////// // SHAPE diff --git a/android/core/src/processing/core/PImage.java b/android/core/src/processing/core/PImage.java index cb592ff2e..fd6e84b4a 100644 --- a/android/core/src/processing/core/PImage.java +++ b/android/core/src/processing/core/PImage.java @@ -120,15 +120,6 @@ public class PImage implements PConstants, Cloneable { */ public PImage(int width, int height) { init(width, height, RGB); - - // toxi: is it maybe better to init the image with max alpha enabled? - //for(int i=0; i