Fix proposal: boolean flag & public API for JDK-8204060 - Disable smoothing at javafx.scene.canvas.GraphicsContext.drawImage()
Kevin Rushforth
kevin.rushforth at oracle.com
Mon Oct 15 22:58:58 UTC 2018
A good question. In this case it is intended to match the
ImageView::smooth property, which is a boolean. If there is a need later
that more than one value is needed we would have to add a new enum
attribute that would take effect if imageSmooth==true, but that would be
the case for any of the smooth attributes for shapes as well.
-- Kevin
On 10/15/2018 3:52 PM, Nir Lisker wrote:
>> public void setImageSmoothing(boolean imageSmoothing) {} to enable or
>> disable smoothing.
>
> A bit of forward thinking here. Will there always be only 2 ways of doing
> smoothing: "on" or "off"?
> If there will be different algorithms for smoothing, will they be set
> separately by "setSmoothingAlgorithm" a la strategy pattern?
> Some similar cases use an enum, like CacheHint [1], or what I think should
> have been an enum, like SceneAntialiasing [2] (which has another 2
> commented-out settings). Is adding elements to an enum even allowed by
> backwards compatibility?
>
> [1]
> https://openjfx.io/javadoc/11/javafx.graphics/javafx/scene/CacheHint.html
> [2]
> https://openjfx.io/javadoc/11/javafx.graphics/javafx/scene/SceneAntialiasing.html
>
>
> On Mon, Oct 15, 2018 at 10:30 PM Ambarish Rapte <ambarish.rapte at oracle.com>
> wrote:
>
>> Hi All,
>>
>>
>>
>> This email is for discussion regarding the fix
>> https://bugs.openjdk.java.net/browse/JDK-8204060 .
>>
>>
>>
>> Issue:
>>
>> Images drawn using javafx.scene.canvas .GraphicsContext::drawImage()
>> always apply filtering to the image.
>>
>>
>>
>> Solution:
>>
>> javafx.scene.canvas.GraphicsContext should provide an option to enable and
>> disable smoothing.
>>
>>
>>
>> Proposal:
>>
>> Adding a Boolean flag & APIs to control smoothing.
>>
>>
>>
>> Add a boolean flag to control smoothing
>> Add two public APIs
>>
>> public void setImageSmoothing(boolean imageSmoothing) {} to enable or
>> disable smoothing.
>> public boolean getImageSmoothing() {}
>>
>> If image smoothing is 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 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.
>>
>>
>>
>> Please provide your comments on the proposal.
>>
>>
>>
>>
>>
>> Regards,
>>
>> Ambarish
>>
More information about the openjfx-dev
mailing list