List of usage examples for java.awt Color getBlue
public int getBlue()
From source file:org.lnicholls.galleon.util.Tools.java
public static Color darken(Color color) { return new Color((int) (color.getRed() * 0.59), (int) (color.getGreen() * 0.59), (int) (color.getBlue() * 0.59)); }
From source file:org.tros.utils.converters.ColorConverter.java
/** * Convert.//from w ww. j av a2s .c om * * @param <T> * @param type * @param value * @return */ @Override @SuppressWarnings("unchecked") public <T> T convert(Class<T> type, Object value) { if (type == String.class) { if (value.getClass() == Color.class) { Color c = (Color) value; return (T) String.format("#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue()); } else { return (T) value; } } else { try { return (T) Color.class.getField(value.toString()).get(null); } catch (NoSuchFieldException ex) { } catch (SecurityException | IllegalArgumentException | IllegalAccessException ex) { } return (T) Color.decode(value.toString()); } }
From source file:ColorPicker3.java
protected int toGray(Color c) { int r = c.getRed(); int g = c.getGreen(); int b = c.getBlue(); // Grab the luminance the same way GIMP does... return (int) Math.round(0.3 * r + 0.59 * g + 0.11 * b); }
From source file:guineu.modules.visualization.intensityboxplot.IntensityBoxPlotDrawingSupplier.java
public Paint getNextPaint() { // get new color from the default supplier Color baseColor = (Color) super.getNextPaint(); // ban colors that are too bright int colorSum = baseColor.getRed() + baseColor.getGreen() + baseColor.getBlue(); if (colorSum > 520) baseColor = baseColor.darker();/*from w ww. j av a 2s.c o m*/ return baseColor; }
From source file:org.pentaho.ui.xul.swt.tags.SwtBox.java
public void setBgcolor(String bgcolor) { this.bgcolor = bgcolor; Color c = Color.decode(bgcolor); box.setBackground(// ww w .j a v a2 s . co m new org.eclipse.swt.graphics.Color(box.getDisplay(), c.getRed(), c.getGreen(), c.getBlue())); box.setBackgroundMode(SWT.INHERIT_DEFAULT); }
From source file:net.sf.mzmine.modules.peaklistmethods.dataanalysis.projectionplots.ProjectionPlotRenderer.java
private boolean isAvoidColor(Color color) { for (Color c : avoidColors) { if ((color.getRed() >= c.getRed()) && (color.getGreen() >= c.getGreen()) && (color.getBlue() >= c.getBlue())) return true; }//from w w w . j a v a2s.co m return false; }
From source file:dr.PlotRenderer.java
private boolean isAvoidColor(Color color) { for (Color c : avoidColors) { if ((color.getRed() >= c.getRed()) && (color.getGreen() >= c.getGreen()) && (color.getBlue() >= c.getBlue())) { return true; }// ww w. j av a 2 s .c o m } return false; }
From source file:lisong_mechlab.view.graphs.WeaponColouredDrawingSupplier.java
private Color colorShift(Color aColour, int aMax, int aCurr) { float hsb[] = new float[3]; Color.RGBtoHSB(aColour.getRed(), aColour.getGreen(), aColour.getBlue(), hsb); float blend = aMax == 1 ? 1.0f : (float) aCurr / (aMax - 1); float range_min = 0.55f; float range_max = 1.0f; float saturation = (range_max - range_min) * blend + range_min; hsb[1] *= saturation;// ww w. j av a 2s. com hsb[2] *= saturation; return new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2])); }
From source file:gr.iti.mklab.reveal.forensics.util.Util.java
public static int[][][] getRGBArray(BufferedImage imageIn) { // possible 10-fold speed increase in: // http://stackoverflow.com/questions/6524196/java-get-pixel-array-from-image // (but ensure all major bases are covered) int ImW = imageIn.getWidth(); int ImH = imageIn.getHeight(); Color tmpColor; int[][][] rgbValues = new int[3][ImW][ImH]; for (int ii = 0; ii < ImW; ii++) { for (int jj = 0; jj < ImH; jj++) { tmpColor = new Color(imageIn.getRGB(ii, jj)); rgbValues[0][ii][jj] = tmpColor.getRed(); rgbValues[1][ii][jj] = tmpColor.getGreen(); rgbValues[2][ii][jj] = tmpColor.getBlue(); }/*w ww .j a v a 2 s . c o m*/ } return rgbValues; }
From source file:savant.settings.PersistentSettings.java
public void setColour(String key, Color value) { setProperty(key, String.format("%02X%02X%02X%02X", value.getRed(), value.getGreen(), value.getBlue(), value.getAlpha()));/*w w w. jav a 2s . c o m*/ }