From: Ben Soares Date: Fri, 28 Jun 2019 14:54:01 +0000 (+0100) Subject: JAL-3333 Smooth rotation of image now too X-Git-Tag: Release_2_11_0~2^2~22^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fbee8e851a60b04ed79ed0e21d9e5af6ee488c0e;p=jalview.git JAL-3333 Smooth rotation of image now too --- diff --git a/resources/images/Jalview_Logo_small_with_border.png b/resources/images/Jalview_Logo_small_with_border.png new file mode 100644 index 0000000..b91e2bb Binary files /dev/null and b/resources/images/Jalview_Logo_small_with_border.png differ diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index d6ca836..f97f808 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -32,6 +32,7 @@ import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.Image; import java.awt.MediaTracker; +import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import java.util.Vector; @@ -328,7 +329,7 @@ public class WebserviceInfo extends GWebserviceInfo setInfoText(info); java.net.URL url = getClass() - .getResource("/images/Jalview_Logo_small.png"); + .getResource("/images/Jalview_Logo_small_with_border.png"); image = java.awt.Toolkit.getDefaultToolkit().createImage(url); MediaTracker mt = new MediaTracker(this); @@ -832,15 +833,22 @@ protected void cancel_actionPerformed(ActionEvent e) Graphics2D g = (Graphics2D) offscreen.getGraphics(); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BICUBIC); + g.setRenderingHint(RenderingHints.KEY_RENDERING, + RenderingHints.VALUE_RENDER_QUALITY); + g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); if (image != null) { int x = image.getWidth(this) / 2, y = image.getHeight(this) / 2; - g.rotate(Math.toRadians(angle), 10 + x, 10 + y); - g.drawImage(image, 10, 10, this); - g.rotate(-Math.toRadians(angle), 10 + x, 10 + y); + g.rotate(Math.toRadians(angle), x, y); + g.drawImage(image, 0, 0, this); + g.rotate(-Math.toRadians(angle), x, y); } }