Skip to content

Commit 7727d94

Browse files
committed
Add transparent colors to 2ColorHM
This adjustment to the TwoColorHeatMap script allows the heatmap graphics to use the alpha channel value for the color sent from the GUI and display custom levels of transparency to the heatmap colors. This is updated to mimic ThreeColorHeatMap changes (#66).
1 parent eb778a7 commit 7727d94

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/scripts/Figure_Generation/TwoColorHeatMap.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static BufferedImage generateHeatMap(ArrayList<double[]> matrix) throws F
120120
BufferedImage im = new BufferedImage(pixwidth, pixheight, BufferedImage.TYPE_INT_ARGB);
121121
Graphics g = im.getGraphics();
122122
Graphics2D g2 = (Graphics2D) g;
123-
g2.setColor(new Color(255, 255, 255));
123+
g2.setColor(new Color(255, 255, 255, 0));
124124
g2.fillRect(0, 0, pixwidth, pixheight);
125125

126126
int count = 0;
@@ -134,7 +134,8 @@ public static BufferedImage generateHeatMap(ArrayList<double[]> matrix) throws F
134134
int red = (int) (MAXCOLOR.getRed() * sVal + MINCOLOR.getRed() * (1 - sVal));
135135
int green = (int) (MAXCOLOR.getGreen() * sVal + MINCOLOR.getGreen() * (1 - sVal));
136136
int blue = (int) (MAXCOLOR.getBlue() * sVal + MINCOLOR.getBlue() * (1 - sVal));
137-
g.setColor(new Color(red, green, blue));
137+
int alpha = (int) (MAXCOLOR.getAlpha() * sVal + MINCOLOR.getAlpha() * (1 - sVal));
138+
g.setColor(new Color(red, green, blue, alpha));
138139
} else {
139140
g.setColor(Color.WHITE);
140141
}

0 commit comments

Comments
 (0)