From f20566c564e18f418c4ccc29fcf77d0471e49334 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 7 May 2018 10:46:26 +0100 Subject: [PATCH] JAL-2982 use configured background colour in PCA image export --- src/jalview/gui/PCAPanel.java | 17 ++++++++--------- src/jalview/gui/RotatableCanvas.java | 9 ++++----- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index f0ba274..caa2fc2 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -389,7 +389,7 @@ public class PCAPanel extends GPCAPanel { pg.translate((int) pf.getImageableX(), (int) pf.getImageableY()); - rc.drawBackground(pg, rc.bgColour); + rc.drawBackground(pg); rc.drawScene(pg); if (rc.drawAxes) { @@ -432,20 +432,19 @@ public class PCAPanel extends GPCAPanel ImageMaker im; - if (type == ImageMaker.TYPE.PNG) + switch (type) { + case PNG: im = new ImageMaker(this, ImageMaker.TYPE.PNG, "Make PNG image from PCA", width, height, null, null, null, 0, false); - } - else if (type == jalview.util.ImageMaker.TYPE.EPS) - { + break; + case EPS: im = new ImageMaker(this, ImageMaker.TYPE.EPS, "Make EPS file from PCA", width, height, null, this.getTitle(), null, 0, false); - } - else - { + break; + default: im = new ImageMaker(this, ImageMaker.TYPE.SVG, "Make SVG file from PCA", width, height, null, this.getTitle(), null, 0, false); @@ -453,7 +452,7 @@ public class PCAPanel extends GPCAPanel if (im.getGraphics() != null) { - rc.drawBackground(im.getGraphics(), Color.black); + rc.drawBackground(im.getGraphics()); rc.drawScene(im.getGraphics()); if (rc.drawAxes) { diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index 86fe483..b00055b 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -287,7 +287,7 @@ public class RotatableCanvas extends JPanel implements MouseListener, ig = img.getGraphics(); } - drawBackground(ig, bgColour); + drawBackground(ig); drawScene(ig); if (drawAxes) @@ -336,14 +336,13 @@ public class RotatableCanvas extends JPanel implements MouseListener, } /** - * Fills the background with the specified colour + * Fills the background with the currently configured background colour * * @param g - * @param col */ - public void drawBackground(Graphics g, Color col) + public void drawBackground(Graphics g) { - g.setColor(col); + g.setColor(bgColour); g.fillRect(0, 0, prefSize.width, prefSize.height); } -- 1.7.10.2