List of usage examples for java.awt Color getGreen
public int getGreen()
From source file:canreg.client.analysis.Tools.java
public static Color darken(Color color) { return new Color((int) Math.floor(color.getRed() * .9), (int) Math.floor(color.getGreen() * .9), (int) Math.floor(color.getBlue() * .9)); }
From source file:org.opensha.commons.geo.RegionUtils.java
private static String colorToHex(Color c) { StringBuffer sb = new StringBuffer(); sb.append(toHex(c.getAlpha()));//from w w w. j a v a 2 s.c o m sb.append(toHex(c.getBlue())); sb.append(toHex(c.getGreen())); sb.append(toHex(c.getRed())); return sb.toString(); }
From source file:org.jtrfp.trcl.core.Texture.java
private static VectorList colorVL(Color c) { final double[] color = new double[] { c.getRed() / 255., c.getGreen() / 255., c.getBlue() / 255., c.getAlpha() / 255. };// ww w .j a v a 2 s. com return new VectorList() { @Override public int getNumVectors() { return 1; } @Override public int getNumComponentsPerVector() { return 4; } @Override public double componentAt(int vectorIndex, int componentIndex) { return color[componentIndex]; } @Override public void setComponentAt(int vectorIndex, int componentIndex, double value) { throw new RuntimeException( "Static palette created by Texture(Color c, TR tr) cannot be written to."); } }; }
From source file:org.apache.fop.render.rtf.TextAttributesConverter.java
private static void attrFontColor(Color colorType, RtfAttributes rtfAttr) { // Cell background color if (colorType != null) { if (colorType.getAlpha() != 0 || colorType.getRed() != 0 || colorType.getGreen() != 0 || colorType.getBlue() != 0) { rtfAttr.set(RtfText.ATTR_FONT_COLOR, convertFOPColorToRTF(colorType)); }/*from w ww. j a va 2s . c o m*/ } }
From source file:org.nuclos.client.common.Utils.java
public static Color getBestForegroundColor(Color background) { int backgroundBrightness = (background.getBlue() + background.getRed() * 2 + background.getGreen() * 3) / 6; return backgroundBrightness > 160 ? Color.BLACK : Color.WHITE; }
From source file:com.netsteadfast.greenstep.util.SimpleUtils.java
public static int[] getColorRGB2(String color) throws Exception { if (StringUtils.isEmpty(color) || color.length() != 7) { return new int[] { 0, 0, 0 }; }//from w w w. ja v a2s.c o m Color c = Color.decode(color); return new int[] { c.getRed(), c.getGreen(), c.getBlue() }; }
From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputHeatmap.java
protected static final LookupPaintScale createLUT(final int ncol, final float vmin, final float vmax, final Color start, final Color end) { final float[][] colors = new float[][] { { start.getRed() / 255f, start.getGreen() / 255f, start.getBlue() / 255f, start.getAlpha() / 255f }, { end.getRed() / 255f, end.getGreen() / 255f, end.getBlue() / 255f, end.getAlpha() / 255f } }; final float[] limits = new float[] { 0, 1 }; final LookupPaintScale lut = new LookupPaintScale(vmin, vmax, start); float val; float r, g, b, a; for (int j = 0; j < ncol; j++) { val = j / (ncol - 0.99f); final int i = 0; r = colors[i][0] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][0] - colors[i][0]); g = colors[i][1] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][1] - colors[i][1]); b = colors[i][2] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][2] - colors[i][2]); a = colors[i][3] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][3] - colors[i][3]); lut.add(val * (vmax - vmin) + vmin, new Color(r, g, b, a)); }/*from w w w .j a va 2 s .c o m*/ return lut; }
From source file:lucee.runtime.tag.VideoPlayerJW.java
private static String format(String prefix, Color color) { return prefix + toHex(color.getRed()) + toHex(color.getGreen()) + toHex(color.getBlue()); }
From source file:org.fhcrc.cpl.toolbox.gui.chart.PanelWithHeatMap.java
protected static void addValuesToPaintScale(LookupPaintScale paintScale, double lowerBound, double upperBound, Color lowColor, Color highColor) { int distinctValues = DISTINCT_PALETTE_VALUES; if (upperBound <= lowerBound) upperBound = lowerBound + .0001; double increment = (upperBound - lowerBound) / distinctValues; int redDiff = highColor.getRed() - lowColor.getRed(); int greenDiff = highColor.getGreen() - lowColor.getGreen(); int blueDiff = highColor.getBlue() - lowColor.getBlue(); double redIncrement = (redDiff / distinctValues); double greenIncrement = (greenDiff / distinctValues); double blueIncrement = (blueDiff / distinctValues); _log.debug("Palette: "); for (int i = 0; i < distinctValues; i++) { int r = (int) (lowColor.getRed() + (i * redIncrement)); int g = (int) (lowColor.getGreen() + (i * greenIncrement)); int b = (int) (lowColor.getBlue() + (i * blueIncrement)); Color incrementColor = new Color(r, g, b); double incrementStart = lowerBound + (i * increment); paintScale.add(incrementStart, incrementColor); _log.debug("\t" + incrementStart + "-" + (incrementStart + increment) + ": " + incrementColor); }/*from w w w .ja va2s. co m*/ }
From source file:org.polymap.rhei.batik.engine.svg.Svg2Png.java
private static float[] replaceColors(ImageConfiguration imageConfiguration, Color color, final float[] currentHsb) { float[] hsb;/* w w w.j a v a 2s . c om*/ Optional<ReplaceConfiguration> config = imageConfiguration.getReplaceConfigurations().stream() .filter(rc -> rc.getFrom() != null && rc.getTo() != null && rc.getFrom().red == color.getRed() && rc.getFrom().green == color.getGreen() && rc.getFrom().blue == color.getBlue()) .findFirst(); if (config.isPresent()) { hsb = config.get().getTo().getHSB(); hsb[0] = degreeToPercent(hsb[0]); } else { hsb = currentHsb; } return hsb; }