List of usage examples for java.awt Color getAlpha
public int getAlpha()
From source file:net.sourceforge.atunes.kernel.modules.state.ColorBean.java
/** * Creates new color bean//from w w w .j av a2s . co m * * @param c */ public ColorBean(final Color c) { this.red = c.getRed(); this.green = c.getGreen(); this.blue = c.getBlue(); this.alpha = c.getAlpha(); }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.PlotInstanceLegendCreator.java
private static Paint createTransparentCheckeredPaint(Color color, int checkerSize) { int s = checkerSize; BufferedImage bufferedImage = new BufferedImage(2 * s, 2 * s, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bufferedImage.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias! RenderingHints.VALUE_ANTIALIAS_ON); Color c1 = DataStructureUtils.setColorAlpha(color, (int) (color.getAlpha() * .8)); Color c2 = DataStructureUtils.setColorAlpha(color, (int) (color.getAlpha() * .2)); g2.setStroke(new BasicStroke(0)); g2.setPaint(c2);//from www . j av a2 s .c o m g2.setColor(c2); g2.fillRect(0, 0, s, s); g2.fillRect(s, s, s, s); g2.setPaint(c1); g2.setColor(c1); g2.fillRect(0, s, s, s); g2.fillRect(s, 0, s, s); // paint with the texturing brush Rectangle2D rect = new Rectangle2D.Double(0, 0, 2 * s, 2 * s); return new TexturePaint(bufferedImage, rect); }
From source file:playground.johannes.socialnetworks.graph.spatial.io.KMLVertexColorStyle.java
public List<StyleType> getObjectStyle(G graph) { TDoubleObjectHashMap<String> values = getValues(graph); double[] keys = values.keys(); double min = StatUtils.min(keys); double max = StatUtils.max(keys); List<StyleType> styleTypes = new ArrayList<StyleType>(keys.length); styleIdMappings = new TDoubleObjectHashMap<String>(); for (double val : keys) { StyleType styleType = objectFactory.createStyleType(); styleType.setId(values.get(val)); IconStyleType iconStyle = objectFactory.createIconStyleType(); iconStyle.setIcon(vertexIconLink); iconStyle.setScale(0.5);/*from w ww .j a v a2 s . c o m*/ // iconStyle.setScale(1.0); Color c = colorForValue(val, min, max); iconStyle.setColor( new byte[] { (byte) c.getAlpha(), (byte) c.getBlue(), (byte) c.getGreen(), (byte) c.getRed() }); styleType.setIconStyle(iconStyle); styleTypes.add(styleType); styleIdMappings.put(val, styleType.getId()); } return styleTypes; }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.renderer.FormattedXYDifferenceRenderer.java
@Override public Paint getPositivePaint() { StaticDebug.debug("getPositivePaint(): " + trueSeriesIdx); Color color = getFormatDelegate().getSeriesColor(trueSeriesIdx); if (color != null) { return DataStructureUtils.setColorAlpha(color, color.getAlpha() / 2); } else {/*from ww w .j ava2 s. c o m*/ return super.getPositivePaint(); } }
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())); }
From source file:net.sourceforge.entrainer.socket.FlashColour.java
/** * Sets the color.//from w w w. ja v a 2s . c o m * * @param c * the new color */ @JsonIgnore public void setColor(Color c) { if (c == null) return; setRed(c.getRed()); setGreen(c.getGreen()); setBlue(c.getBlue()); setAlpha(c.getAlpha()); }
From source file:org.jfree.eastwood.GCategoryPlot.java
/** * Draws the gridlines for the plot./*from w w w .j ava2 s . c o m*/ * * @param g2 the graphics device. * @param dataArea the area inside the axes. * @param ticks the ticks. * * @see #drawDomainGridlines(Graphics2D, Rectangle2D) */ protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) { // draw the range grid lines, if any... if (isRangeGridlinesVisible()) { Stroke gridStroke = getRangeGridlineStroke(); Paint gridPaint = getRangeGridlinePaint(); if ((gridStroke != null) && (gridPaint != null)) { ValueAxis axis = getRangeAxis(); if (axis != null) { double lower = axis.getRange().getLowerBound(); double upper = axis.getRange().getUpperBound(); double y = lower; while (y <= upper) { Paint paint = gridPaint; if ((y == lower || y == upper) && gridPaint instanceof Color) { Color c = (Color) gridPaint; paint = new Color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha() / 3); } try { setRangeGridlinePaint(paint); getRenderer().drawRangeGridline(g2, this, getRangeAxis(), dataArea, y); } finally { setRangeGridlinePaint(gridPaint); } y += this.yAxisStepSize; } } } } }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.renderer.FormattedXYDifferenceRenderer.java
@Override public Paint getNegativePaint() { StaticDebug.debug("getNegativePaint(): " + trueSeriesIdx); Color color = getFormatDelegate().getSeriesColor(trueSeriesIdx); if (color != null) { return (new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue(), color.getAlpha() / 2)); } else {/*from w w w .jav a2 s . c o m*/ return super.getNegativePaint(); } }
From source file:it.cnr.istc.utils.gui.ReverseGradientXYBarPainter.java
/** * Paints a single bar instance.// w ww.ja v a2 s . c om * * @param g2 the graphics target. * @param renderer the renderer. * @param row the row index. * @param column the column index. * @param bar the bar * @param base indicates which side of the rectangle is the base of the bar. * @param pegShadow peg the shadow to the base of the bar? */ @Override public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row, int column, RectangularShape bar, RectangleEdge base, boolean pegShadow) { // handle a special case - if the bar colour has alpha == 0, it is // invisible so we shouldn't draw any shadow Paint itemPaint = renderer.getItemPaint(row, column); if (itemPaint instanceof Color) { Color c = (Color) itemPaint; if (c.getAlpha() == 0) { return; } } RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(), renderer.getShadowYOffset(), base, pegShadow); g2.setPaint(Color.gray); g2.fill(shadow); }
From source file:util.settings.ColorProperty.java
/** * Sets the Color in this Property/*from w w w .j av a 2s . c o m*/ * @param color Color */ public void setColor(Color color) { if (color == mDefaultColor) { setProperty(null); } else { mCachedValue = color; String value = UiUtilities.getHTMLColorCode(color) + StringUtils.leftPad(Integer.toString(color.getAlpha(), 16), 2, '0'); setProperty(value); } }