From: amwaterhouse Date: Thu, 17 Nov 2005 15:18:52 +0000 (+0000) Subject: Use setRGB rather than color, fillrect X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=42f65528bd74e645fe66664007669f2d083b8eee;p=jalview.git Use setRGB rather than color, fillrect --- diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index fcd952b..fa06d94 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -36,10 +36,7 @@ import java.awt.image.*; public class FeatureRenderer { AlignViewport av; - SequenceGroup currentSequenceGroup = null; - SequenceGroup[] allGroups = null; Color resBoxColour; - Graphics graphics; float transparency = 1.0f; FontMetrics fm; int charOffset; @@ -47,7 +44,7 @@ public class FeatureRenderer // The following vector holds the features which are // to be added, in the correct order or rendering - Vector featuresDisplayed; + Vector featuresDisplayed = null; /** * Creates a new FeatureRenderer object. @@ -65,17 +62,17 @@ public class FeatureRenderer * of the rendered sequence */ BufferedImage bi; - public Color findFeatureColour(Color initialCol, SequenceI seq, int i) + public synchronized Color findFeatureColour(Color initialCol, SequenceI seq, int i) { if(!av.showSequenceFeatures) return initialCol; - if(bi==null) - bi = new BufferedImage(1,1,BufferedImage.TYPE_INT_RGB); + if (bi == null) + bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); + + bi.setRGB(0,0, initialCol.getRGB()); drawText = false; - bi.getGraphics().setColor(initialCol); - bi.getGraphics().fillRect(0, 0, 1, 1); drawSequence(bi.getGraphics(), seq, i, i, 0, 0, 1, 1); drawText = true; @@ -100,6 +97,7 @@ public class FeatureRenderer int start, int end, int x1, int y1, int width, int height) { +//System.out.println(start+" "+end+" "+x1+" "+y1); if (seq.getDatasetSequence().getSequenceFeatures() == null || seq.getDatasetSequence().getSequenceFeatures().size()==0) return; @@ -260,7 +258,7 @@ public class FeatureRenderer // The feature table will display high priority // features at the top, but theses are the ones // we need to render last, so invert the data - featuresDisplayed = new Vector(); + featuresDisplayed.clear(); for(int i=data.length-1; i>-1; i--) { String type = data[i][0].toString(); diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 7070e5d..f70a9fa 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -84,11 +84,12 @@ public class SequenceRenderer if (bi == null) bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); - bi.getGraphics().setColor(initialCol); - bi.getGraphics().fillRect(0, 0, 1, 1); - allGroups = av.alignment.findAllGroups(seq); graphics = bi.getGraphics(); + bi.setRGB(0,0, initialCol.getRGB()); + + allGroups = av.alignment.findAllGroups(seq); + drawBoxes(seq, i,i, 0, 0, 1,1); return new Color(bi.getRGB(0, 0)); @@ -151,7 +152,7 @@ public class SequenceRenderer * @param width DOCUMENT ME! * @param height DOCUMENT ME! */ - public void drawBoxes(SequenceI seq, int start, int end, int x1, int y1, + public synchronized void drawBoxes(SequenceI seq, int start, int end, int x1, int y1, int width, int height) { int i = start;