modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGShape.java
Print this page
@@ -55,10 +55,11 @@
protected Paint fillPaint;
protected Paint drawPaint;
protected BasicStroke drawStroke;
protected Mode mode = Mode.FILL;
protected ShapeRep shapeRep;
+ private boolean smooth;
public void setMode(Mode mode) {
if (mode != this.mode) {
this.mode = mode;
geometryChanged();
@@ -68,11 +69,18 @@
public Mode getMode() {
return mode;
}
public void setSmooth(boolean smooth) {
- // We don't support aliased shapes at this time
+ if (smooth != this.smooth) {
+ this.smooth = smooth;
+ visualsChanged();
+ }
+ }
+
+ public boolean isSmooth() {
+ return smooth;
}
public void setFillPaint(Object fillPaint) {
if (fillPaint != this.fillPaint ||
(this.fillPaint != null && this.fillPaint.isMutable()))
@@ -221,11 +229,11 @@
if (w <= 0 || h <= 0) {
return;
}
cached3D = g.getResourceFactory().createRTTexture(w, h,
Texture.WrapMode.CLAMP_TO_ZERO,
- false);
+ false, g.isAntialiasedShape());
cached3D.contentsUseful();
final Graphics textureGraphics = cached3D.createGraphics();
// Have to move the origin such that when rendering to x=0, we actually end up rendering
// at x=bounds.getMinX(). Otherwise anything rendered to the left of the origin would be lost
textureGraphics.scale((float) scaleX, (float) scaleY);
@@ -257,10 +265,14 @@
* into a texture and then transform in 3D that texture.
*
* @param g The graphics object to render with
*/
protected void renderContent2D(Graphics g, boolean printing) {
+
+ // Set smooth property on shape
+ g.setAntialiasedShape(isSmooth());
+
ShapeRep localShapeRep = printing ? null : this.shapeRep;
if (localShapeRep == null) {
localShapeRep = createShapeRep(g);
}
Shape shape = getShape();