On Sun, 13 Mar 2022 21:06:24 GMT, Alexander Zuev <kiz...@openjdk.org> wrote:

> Detect the situation where we do need to perform interpolation during 
> ImageIcon
> painting and set a hint to the rendering to perform bicubic approximation so
> image details are preserved during transition.

src/java.desktop/share/classes/javax/swing/ImageIcon.java line 463:

> 461:         if (hintChanged) {
> 462:             ((Graphics2D) 
> g).setRenderingHint(RenderingHints.KEY_INTERPOLATION,
> 463:                     oldHint == null ? 
> RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR : oldHint);

This might be a rookie question:

When it comes to modifying and restoring a Graphics, I've seen two common 
patterns:
A. Call `newG = g.create()` and later `newG.dispose()`
B. Call `g.setX(newValue)` and then call `g.setX(oldValue)` later

Is there guidance on when to use which? Or is one always preferred?

-------------

PR: https://git.openjdk.java.net/jdk/pull/7805

Reply via email to