From: Jim Procter Date: Wed, 23 Mar 2022 13:20:28 +0000 (+0000) Subject: JAL-3781 - EXPERIMENT - NEEDS RECODING - DEMO THAT HIGHER RESOLUTION RESIDUES CAN... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fspike%2FJAL-3781_2d_scaling;p=jalview.git JAL-3781 - EXPERIMENT - NEEDS RECODING - DEMO THAT HIGHER RESOLUTION RESIDUES CAN BE RENDERED IN JAVA 8 AND JAVA 11 --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index ac7cf10..4fcd934 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -40,6 +40,7 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.RenderingHints; +import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.beans.PropertyChangeEvent; import java.util.Iterator; @@ -330,7 +331,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI } else { - transY = img.getHeight() - ((vertical + 1) * charHeight); + transY = ((int)0.5*img.getHeight()) - ((vertical + 1) * charHeight); } } else if (vertical < 0) @@ -348,9 +349,10 @@ public class SeqCanvas extends JPanel implements ViewportListenerI // + " " + startSeq + " " + endSeq); Graphics gg = img.getGraphics(); - gg.copyArea(horizontal * charWidth, vertical * charHeight, - img.getWidth(), img.getHeight(), -horizontal * charWidth, + gg.copyArea(2*horizontal * charWidth, 2*vertical * charHeight, + img.getWidth(), img.getHeight(), -2*horizontal * charWidth, -vertical * charHeight); + /** @j2sNative xxi = this.img */ @@ -417,7 +419,9 @@ public class SeqCanvas extends JPanel implements ViewportListenerI // { // fastPaint = false; // } - + Graphics2D g2g = (Graphics2D) g; + g2g.scale(0.5,0.5); + Rectangle vis, clip; if (img != null && (fastPaint @@ -438,10 +442,11 @@ public class SeqCanvas extends JPanel implements ViewportListenerI if (img == null || width != img.getWidth() || height != img.getHeight()) { - img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + img = new BufferedImage(2*width, 2*height, BufferedImage.TYPE_INT_RGB); } Graphics2D gg = (Graphics2D) img.getGraphics(); + gg.scale(2,2); gg.setFont(av.getFont()); if (av.antiAlias) @@ -463,7 +468,8 @@ public class SeqCanvas extends JPanel implements ViewportListenerI } drawSelectionGroup(gg, startRes, endRes, startSeq, endSeq); - +// java.awt.geom.AffineTransform tr = ((Graphics2D) g).getDeviceConfiguration().getNormalizingTransform(); + g.drawImage(img, 0, 0, this); gg.dispose(); } @@ -472,6 +478,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI { drawCursor(g, startRes, endRes, startSeq, endSeq); } + g2g.scale(2,2); } /**