--- old/modules/javafx.graphics/src/main/java/javafx/scene/canvas/GraphicsContext.java 2018-11-15 20:03:46.468612312 +0530 +++ new/modules/javafx.graphics/src/main/java/javafx/scene/canvas/GraphicsContext.java 2018-11-15 20:03:46.348552312 +0530 @@ -127,7 +127,7 @@ * A 3x2 2D affine transformation matrix that controls how coordinates are * mapped onto the logical pixels of the canvas image. * - * + * * {@link #setEffect(javafx.scene.effect.Effect) Effect} * Yes * {@code null} @@ -251,6 +251,15 @@ * The method used to determine the interior of paths for a path fill or * clip operation. * + * Image Attributes + * + * {@link #setImageSmoothing(boolean) Image Smoothing} + * Yes + * {@code true} + * + * A boolean state which enables or disables image smoothing for + * {@link #drawImage(javafx.scene.image.Image, double, double) drawImage(all forms)}. + * * *

* @@ -260,71 +269,77 @@ * * * - * - * - * - * - * - * + * + * + * + * + * + * + * * * * - * - * - * - * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * + * + * + * + * * * * * - * - * - * - * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * + * + * + * + * * * * * - * - * - * - * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * + * + * + * + * * * * * - * - * - * - * - * - * + * + * + * + * + * + * * * * - * - * - * - * - * - * + * + * + * + * + * + * * *
Rendering Attributes Table
MethodCommon Rendering AttributesFill AttributesStroke AttributesText AttributesPath AttributesMethodCommon Rendering AttributesFill AttributesStroke AttributesText AttributesPath AttributesImage Attributes
Basic Shape Rendering
+ * * {@link #fillRect(double, double, double, double) fillRect()}, * {@link #fillRoundRect(double, double, double, double, double, double) fillRoundRect()}, * {@link #fillOval(double, double, double, double) fillOval()}, * {@link #fillArc(double, double, double, double, double, double, javafx.scene.shape.ArcType) fillArc()} * YesYesNoNoNoYesYesNoNoNoNo
+ * * {@link #strokeLine(double, double, double, double) strokeLine()}, * {@link #strokeRect(double, double, double, double) strokeRect()}, * {@link #strokeRoundRect(double, double, double, double, double, double) strokeRoundRect()}, * {@link #strokeOval(double, double, double, double) strokeOval()}, * {@link #strokeArc(double, double, double, double, double, double, javafx.scene.shape.ArcType) strokeArc()} * YesNoYesNoNoYesNoYesNoNoNo
+ * * {@link #clearRect(double, double, double, double) clearRect()} * Yes [1]NoNoNoNoYes [1]NoNoNoNoNo
+ * * {@link #fillPolygon(double[], double[], int) fillPolygon()} * YesYesNoNoYes [2]YesYesNoNoYes [2]No
+ * * {@link #strokePolygon(double[], double[], int) strokePolygon()}, * {@link #strokePolyline(double[], double[], int) strokePolyline()} * YesNoYesNoNoYesNoYesNoNoNo
* [1] Only the Transform, Clip, and Effect apply to clearRect()
@@ -332,33 +347,35 @@ *
Text Rendering
+ * * {@link #fillText(java.lang.String, double, double) fillText()}, * {@link #fillText(java.lang.String, double, double, double) fillText(with maxWidth)} * YesYesNoYes [3]NoYesYesNoYes [3]NoNo
+ * * {@link #strokeText(java.lang.String, double, double) strokeText()}, * {@link #strokeText(java.lang.String, double, double, double) strokeText(with maxWidth)} * YesNoYesYes [3]NoYesNoYesYes [3]NoNo
* [3] The Font Smoothing attribute only applies to filled text *
Path Rendering
+ * * {@link #beginPath() beginPath()}, * {@link #moveTo(double, double) moveTo()}, * {@link #lineTo(double, double) lineTo()}, @@ -370,41 +387,45 @@ * {@link #closePath() closePath()}, * {@link #rect(double, double, double, double) rect()} * Yes [4]NoNoNoNoYes [4]NoNoNoNoNo
+ * * {@link #fill() fill()} * Yes [4]YesNoNoYesYes [4]YesNoNoYesNo
+ * * {@link #stroke() stroke()} * Yes [4]NoYesNoYes [5]Yes [4]NoYesNoYes [5]No
+ * * {@link #clip() clip()} * NoNoNoNoYesNoNoNoNoYesNo
* [4] Transform applied only during path construction
@@ -412,26 +433,28 @@ *
Image Rendering
+ * * {@link #drawImage(javafx.scene.image.Image, double, double) drawImage(all forms)} * YesNoNoNoNoYesNoNoNoNoYes
Miscellaneous
+ * * {@link #applyEffect(javafx.scene.effect.Effect) applyEffect()}, * {@link #getPixelWriter() PixelWriter methods} * NoNoNoNoNoNoNoNoNoNoNo
* @@ -495,6 +518,7 @@ VPos textbaseline; Effect effect; FillRule fillRule; + boolean imageSmoothing = true; State() { init(); @@ -509,7 +533,7 @@ 0, Font.getDefault(), FontSmoothingType.GRAY, TextAlignment.LEFT, VPos.BASELINE, - null, FillRule.NON_ZERO); + null, FillRule.NON_ZERO, true); } State(State copy) { @@ -520,7 +544,7 @@ copy.dashes, copy.dashOffset, copy.numClipPaths, copy.font, copy.fontsmoothing, copy.textalign, copy.textbaseline, - copy.effect, copy.fillRule); + copy.effect, copy.fillRule, copy.imageSmoothing); } final void set(double globalAlpha, BlendMode blendop, @@ -531,7 +555,7 @@ int numClipPaths, Font font, FontSmoothingType smoothing, TextAlignment align, VPos baseline, - Effect effect, FillRule fillRule) + Effect effect, FillRule fillRule, boolean imageSmoothing) { this.globalAlpha = globalAlpha; this.blendop = blendop; @@ -551,6 +575,7 @@ this.textbaseline = baseline; this.effect = effect; this.fillRule = fillRule; + this.imageSmoothing = imageSmoothing; } State copy() { @@ -583,6 +608,7 @@ ctx.setTextAlign(textalign); ctx.setTextBaseline(textbaseline); ctx.setEffect(effect); + ctx.setImageSmoothing(imageSmoothing); } } @@ -1731,6 +1757,43 @@ } /** + * Sets the image smoothing state. + * Image smoothing is an
Image attribute + * used to enable or disable image smoothing for + * {@link #drawImage(javafx.scene.image.Image, double, double) drawImage(all forms)} + * as specified in the Rendering Attributes Table.
+ * If image smoothing is {@code true}, images will be scaled using a higher + * quality filtering when transforming or scaling the source image to fit + * in the destination rectangle.
+ * If image smoothing is {@code false}, images will be scaled without filtering + * (or by using a lower quality filtering) when transforming or scaling the + * source image to fit in the destination rectangle. + * + * @defaultValue {@code true} + * @param imageSmoothing {@code true} to enable or {@code false} to disable smoothing + * @since 12 + */ + public void setImageSmoothing(boolean imageSmoothing) { + if (curState.imageSmoothing != imageSmoothing) { + curState.imageSmoothing = imageSmoothing; + GrowableDataBuffer buf = getBuffer(); + buf.putByte(NGCanvas.IMAGE_SMOOTH); + buf.putBoolean(curState.imageSmoothing); + } + } + + /** + * Gets the current image smoothing state. + * + * @defaultValue {@code true} + * @return image smoothing state + * @since 12 + */ + public boolean isImageSmoothing() { + return curState.imageSmoothing; + } + + /** * Resets the current path to empty. * The default path is empty. * The current path is a path attribute @@ -2592,6 +2655,7 @@ *

* This method will be affected by any of the * global common + * or image * attributes as specified in the * Rendering Attributes Table. *

@@ -2614,6 +2678,7 @@ *

* This method will be affected by any of the * global common + * or image * attributes as specified in the * Rendering Attributes Table. *

@@ -2635,6 +2700,7 @@ *

* This method will be affected by any of the * global common + * or image * attributes as specified in the * Rendering Attributes Table. *