modules/graphics/src/main/java/com/sun/prism/j2d/J2DPrismGraphics.java

Print this page




  99         assert(com.sun.javafx.geom.PathIterator.SEG_CLOSE == java.awt.geom.PathIterator.SEG_CLOSE);
 100     }
 101     static final LinearGradientPaint.CycleMethod LGP_CYCLE_METHODS[] = {
 102         LinearGradientPaint.CycleMethod.NO_CYCLE,
 103         LinearGradientPaint.CycleMethod.REFLECT,
 104         LinearGradientPaint.CycleMethod.REPEAT,
 105     };
 106     static final RadialGradientPaint.CycleMethod RGP_CYCLE_METHODS[] = {
 107         RadialGradientPaint.CycleMethod.NO_CYCLE,
 108         RadialGradientPaint.CycleMethod.REFLECT,
 109         RadialGradientPaint.CycleMethod.REPEAT,
 110     };
 111 
 112     private static final BasicStroke DEFAULT_STROKE =
 113         new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f);
 114     private static final Paint DEFAULT_PAINT = Color.WHITE;
 115     static java.awt.geom.AffineTransform J2D_IDENTITY =
 116         new java.awt.geom.AffineTransform();
 117     private int clipRectIndex;
 118     private boolean hasPreCullingBits = false;
 119     private float pixelScale = 1.0f;

 120 
 121     static java.awt.Color toJ2DColor(Color c) {
 122         return new java.awt.Color(c.getRed(),
 123                                   c.getGreen(),
 124                                   c.getBlue(),
 125                                   c.getAlpha());
 126     }
 127 
 128     /*
 129      * Ensure that no fractions are equal
 130      *
 131      * Note that the J2D objects reject equal fractions, but the FX versions
 132      * allow them.
 133      *
 134      * The FX version treats values with equal fractions such that as you
 135      * approach the fractional value from below it interpolates to the
 136      * first color associated with that fraction and as you interpolate
 137      * away from it from above it interpolates the last such color.
 138      *
 139      * To get the J2D version to exhibit the FX behavior we collapse all


1366     public void setRenderRoot(NodePath root) {
1367         this.renderRoot = root;
1368     }
1369 
1370     @Override
1371     public NodePath getRenderRoot() {
1372         return renderRoot;
1373     }
1374 
1375     public void setState3D(boolean flag) {
1376     }
1377 
1378     public boolean isState3D() {
1379         return false;
1380     }
1381 
1382     public void setup3DRendering() {
1383     }
1384 
1385     @Override
1386     public void setPixelScaleFactor(float pixelScale) {
1387         this.pixelScale = pixelScale;

1388     }
1389 
1390     @Override
1391     public float getPixelScaleFactor() {
1392         return pixelScale;





1393     }
1394 
1395     @Override
1396     public void blit(RTTexture srcTex, RTTexture dstTex,
1397             int srcX0, int srcY0, int srcX1, int srcY1,
1398             int dstX0, int dstY0, int dstX1, int dstY1) {
1399         throw new UnsupportedOperationException("Not supported yet.");
1400     }
1401 
1402     private static class AdaptorShape implements java.awt.Shape {
1403         private Shape prshape;
1404 
1405         public void setShape(Shape prshape) {
1406             this.prshape = prshape;
1407         }
1408 
1409         public boolean contains(double x, double y) {
1410             return prshape.contains((float) x, (float) y);
1411         }
1412 




  99         assert(com.sun.javafx.geom.PathIterator.SEG_CLOSE == java.awt.geom.PathIterator.SEG_CLOSE);
 100     }
 101     static final LinearGradientPaint.CycleMethod LGP_CYCLE_METHODS[] = {
 102         LinearGradientPaint.CycleMethod.NO_CYCLE,
 103         LinearGradientPaint.CycleMethod.REFLECT,
 104         LinearGradientPaint.CycleMethod.REPEAT,
 105     };
 106     static final RadialGradientPaint.CycleMethod RGP_CYCLE_METHODS[] = {
 107         RadialGradientPaint.CycleMethod.NO_CYCLE,
 108         RadialGradientPaint.CycleMethod.REFLECT,
 109         RadialGradientPaint.CycleMethod.REPEAT,
 110     };
 111 
 112     private static final BasicStroke DEFAULT_STROKE =
 113         new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f);
 114     private static final Paint DEFAULT_PAINT = Color.WHITE;
 115     static java.awt.geom.AffineTransform J2D_IDENTITY =
 116         new java.awt.geom.AffineTransform();
 117     private int clipRectIndex;
 118     private boolean hasPreCullingBits = false;
 119     private float pixelScaleX = 1.0f;
 120     private float pixelScaleY = 1.0f;
 121 
 122     static java.awt.Color toJ2DColor(Color c) {
 123         return new java.awt.Color(c.getRed(),
 124                                   c.getGreen(),
 125                                   c.getBlue(),
 126                                   c.getAlpha());
 127     }
 128 
 129     /*
 130      * Ensure that no fractions are equal
 131      *
 132      * Note that the J2D objects reject equal fractions, but the FX versions
 133      * allow them.
 134      *
 135      * The FX version treats values with equal fractions such that as you
 136      * approach the fractional value from below it interpolates to the
 137      * first color associated with that fraction and as you interpolate
 138      * away from it from above it interpolates the last such color.
 139      *
 140      * To get the J2D version to exhibit the FX behavior we collapse all


1367     public void setRenderRoot(NodePath root) {
1368         this.renderRoot = root;
1369     }
1370 
1371     @Override
1372     public NodePath getRenderRoot() {
1373         return renderRoot;
1374     }
1375 
1376     public void setState3D(boolean flag) {
1377     }
1378 
1379     public boolean isState3D() {
1380         return false;
1381     }
1382 
1383     public void setup3DRendering() {
1384     }
1385 
1386     @Override
1387     public void setPixelScaleFactors(float pixelScaleX, float pixelScaleY) {
1388         this.pixelScaleX = pixelScaleX;
1389         this.pixelScaleY = pixelScaleY;
1390     }
1391 
1392     @Override
1393     public float getPixelScaleFactorX() {
1394         return pixelScaleX;
1395     }
1396 
1397     @Override
1398     public float getPixelScaleFactorY() {
1399         return pixelScaleY;
1400     }
1401 
1402     @Override
1403     public void blit(RTTexture srcTex, RTTexture dstTex,
1404             int srcX0, int srcY0, int srcX1, int srcY1,
1405             int dstX0, int dstY0, int dstX1, int dstY1) {
1406         throw new UnsupportedOperationException("Not supported yet.");
1407     }
1408 
1409     private static class AdaptorShape implements java.awt.Shape {
1410         private Shape prshape;
1411 
1412         public void setShape(Shape prshape) {
1413             this.prshape = prshape;
1414         }
1415 
1416         public boolean contains(double x, double y) {
1417             return prshape.contains((float) x, (float) y);
1418         }
1419