< prev index next >

modules/javafx.graphics/src/main/java/javafx/scene/canvas/GraphicsContext.java

Print this page

        

@@ -125,11 +125,11 @@
  * <td class="colLast" style="width:10%; text-align:center">{@code Identity}</td>
  * <td class="colLast">
  * A 3x2 2D affine transformation matrix that controls how coordinates are
  * mapped onto the logical pixels of the canvas image.
  * </td></tr>
- * <tr class="altColor">
+ * <tr class="rowColor">
  * <th scope="row" class="colLast" style="width:15%">{@link #setEffect(javafx.scene.effect.Effect) Effect}</th>
  * <td class="colLast" style="width:10%; text-align:center; color:#0c0">Yes</td>
  * <td class="colLast" style="width:10%; text-align:center">{@code null}</td>
  * <td class="colLast">
  * An {@link Effect} applied individually to each rendering operation.

@@ -249,118 +249,135 @@
  * <td class="colLast" style="width:10%; text-align:center">{@link FillRule#NON_ZERO NON_ZERO}</td>
  * <td class="colLast">
  * The method used to determine the interior of paths for a path fill or
  * clip operation.
  * </td></tr>
+ * <tr><th colspan="3" scope="row"><a id="image-attr">Image Attributes</a></th></tr>
+ * <tr class="rowColor">
+ * <th scope="row" class="colLast" style="width:15%">{@link #setImageSmoothing(boolean) Image Smoothing}</th>
+ * <td class="colLast" style="width:10%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:10%; text-align:center">{@code true}</td>
+ * <td class="colLast">
+ * A boolean state which enables or disables image smoothing for
+ * {@link #drawImage(javafx.scene.image.Image, double, double) drawImage(all forms)}.
+ * </td></tr>
  * </table>
  * <p>
  * <a id="attr-ops-table">
  * The various rendering methods on the {@code GraphicsContext} use the
  * following sets of rendering attributes:
  * </a>
  * <table class="overviewSummary" style="width:80%; margin-left:auto; margin-right:auto">
  * <caption>Rendering Attributes Table</caption>
  * <tr>
- * <th scope="col" class="colLast" style="width:25%">Method</th>
- * <th scope="col" class="colLast" style="width:15%; text-align:center"><a href="#comm-attr">Common Rendering Attributes</a></th>
- * <th scope="col" class="colLast" style="width:15%; text-align:center"><a href="#fill-attr">Fill Attributes</a></th>
- * <th scope="col" class="colLast" style="width:15%; text-align:center"><a href="#strk-attr">Stroke Attributes</a></th>
- * <th scope="col" class="colLast" style="width:15%; text-align:center"><a href="#text-attr">Text Attributes</a></th>
- * <th scope="col" class="colLast" style="width:15%; text-align:center"><a href="#path-attr">Path Attributes</a></th>
+ * <th scope="col" class="colLast" style="width:22%">Method</th>
+ * <th scope="col" class="colLast" style="width:13%; text-align:center"><a href="#comm-attr">Common Rendering Attributes</a></th>
+ * <th scope="col" class="colLast" style="width:13%; text-align:center"><a href="#fill-attr">Fill Attributes</a></th>
+ * <th scope="col" class="colLast" style="width:13%; text-align:center"><a href="#strk-attr">Stroke Attributes</a></th>
+ * <th scope="col" class="colLast" style="width:13%; text-align:center"><a href="#text-attr">Text Attributes</a></th>
+ * <th scope="col" class="colLast" style="width:13%; text-align:center"><a href="#path-attr">Path Attributes</a></th>
+ * <th scope="col" class="colLast" style="width:13%; text-align:center"><a href="#image-attr">Image Attributes</a></th>
  * </tr>
  * <tr><th colspan="1" scope="row">Basic Shape Rendering</th></tr>
  * <tr class="rowColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@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()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr class="altColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@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()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr class="rowColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #clearRect(double, double, double, double) clearRect()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes <a href="#base-fn-1">[1]</a></td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes <a href="#base-fn-1">[1]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr class="altColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #fillPolygon(double[], double[], int) fillPolygon()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes <a href="#base-fn-2">[2]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes <a href="#base-fn-2">[2]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr class="rowColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #strokePolygon(double[], double[], int) strokePolygon()},
  * {@link #strokePolyline(double[], double[], int) strokePolyline()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr><th scope="row" colspan="6">
  * <a id="base-fn-1">[1]</a> Only the Transform, Clip, and Effect apply to clearRect()<br>
  * <a id="base-fn-2">[2]</a> Only the Fill Rule applies to fillPolygon(), the current path is left unchanged
  * </th></tr>
  * <tr><th colspan="1" scope="row">Text Rendering</th></tr>
  * <tr class="rowColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #fillText(java.lang.String, double, double) fillText()},
  * {@link #fillText(java.lang.String, double, double, double) fillText(with maxWidth)}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes <a href="#text-fn-3">[3]</a></td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes <a href="#text-fn-3">[3]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr class="altColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #strokeText(java.lang.String, double, double) strokeText()},
  * {@link #strokeText(java.lang.String, double, double, double) strokeText(with maxWidth)}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes <a href="#text-fn-3">[3]</a></td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes <a href="#text-fn-3">[3]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr><th scope="row" colspan="6">
  * <a id="text-fn-3">[3]</a> The Font Smoothing attribute only applies to filled text
  * </th></tr>
  * <tr><th colspan="1" scope="row">Path Rendering</th></tr>
  * <tr class="rowColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #beginPath() beginPath()},
  * {@link #moveTo(double, double) moveTo()},
  * {@link #lineTo(double, double) lineTo()},
  * {@link #quadraticCurveTo(double, double, double, double) quadraticCurveTo()},
  * {@link #bezierCurveTo(double, double, double, double, double, double) bezierCurveTo()},

@@ -368,72 +385,78 @@
  * {@link #arcTo(double, double, double, double, double) arcTo()},
  * {@link #appendSVGPath(java.lang.String) appendSVGPath()},
  * {@link #closePath() closePath()},
  * {@link #rect(double, double, double, double) rect()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes <a href="#path-fn-4">[4]</a></td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes <a href="#path-fn-4">[4]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr class="altColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #fill() fill()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes <a href="#path-fn-4">[4]</a></td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes <a href="#path-fn-4">[4]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr class="rowColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #stroke() stroke()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes <a href="#path-fn-4">[4]</a></td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes <a href="#path-fn-5">[5]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes <a href="#path-fn-4">[4]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes <a href="#path-fn-5">[5]</a></td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr class="altColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #clip() clip()}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * <tr><th scope="row" colspan="6">
  * <a id="path-fn-4">[4]</a> Transform applied only during path construction<br>
  * <a id="path-fn-5">[5]</a> Fill Rule only used for fill() and clip()
  * </th></tr>
  * <tr><th scope="row" colspan="1">Image Rendering</th></tr>
  * <tr class="rowColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #drawImage(javafx.scene.image.Image, double, double) drawImage(all forms)}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#0c0">Yes</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#0c0">Yes</td>
  * </tr>
  * <tr><th scope="row" colspan="1">Miscellaneous</th></tr>
  * <tr class="rowColor">
- * <th scope="row" class="colLast" style="width:25%">
+ * <th scope="row" class="colLast" style="width:22%">
  * {@link #applyEffect(javafx.scene.effect.Effect) applyEffect()},
  * {@link #getPixelWriter() PixelWriter methods}
  * </th>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
- * <td class="colLast" style="width:15%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
+ * <td class="colLast" style="width:13%; text-align:center; color:#c00">No</td>
  * </tr>
  * </table>
  *
  * <p>Example:</p>
  *

@@ -493,10 +516,11 @@
         FontSmoothingType fontsmoothing;
         TextAlignment textalign;
         VPos textbaseline;
         Effect effect;
         FillRule fillRule;
+        boolean imageSmoothing = true;
 
         State() {
             init();
         }
 

@@ -507,33 +531,33 @@
                 1.0, StrokeLineCap.SQUARE, StrokeLineJoin.MITER, 10.0,
                 null, 0.0,
                 0,
                 Font.getDefault(), FontSmoothingType.GRAY,
                 TextAlignment.LEFT, VPos.BASELINE,
-                null, FillRule.NON_ZERO);
+                null, FillRule.NON_ZERO, true);
         }
 
         State(State copy) {
             set(copy.globalAlpha, copy.blendop,
                 new Affine2D(copy.transform),
                 copy.fill, copy.stroke,
                 copy.linewidth, copy.linecap, copy.linejoin, copy.miterlimit,
                 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,
                        Affine2D transform, Paint fill, Paint stroke,
                        double linewidth, StrokeLineCap linecap,
                        StrokeLineJoin linejoin, double miterlimit,
                        double dashes[], double dashOffset,
                        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;
             this.transform = transform;
             this.fill = fill;

@@ -549,10 +573,11 @@
             this.fontsmoothing = smoothing;
             this.textalign = align;
             this.textbaseline = baseline;
             this.effect = effect;
             this.fillRule = fillRule;
+            this.imageSmoothing = imageSmoothing;
         }
 
         State copy() {
             return new State(this);
         }

@@ -581,10 +606,11 @@
             ctx.setFont(font);
             ctx.setFontSmoothingType(fontsmoothing);
             ctx.setTextAlign(textalign);
             ctx.setTextBaseline(textbaseline);
             ctx.setEffect(effect);
+            ctx.setImageSmoothing(imageSmoothing);
         }
     }
 
     private GrowableDataBuffer getBuffer() {
         return theCanvas.getBuffer();

@@ -1729,10 +1755,47 @@
      public FillRule getFillRule() {
          return curState.fillRule;
      }
 
     /**
+     * Sets the image smoothing state.
+     * Image smoothing is an <a href="#image-attr">Image attribute</a>
+     * used to enable or disable image smoothing for
+     * {@link #drawImage(javafx.scene.image.Image, double, double) drawImage(all forms)}
+     * as specified in the <a href="#attr-ops-table">Rendering Attributes Table</a>.<br>
+     * 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.<br>
+     * 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 <a href="#path-attr">path attribute</a>
      * used for any of the path methods as specified in the
      * <a href="#attr-ops-table">Rendering Attributes Table</a>

@@ -2590,10 +2653,11 @@
      * and height of the given image.
      * A {@code null} image value or an image still in progress will be ignored.
      * <p>
      * This method will be affected by any of the
      * <a href="#comm-attr">global common</a>
+     * or <a href="#image-attr">image</a>
      * attributes as specified in the
      * <a href="#attr-ops-table">Rendering Attributes Table</a>.
      * </p>
      *
      * @param img the image to be drawn or null.

@@ -2612,10 +2676,11 @@
      * Image is scaled to fit into the destination rectangle.
      * A {@code null} image value or an image still in progress will be ignored.
      * <p>
      * This method will be affected by any of the
      * <a href="#comm-attr">global common</a>
+     * or <a href="#image-attr">image</a>
      * attributes as specified in the
      * <a href="#attr-ops-table">Rendering Attributes Table</a>.
      * </p>
      *
      * @param img the image to be drawn or null.

@@ -2633,10 +2698,11 @@
      * destination rectangle of the Canvas.
      * A {@code null} image value or an image still in progress will be ignored.
      * <p>
      * This method will be affected by any of the
      * <a href="#comm-attr">global common</a>
+     * or <a href="#image-attr">image</a>
      * attributes as specified in the
      * <a href="#attr-ops-table">Rendering Attributes Table</a>.
      * </p>
      *
      * @param img the image to be drawn or null.
< prev index next >