Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8213783

[Canvas] Add API in GraphicsContext to control image smoothing

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • jfx12
    • javafx
    • None
    • behavioral
    • minimal
    • New API to control image smoothing state. This change enables image smoothing by default, which is same as the existing behavior. None of the existing applications shall get affected by this change.
    • Java API
    • JDK

    Description

      Summary

      Provide APIs in GraphicsContext to enable/disable image smoothing when an image is drawn using GraphicsContext.drawImage(all forms)

      Problem

      When an image is drawn using any of GraphicsContext.drawImage(all forms), the image is always drawn smooth by applying bi-linear interpolation. Currently this is default behavior, and a Programmer has no control of the image smoothing behavior.

      Solution

      Specification

      Two APIs added to javafx.scene.canvas.GraphicsContext:

          /**
           * 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) {
          }
      
          /**
           * Gets the current image smoothing state.
           *
           * @defaultValue {@code true}
           * @return image smoothing state
           * @since 12
           */
          public boolean isImageSmoothing() {
          }
      

      Attachments

        Issue Links

          Activity

            People

              arapte Ambarish Rapte
              shadowbug Shadow Bug
              Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: