Skip to content

Commit

Permalink
Added GraphicsContext imageSmoothing support
Browse files Browse the repository at this point in the history
  • Loading branch information
salmonb committed Aug 20, 2024
1 parent 8f0c16a commit fcefa8f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1263,4 +1263,32 @@ void drawImage(Image img,
*/
void applyEffect(Effect e);

/**
* 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
*/
void setImageSmoothing(boolean imageSmoothing);

/**
* Gets the current image smoothing state.
*
* @defaultValue {@code true}
* @return image smoothing state
* @since 12
*/
boolean isImageSmoothing();

}
Original file line number Diff line number Diff line change
Expand Up @@ -767,4 +767,13 @@ public void applyEffect(Effect e) {
Console.log("WARNING: HtmlGraphicsContext.applyEffect() not implemented");
}

@Override
public void setImageSmoothing(boolean imageSmoothing) {
ctx.imageSmoothingEnabled = imageSmoothing;
}

@Override
public boolean isImageSmoothing() {
return ctx.imageSmoothingEnabled;
}
}

0 comments on commit fcefa8f

Please sign in to comment.