@@ -5709,7 +5709,7 @@ static private void selectCallback(File selectedFile,
57095709 String callbackMethod ,
57105710 Object callbackObject ) {
57115711 try {
5712- Class callbackClass = callbackObject .getClass ();
5712+ Class <?> callbackClass = callbackObject .getClass ();
57135713 Method selectMethod =
57145714 callbackClass .getMethod (callbackMethod , new Class [] { File .class });
57155715 selectMethod .invoke (callbackObject , new Object [] { selectedFile });
@@ -8924,6 +8924,7 @@ public final int color(int gray) {
89248924 return g .color (gray );
89258925 }
89268926
8927+
89278928 /**
89288929 * @nowebref
89298930 * @param fgray number specifying value between white and black
@@ -8940,7 +8941,6 @@ public final int color(float fgray) {
89408941
89418942 /**
89428943 * As of 0116 this also takes color(#FF8800, alpha)
8943- *
89448944 * @param alpha relative to current color range
89458945 */
89468946 public final int color (int gray , int alpha ) {
@@ -8957,6 +8957,7 @@ public final int color(int gray, int alpha) {
89578957 return g .color (gray , alpha );
89588958 }
89598959
8960+
89608961 /**
89618962 * @nowebref
89628963 */
@@ -8971,6 +8972,7 @@ public final int color(float fgray, float falpha) {
89718972 return g .color (fgray , falpha );
89728973 }
89738974
8975+
89748976 /**
89758977 * @param v1 red or hue values relative to the current color range
89768978 * @param v2 green or saturation values relative to the current color range
@@ -8987,6 +8989,7 @@ public final int color(int v1, int v2, int v3) {
89878989 return g .color (v1 , v2 , v3 );
89888990 }
89898991
8992+
89908993 public final int color (int v1 , int v2 , int v3 , int alpha ) {
89918994 if (g == null ) {
89928995 if (alpha > 255 ) alpha = 255 ; else if (alpha < 0 ) alpha = 0 ;
@@ -8999,6 +9002,7 @@ public final int color(int v1, int v2, int v3, int alpha) {
89999002 return g .color (v1 , v2 , v3 , alpha );
90009003 }
90019004
9005+
90029006 public final int color (float v1 , float v2 , float v3 ) {
90039007 if (g == null ) {
90049008 if (v1 > 255 ) v1 = 255 ; else if (v1 < 0 ) v1 = 0 ;
@@ -9010,6 +9014,7 @@ public final int color(float v1, float v2, float v3) {
90109014 return g .color (v1 , v2 , v3 );
90119015 }
90129016
9017+
90139018 public final int color (float v1 , float v2 , float v3 , float alpha ) {
90149019 if (g == null ) {
90159020 if (alpha > 255 ) alpha = 255 ; else if (alpha < 0 ) alpha = 0 ;
@@ -9023,6 +9028,11 @@ public final int color(float v1, float v2, float v3, float alpha) {
90239028 }
90249029
90259030
9031+ static public int blendColor (int c1 , int c2 , int mode ) {
9032+ return PImage .blendColor (c1 , c2 , mode );
9033+ }
9034+
9035+
90269036
90279037 //////////////////////////////////////////////////////////////
90289038
@@ -9895,6 +9905,44 @@ public void updatePixels(int x1, int y1, int x2, int y2) {
98959905 // public functions for processing.core
98969906
98979907
9908+ /**
9909+ * Store data of some kind for the renderer that requires extra metadata of
9910+ * some kind. Usually this is a renderer-specific representation of the
9911+ * image data, for instance a BufferedImage with tint() settings applied for
9912+ * PGraphicsJava2D, or resized image data and OpenGL texture indices for
9913+ * PGraphicsOpenGL.
9914+ * @param renderer The PGraphics renderer associated to the image
9915+ * @param storage The metadata required by the renderer
9916+ */
9917+ public void setCache (PImage image , Object storage ) {
9918+ if (recorder != null ) recorder .setCache (image , storage );
9919+ g .setCache (image , storage );
9920+ }
9921+
9922+
9923+ /**
9924+ * Get cache storage data for the specified renderer. Because each renderer
9925+ * will cache data in different formats, it's necessary to store cache data
9926+ * keyed by the renderer object. Otherwise, attempting to draw the same
9927+ * image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors.
9928+ * @param renderer The PGraphics renderer associated to the image
9929+ * @return metadata stored for the specified renderer
9930+ */
9931+ public Object getCache (PImage image ) {
9932+ return g .getCache (image );
9933+ }
9934+
9935+
9936+ /**
9937+ * Remove information associated with this renderer from the cache, if any.
9938+ * @param renderer The PGraphics renderer whose cache data should be removed
9939+ */
9940+ public void removeCache (PImage image ) {
9941+ if (recorder != null ) recorder .removeCache (image );
9942+ g .removeCache (image );
9943+ }
9944+
9945+
98989946 public PGL beginPGL () {
98999947 return g .beginPGL ();
99009948 }
@@ -14016,76 +14064,6 @@ public boolean isGL() {
1401614064 }
1401714065
1401814066
14019- /**
14020- * Store data of some kind for a renderer that requires extra metadata of
14021- * some kind. Usually this is a renderer-specific representation of the
14022- * image data, for instance a BufferedImage with tint() settings applied for
14023- * PGraphicsJava2D, or resized image data and OpenGL texture indices for
14024- * PGraphicsOpenGL.
14025- * @param renderer The PGraphics renderer associated to the image
14026- * @param storage The metadata required by the renderer
14027- */
14028- public void setCache (PGraphics renderer , Object storage ) {
14029- if (recorder != null ) recorder .setCache (renderer , storage );
14030- g .setCache (renderer , storage );
14031- }
14032-
14033-
14034- /**
14035- * Get cache storage data for the specified renderer. Because each renderer
14036- * will cache data in different formats, it's necessary to store cache data
14037- * keyed by the renderer object. Otherwise, attempting to draw the same
14038- * image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors.
14039- * @param renderer The PGraphics renderer associated to the image
14040- * @return metadata stored for the specified renderer
14041- */
14042- public Object getCache (PGraphics renderer ) {
14043- return g .getCache (renderer );
14044- }
14045-
14046-
14047- /**
14048- * Remove information associated with this renderer from the cache, if any.
14049- * @param renderer The PGraphics renderer whose cache data should be removed
14050- */
14051- public void removeCache (PGraphics renderer ) {
14052- if (recorder != null ) recorder .removeCache (renderer );
14053- g .removeCache (renderer );
14054- }
14055-
14056-
14057- // /**
14058- // * Store parameters for a renderer that requires extra metadata of
14059- // * some kind.
14060- // * @param renderer The PGraphics renderer associated to the image
14061- // * @param storage The parameters required by the renderer
14062- // */
14063- // public void setParams(PGraphics renderer, Object params) {
14064- // if (recorder != null) recorder.setParams(renderer, params);
14065- // g.setParams(renderer, params);
14066- // }
14067- //
14068- //
14069- // /**
14070- // * Get the parameters for the specified renderer.
14071- // * @param renderer The PGraphics renderer associated to the image
14072- // * @return parameters stored for the specified renderer
14073- // */
14074- // public Object getParams(PGraphics renderer) {
14075- // return g.getParams(renderer);
14076- // }
14077- //
14078- //
14079- // /**
14080- // * Remove information associated with this renderer from the cache, if any.
14081- // * @param renderer The PGraphics renderer whose parameters should be removed
14082- // */
14083- // public void removeParams(PGraphics renderer) {
14084- // if (recorder != null) recorder.removeParams(renderer);
14085- // g.removeParams(renderer);
14086- // }
14087-
14088-
1408914067 /**
1409014068 * ( begin auto-generated from PImage_get.xml )
1409114069 *
@@ -14370,90 +14348,6 @@ public void copy(PImage src,
1437014348 }
1437114349
1437214350
14373- /**
14374- * ( begin auto-generated from blendColor.xml )
14375- *
14376- * Blends two color values together based on the blending mode given as the
14377- * <b>MODE</b> parameter. The possible modes are described in the reference
14378- * for the <b>blend()</b> function.
14379- *
14380- * ( end auto-generated )
14381- * <h3>Advanced</h3>
14382- * <UL>
14383- * <LI>REPLACE - destination colour equals colour of source pixel: C = A.
14384- * Sometimes called "Normal" or "Copy" in other software.
14385- *
14386- * <LI>BLEND - linear interpolation of colours:
14387- * <TT>C = A*factor + B</TT>
14388- *
14389- * <LI>ADD - additive blending with white clip:
14390- * <TT>C = min(A*factor + B, 255)</TT>.
14391- * Clipped to 0..255, Photoshop calls this "Linear Burn",
14392- * and Director calls it "Add Pin".
14393- *
14394- * <LI>SUBTRACT - substractive blend with black clip:
14395- * <TT>C = max(B - A*factor, 0)</TT>.
14396- * Clipped to 0..255, Photoshop calls this "Linear Dodge",
14397- * and Director calls it "Subtract Pin".
14398- *
14399- * <LI>DARKEST - only the darkest colour succeeds:
14400- * <TT>C = min(A*factor, B)</TT>.
14401- * Illustrator calls this "Darken".
14402- *
14403- * <LI>LIGHTEST - only the lightest colour succeeds:
14404- * <TT>C = max(A*factor, B)</TT>.
14405- * Illustrator calls this "Lighten".
14406- *
14407- * <LI>DIFFERENCE - subtract colors from underlying image.
14408- *
14409- * <LI>EXCLUSION - similar to DIFFERENCE, but less extreme.
14410- *
14411- * <LI>MULTIPLY - Multiply the colors, result will always be darker.
14412- *
14413- * <LI>SCREEN - Opposite multiply, uses inverse values of the colors.
14414- *
14415- * <LI>OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values,
14416- * and screens light values.
14417- *
14418- * <LI>HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower.
14419- *
14420- * <LI>SOFT_LIGHT - Mix of DARKEST and LIGHTEST.
14421- * Works like OVERLAY, but not as harsh.
14422- *
14423- * <LI>DODGE - Lightens light tones and increases contrast, ignores darks.
14424- * Called "Color Dodge" in Illustrator and Photoshop.
14425- *
14426- * <LI>BURN - Darker areas are applied, increasing contrast, ignores lights.
14427- * Called "Color Burn" in Illustrator and Photoshop.
14428- * </UL>
14429- * <P>A useful reference for blending modes and their algorithms can be
14430- * found in the <A HREF="http://www.w3.org/TR/SVG12/rendering.html">SVG</A>
14431- * specification.</P>
14432- * <P>It is important to note that Processing uses "fast" code, not
14433- * necessarily "correct" code. No biggie, most software does. A nitpicker
14434- * can find numerous "off by 1 division" problems in the blend code where
14435- * <TT>>>8</TT> or <TT>>>7</TT> is used when strictly speaking
14436- * <TT>/255.0</T> or <TT>/127.0</TT> should have been used.</P>
14437- * <P>For instance, exclusion (not intended for real-time use) reads
14438- * <TT>r1 + r2 - ((2 * r1 * r2) / 255)</TT> because <TT>255 == 1.0</TT>
14439- * not <TT>256 == 1.0</TT>. In other words, <TT>(255*255)>>8</TT> is not
14440- * the same as <TT>(255*255)/255</TT>. But for real-time use the shifts
14441- * are preferrable, and the difference is insignificant for applications
14442- * built with Processing.</P>
14443- *
14444- * @webref color:creating_reading
14445- * @usage web_application
14446- * @param c1 the first color to blend
14447- * @param c2 the second color to blend
14448- * @param mode either BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, or BURN
14449- * @see PImage#blend(PImage, int, int, int, int, int, int, int, int, int)
14450- * @see PApplet#color(float, float, float, float)
14451- */
14452- static public int blendColor (int c1 , int c2 , int mode ) {
14453- return PImage .blendColor (c1 , c2 , mode );
14454- }
14455-
14456-
1445714351 public void blend (int sx , int sy , int sw , int sh ,
1445814352 int dx , int dy , int dw , int dh , int mode ) {
1445914353 if (recorder != null ) recorder .blend (sx , sy , sw , sh , dx , dy , dw , dh , mode );
0 commit comments