- g2d.setColor(new Color((float)intensity.getRed(), (float)intensity.getGreen(), (float)intensity.getBlue(), 1f));
- Rectangle2D colorVertical = new Rectangle2D.Double(colorVerticalLeft, colorVerticalTop, colorVerticalWidth, colorVerticalHeigth);
- g2d.fill(colorVertical);
+ if (colorBarsOptions.isUseGradients()) {
+
+ RGBIntensity upperLimitIntensity;
+ if (j + 1 != intensities.size())
+ upperLimitIntensity = intensities.get(j + 1);
+ else
+ upperLimitIntensity = intensity;
+
+ double minRed = intensity.getRed();
+ double minGreen = intensity.getGreen();
+ double minBlue = intensity.getBlue();
+
+ double maxRed = upperLimitIntensity.getRed();
+ double maxGreen = upperLimitIntensity.getGreen();
+ double maxBlue = upperLimitIntensity.getBlue();
+
+ double redDelta = (maxRed - minRed) / colorVerticalWidth;
+ double greenDelta = (maxGreen - minGreen) / colorVerticalWidth;
+ double blueDelta = (maxBlue - minBlue) / colorVerticalWidth;
+
+ for (int k = 0; k < colorVerticalWidth; k++) {
+
+
+ g2d.setColor(new Color((float)(minRed + (k * redDelta)), (float)(minGreen + (k * greenDelta)), (float)(minBlue + (k * blueDelta)), 1f));
+ Rectangle2D colorVertical = new Rectangle2D.Double(colorVerticalLeft + k, colorVerticalTop, 1, colorVerticalHeigth);
+ g2d.fill(colorVertical);
+ }
+
+ } else {
+ g2d.setColor(new Color((float)intensity.getRed(), (float)intensity.getGreen(), (float)intensity.getBlue(), 1f));
+ Rectangle2D colorVertical = new Rectangle2D.Double(colorVerticalLeft, colorVerticalTop, colorVerticalWidth, colorVerticalHeigth);
+ g2d.fill(colorVertical);
+ }
+
+