4040import javafx .scene .transform .Transform ;
4141
4242
43- public class PGraphicsFX extends PGraphics {
43+ public class PGraphicsFX2D extends PGraphics {
4444 GraphicsContext context ;
4545
4646 static final WritablePixelFormat <IntBuffer > argbFormat =
@@ -89,7 +89,7 @@ public class PGraphicsFX extends PGraphics {
8989 // INTERNAL
9090
9191
92- public PGraphicsFX () { }
92+ public PGraphicsFX2D () { }
9393
9494
9595 //public void setParent(PApplet parent)
@@ -433,14 +433,14 @@ public void endShape(int mode) {
433433 @ Override
434434 protected void clipImpl (float x1 , float y1 , float x2 , float y2 ) {
435435 //g2.setClip(new Rectangle2D.Float(x1, y1, x2 - x1, y2 - y1));
436- showMethodWarning ("clip()" );
436+ showTodoWarning ("clip()" , 3274 );
437437 }
438438
439439
440440 @ Override
441441 public void noClip () {
442442 //g2.setClip(null);
443- showMethodWarning ("noClip()" );
443+ showTodoWarning ("noClip()" , 3274 );
444444 }
445445
446446
@@ -452,7 +452,7 @@ public void noClip() {
452452
453453 @ Override
454454 protected void blendModeImpl () {
455- showMethodWarning ("blendMode()" );
455+ showTodoWarning ("blendMode()" , 3275 );
456456 }
457457
458458
@@ -832,7 +832,7 @@ public void bezierDetail(int detail) { }
832832 //public float curveTangent(float a, float b, float c, float d, float t)
833833
834834
835- /** Ignored (not needed) in Java 2D . */
835+ /** Ignored (not needed) by this renderer . */
836836 @ Override
837837 public void curveDetail (int detail ) { }
838838
@@ -965,28 +965,6 @@ protected void imageImpl(PImage who,
965965 context .drawImage (((ImageCache ) getCache (who )).image ,
966966 u1 , v1 , u2 -u1 , v2 -v1 ,
967967 x1 , y1 , x2 -x1 , y2 -y1 );
968-
969- // Every few years I think "nah, Java2D couldn't possibly be that f*king
970- // slow, why are we doing this by hand?" then comes the affirmation:
971- // Composite oldComp = null;
972- // if (false && tint) {
973- // oldComp = g2.getComposite();
974- // int alpha = (tintColor >> 24) & 0xff;
975- // System.out.println("using alpha composite");
976- // Composite alphaComp =
977- // AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha / 255f);
978- // g2.setComposite(alphaComp);
979- // }
980- //
981- // long t = System.currentTimeMillis();
982- // g2.drawImage(who.getImage(),
983- // (int) x1, (int) y1, (int) x2, (int) y2,
984- // u1, v1, u2, v2, null);
985- // System.out.println(System.currentTimeMillis() - t);
986- //
987- // if (oldComp != null) {
988- // g2.setComposite(oldComp);
989- // }
990968 }
991969
992970
@@ -2033,48 +2011,14 @@ public void backgroundImpl() {
20332011//
20342012//
20352013//
2036- // //////////////////////////////////////////////////////////////
2037- //
2038- // // PIMAGE METHODS
2039- //
2040- //
2041- // // getImage, setCache, getCache, removeCache, isModified, setModified
2042- //
2043- //
2044- // protected WritableRaster getRaster() {
2045- // WritableRaster raster = null;
2046- // if (primarySurface) {
2047- // /*
2048- // // 'offscreen' will probably be removed in the next release
2049- // if (useOffscreen) {
2050- // raster = offscreen.getRaster();
2051- // } else*/ if (image instanceof VolatileImage) {
2052- // // when possible, we'll try VolatileImage
2053- // raster = ((VolatileImage) image).getSnapshot().getRaster();
2054- // }
2055- // }
2056- // if (raster == null) {
2057- // raster = ((BufferedImage) image).getRaster();
2058- // }
2059- //
2060- // // On Raspberry Pi (and perhaps other platforms, the color buffer won't
2061- // // necessarily be the int array that we'd like. Need to convert it here.
2062- // // Not that this would probably mean getRaster() would need to work more
2063- // // like loadRaster/updateRaster because the pixels will need to be
2064- // // temporarily moved to (and later from) a buffer that's understood by
2065- // // the rest of the Processing source.
2066- // // https://github.com/processing/processing/issues/2010
2067- // if (raster.getTransferType() != DataBuffer.TYPE_INT) {
2068- // System.err.println("See https://github.com/processing/processing/issues/2010");
2069- // throw new RuntimeException("Pixel operations are not supported on this device.");
2070- // }
2071- // return raster;
2072- // }
2014+ //////////////////////////////////////////////////////////////
2015+
2016+ // PIMAGE METHODS
20732017
20742018
20752019 @ Override
20762020 public void loadPixels () {
2077- pixelFactor = 2 ;
2021+ // pixelFactor = 2;
20782022 int wide = width * pixelFactor ;
20792023 int high = height * pixelFactor ;
20802024
@@ -2103,21 +2047,6 @@ public void loadPixels() {
21032047 }
21042048
21052049
2106- //// /**
2107- //// * Update the pixels[] buffer to the PGraphics image.
2108- //// * <P>
2109- //// * Unlike in PImage, where updatePixels() only requests that the
2110- //// * update happens, in PGraphicsJava2D, this will happen immediately.
2111- //// */
2112- //// @Override
2113- //// public void updatePixels() {
2114- //// //updatePixels(0, 0, width, height);
2115- ////// WritableRaster raster = ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster();
2116- ////// WritableRaster raster = image.getRaster();
2117- //// updatePixels(0, 0, width, height);
2118- //// }
2119- //
2120- //
21212050// /**
21222051// * Update the pixels[] buffer to the PGraphics image.
21232052// * <P>
@@ -2367,4 +2296,16 @@ public void loadPixels() {
23672296
23682297
23692298 //public void save(String filename)
2299+
2300+
2301+
2302+ //////////////////////////////////////////////////////////////
2303+
2304+ /**
2305+ * Display a warning that the specified method is simply unavailable.
2306+ */
2307+ static public void showTodoWarning (String method , int issue ) {
2308+ showWarning (method + "() is not yet available: " +
2309+ "https://github.com/processing/processing/issues/" + issue );
2310+ }
23702311}
0 commit comments