From dc2bb9b0b8115b775dc37bb2828503a79262b96e Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 2 Sep 2012 01:16:16 +0000 Subject: [PATCH] hide unapproved, other cleanups --- core/.settings/org.eclipse.jdt.core.prefs | 2 +- core/src/processing/core/PApplet.java | 206 +++++------------- core/src/processing/core/PImage.java | 3 +- .../processing/opengl/PGraphicsOpenGL.java | 10 +- 4 files changed, 59 insertions(+), 162 deletions(-) diff --git a/core/.settings/org.eclipse.jdt.core.prefs b/core/.settings/org.eclipse.jdt.core.prefs index bc90b9a0d..0c08b2e5b 100644 --- a/core/.settings/org.eclipse.jdt.core.prefs +++ b/core/.settings/org.eclipse.jdt.core.prefs @@ -70,7 +70,7 @@ org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 3d82b5ef3..407c509f1 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -5709,7 +5709,7 @@ public class PApplet extends Applet String callbackMethod, Object callbackObject) { try { - Class callbackClass = callbackObject.getClass(); + Class callbackClass = callbackObject.getClass(); Method selectMethod = callbackClass.getMethod(callbackMethod, new Class[] { File.class }); selectMethod.invoke(callbackObject, new Object[] { selectedFile }); @@ -8924,6 +8924,7 @@ public class PApplet extends Applet return g.color(gray); } + /** * @nowebref * @param fgray number specifying value between white and black @@ -8940,7 +8941,6 @@ public class PApplet extends Applet /** * As of 0116 this also takes color(#FF8800, alpha) - * * @param alpha relative to current color range */ public final int color(int gray, int alpha) { @@ -8957,6 +8957,7 @@ public class PApplet extends Applet return g.color(gray, alpha); } + /** * @nowebref */ @@ -8971,6 +8972,7 @@ public class PApplet extends Applet return g.color(fgray, falpha); } + /** * @param v1 red or hue values relative to the current color range * @param v2 green or saturation values relative to the current color range @@ -8987,6 +8989,7 @@ public class PApplet extends Applet return g.color(v1, v2, v3); } + public final int color(int v1, int v2, int v3, int alpha) { if (g == null) { if (alpha > 255) alpha = 255; else if (alpha < 0) alpha = 0; @@ -8999,6 +9002,7 @@ public class PApplet extends Applet return g.color(v1, v2, v3, alpha); } + public final int color(float v1, float v2, float v3) { if (g == null) { if (v1 > 255) v1 = 255; else if (v1 < 0) v1 = 0; @@ -9010,6 +9014,7 @@ public class PApplet extends Applet return g.color(v1, v2, v3); } + public final int color(float v1, float v2, float v3, float alpha) { if (g == null) { if (alpha > 255) alpha = 255; else if (alpha < 0) alpha = 0; @@ -9023,6 +9028,11 @@ public class PApplet extends Applet } + static public int blendColor(int c1, int c2, int mode) { + return PImage.blendColor(c1, c2, mode); + } + + ////////////////////////////////////////////////////////////// @@ -9895,6 +9905,44 @@ public class PApplet extends Applet // public functions for processing.core + /** + * Store data of some kind for the renderer that requires extra metadata of + * some kind. Usually this is a renderer-specific representation of the + * image data, for instance a BufferedImage with tint() settings applied for + * PGraphicsJava2D, or resized image data and OpenGL texture indices for + * PGraphicsOpenGL. + * @param renderer The PGraphics renderer associated to the image + * @param storage The metadata required by the renderer + */ + public void setCache(PImage image, Object storage) { + if (recorder != null) recorder.setCache(image, storage); + g.setCache(image, storage); + } + + + /** + * Get cache storage data for the specified renderer. Because each renderer + * will cache data in different formats, it's necessary to store cache data + * keyed by the renderer object. Otherwise, attempting to draw the same + * image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors. + * @param renderer The PGraphics renderer associated to the image + * @return metadata stored for the specified renderer + */ + public Object getCache(PImage image) { + return g.getCache(image); + } + + + /** + * Remove information associated with this renderer from the cache, if any. + * @param renderer The PGraphics renderer whose cache data should be removed + */ + public void removeCache(PImage image) { + if (recorder != null) recorder.removeCache(image); + g.removeCache(image); + } + + public PGL beginPGL() { return g.beginPGL(); } @@ -14016,76 +14064,6 @@ public class PApplet extends Applet } - /** - * Store data of some kind for a renderer that requires extra metadata of - * some kind. Usually this is a renderer-specific representation of the - * image data, for instance a BufferedImage with tint() settings applied for - * PGraphicsJava2D, or resized image data and OpenGL texture indices for - * PGraphicsOpenGL. - * @param renderer The PGraphics renderer associated to the image - * @param storage The metadata required by the renderer - */ - public void setCache(PGraphics renderer, Object storage) { - if (recorder != null) recorder.setCache(renderer, storage); - g.setCache(renderer, storage); - } - - - /** - * Get cache storage data for the specified renderer. Because each renderer - * will cache data in different formats, it's necessary to store cache data - * keyed by the renderer object. Otherwise, attempting to draw the same - * image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors. - * @param renderer The PGraphics renderer associated to the image - * @return metadata stored for the specified renderer - */ - public Object getCache(PGraphics renderer) { - return g.getCache(renderer); - } - - - /** - * Remove information associated with this renderer from the cache, if any. - * @param renderer The PGraphics renderer whose cache data should be removed - */ - public void removeCache(PGraphics renderer) { - if (recorder != null) recorder.removeCache(renderer); - g.removeCache(renderer); - } - - -// /** -// * Store parameters for a renderer that requires extra metadata of -// * some kind. -// * @param renderer The PGraphics renderer associated to the image -// * @param storage The parameters required by the renderer -// */ -// public void setParams(PGraphics renderer, Object params) { -// if (recorder != null) recorder.setParams(renderer, params); -// g.setParams(renderer, params); -// } -// -// -// /** -// * Get the parameters for the specified renderer. -// * @param renderer The PGraphics renderer associated to the image -// * @return parameters stored for the specified renderer -// */ -// public Object getParams(PGraphics renderer) { -// return g.getParams(renderer); -// } -// -// -// /** -// * Remove information associated with this renderer from the cache, if any. -// * @param renderer The PGraphics renderer whose parameters should be removed -// */ -// public void removeParams(PGraphics renderer) { -// if (recorder != null) recorder.removeParams(renderer); -// g.removeParams(renderer); -// } - - /** * ( begin auto-generated from PImage_get.xml ) * @@ -14370,90 +14348,6 @@ public class PApplet extends Applet } - /** - * ( begin auto-generated from blendColor.xml ) - * - * Blends two color values together based on the blending mode given as the - * MODE parameter. The possible modes are described in the reference - * for the blend() function. - * - * ( end auto-generated ) - *

Advanced

- * - *

A useful reference for blending modes and their algorithms can be - * found in the SVG - * specification.

- *

It is important to note that Processing uses "fast" code, not - * necessarily "correct" code. No biggie, most software does. A nitpicker - * can find numerous "off by 1 division" problems in the blend code where - * >>8 or >>7 is used when strictly speaking - * /255.0 or /127.0 should have been used.

- *

For instance, exclusion (not intended for real-time use) reads - * r1 + r2 - ((2 * r1 * r2) / 255) because 255 == 1.0 - * not 256 == 1.0. In other words, (255*255)>>8 is not - * the same as (255*255)/255. But for real-time use the shifts - * are preferrable, and the difference is insignificant for applications - * built with Processing.

- * - * @webref color:creating_reading - * @usage web_application - * @param c1 the first color to blend - * @param c2 the second color to blend - * @param mode either BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, or BURN - * @see PImage#blend(PImage, int, int, int, int, int, int, int, int, int) - * @see PApplet#color(float, float, float, float) - */ - static public int blendColor(int c1, int c2, int mode) { - return PImage.blendColor(c1, c2, mode); - } - - public void blend(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mode) { if (recorder != null) recorder.blend(sx, sy, sw, sh, dx, dy, dw, dh, mode); diff --git a/core/src/processing/core/PImage.java b/core/src/processing/core/PImage.java index fd507b553..4e536e7c1 100644 --- a/core/src/processing/core/PImage.java +++ b/core/src/processing/core/PImage.java @@ -1629,7 +1629,7 @@ public class PImage implements PConstants, Cloneable { * @see PImage#blend(PImage, int, int, int, int, int, int, int, int, int) * @see PApplet#color(float, float, float, float) */ - static public int blendColor(int c1, int c2, int mode) { + static public int blendColor(int c1, int c2, int mode) { // ignore switch (mode) { case REPLACE: return c2; case BLEND: return blend_blend(c1, c2); @@ -1656,6 +1656,7 @@ public class PImage implements PConstants, Cloneable { return 0; } + public void blend(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mode) { blend(this, sx, sy, sw, sh, dx, dy, dw, dh, mode); diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index ed835e272..54c72517f 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -1656,7 +1656,7 @@ public class PGraphicsOpenGL extends PGraphics { // The screen texture should be deleted because it // corresponds to the old window size. pgPrimary.removeCache(this); - this.removeParams(pgPrimary); + pgPrimary.removeParams(this); texture = null; loadTexture(); } @@ -3372,7 +3372,8 @@ public class PGraphicsOpenGL extends PGraphics { // public void shapeMode(int mode) - public void shape(PShape shape, float x, float y, float z) { + // TODO unapproved + protected void shape(PShape shape, float x, float y, float z) { if (shape.isVisible()) { // don't do expensive matrix ops if invisible flush(); @@ -3392,8 +3393,9 @@ public class PGraphicsOpenGL extends PGraphics { } - public void shape(PShape shape, float x, float y, float z, float c, float d, - float e) { + // TODO unapproved + protected void shape(PShape shape, float x, float y, float z, + float c, float d, float e) { if (shape.isVisible()) { // don't do expensive matrix ops if invisible flush();