Java Code Examples for org.pushingpixels.substance.internal.utils.SubstanceColorUtilities#getAlphaColor()
The following examples show how to use
org.pushingpixels.substance.internal.utils.SubstanceColorUtilities#getAlphaColor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphiteGlassSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates a new <code>Graphite</code> skin. */ public GraphiteGlassSkin() { super(); SubstanceSkin.ColorSchemes schemes = SubstanceSkin.getColorSchemes( this.getClass().getClassLoader().getResourceAsStream( "org/pushingpixels/substance/api/skin/graphite.colorschemes")); SubstanceColorScheme backgroundScheme = schemes.get("Graphite Background"); this.registerAsDecorationArea(backgroundScheme, DecorationAreaType.PRIMARY_TITLE_PANE, DecorationAreaType.SECONDARY_TITLE_PANE, DecorationAreaType.HEADER); // add two overlay painters to create a bezel line between // menu bar and toolbars BottomLineOverlayPainter menuOverlayPainter = new BottomLineOverlayPainter( ColorSchemeSingleColorQuery.MID); TopLineOverlayPainter toolbarOverlayPainter = new TopLineOverlayPainter( (SubstanceColorScheme scheme) -> SubstanceColorUtilities.getAlphaColor( scheme.getForegroundColor(), 32)); this.addOverlayPainter(menuOverlayPainter, DecorationAreaType.HEADER); this.addOverlayPainter(toolbarOverlayPainter, DecorationAreaType.TOOLBAR); this.fillPainter = new GlassFillPainter(); this.decorationPainter = new ArcDecorationPainter(); this.highlightPainter = new GlassHighlightPainter(); }
Example 2
Source File: BottomShadowOverlayPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void paintOverlay(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { Color shadowColor = SubstanceColorUtilities.deriveByBrightness( SubstanceColorUtilities.getBackgroundFillColor(comp), -0.4f); Component topMostWithSameDecorationAreaType = SubstanceCoreUtilities .getTopMostParentWithDecorationAreaType(comp, decorationAreaType); int topHeight = topMostWithSameDecorationAreaType.getHeight(); Point inTopMost = SwingUtilities.convertPoint(comp, new Point(0, 0), topMostWithSameDecorationAreaType); int dy = inTopMost.y; Graphics2D fillGraphics = (Graphics2D) graphics.create(); fillGraphics.translate(0, -dy); int shadowHeight = 4; GradientPaint fillPaint = new GradientPaint(0, topHeight - shadowHeight, SubstanceColorUtilities.getAlphaColor(shadowColor, 0), 0, topHeight, SubstanceColorUtilities.getAlphaColor(shadowColor, this.endAlpha)); fillGraphics.setPaint(fillPaint); fillGraphics.fillRect(0, topHeight - shadowHeight, width, shadowHeight); fillGraphics.dispose(); }
Example 3
Source File: SubstanceEtchedBorder.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns the highlight color for the specified component. * * @param c * Component. * @return Matching highlight color. */ public Color getHighlightColor(Component c) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(c, ColorSchemeAssociationKind.SEPARATOR, ComponentState.ENABLED); boolean isDark = colorScheme.isDark(); Color foreDark = isDark ? colorScheme.getExtraLightColor() : SubstanceColorUtilities.getInterpolatedColor(colorScheme .getMidColor(), colorScheme.getDarkColor(), 0.4); return SubstanceColorUtilities.getAlphaColor(foreDark, 196); }
Example 4
Source File: SubstanceEtchedBorder.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns the shadow color for the specified component. * * @param c * Component. * @return Matching shadow color. */ public Color getShadowColor(Component c) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(c, ColorSchemeAssociationKind.SEPARATOR, ComponentState.ENABLED); Color back = colorScheme.isDark() ? colorScheme.getDarkColor() : colorScheme.getUltraLightColor(); return SubstanceColorUtilities.getAlphaColor(back, 196); }
Example 5
Source File: DerivedColorsResolverDark.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Color getWatermarkStampColor() { return SubstanceColorUtilities.getAlphaColor(this.scheme.getUltraLightColor(), 30); }
Example 6
Source File: DerivedColorsResolverDark.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Color getFocusRingColor() { return SubstanceColorUtilities.getAlphaColor(this.scheme.getForegroundColor(), 192); }
Example 7
Source File: DerivedColorsResolverLight.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Color getWatermarkStampColor() { return SubstanceColorUtilities.getAlphaColor(this.scheme.getMidColor(), 50); }
Example 8
Source File: DerivedColorsResolverLight.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Color getWatermarkDarkColor() { return SubstanceColorUtilities.getAlphaColor(this.scheme.getDarkColor(), 15); }
Example 9
Source File: DerivedColorsResolverLight.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Color getFocusRingColor() { return SubstanceColorUtilities.getAlphaColor(this.scheme.getForegroundColor(), 192); }
Example 10
Source File: SubstanceMosaicWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Draws the specified portion of the watermark image. * * @param skin Skin to use for painting the watermark. * @param graphics Graphic context. * @param x the <i>x</i> coordinate of the watermark to be drawn. * @param y The <i>y</i> coordinate of the watermark to be drawn. * @param width The width of the watermark to be drawn. * @param height The height of the watermark to be drawn. * @param isPreview Indication whether the result is a preview image. * @return Indication whether the draw succeeded. */ private boolean drawWatermarkImage(SubstanceSkin skin, Graphics2D graphics, int x, int y, int width, int height, boolean isPreview) { int sqDim = 7; int sqGap = 2; int cellDim = sqDim + sqGap; SubstanceColorScheme scheme = skin.getWatermarkColorScheme(); int rows = height / cellDim; int columns = width / cellDim; for (int col = 0; col <= columns; col++) { for (int row = 0; row <= rows; row++) { double val = isPreview ? Math.abs(Math.sin((1 + col + columns * row))) : Math.random(); int delta = isPreview ? (int) (150.0 * val) : (int) (50.0 * val); int alpha = 0; if (isPreview) { alpha = 50 + delta; } else { if (scheme.isDark()) alpha = 50 + delta * 3 / 2; else alpha = 25 + delta; } alpha = Math.min(alpha, 255); Color stampColor = null; if (isPreview) { stampColor = scheme.isDark() ? Color.lightGray : Color.darkGray; stampColor = SubstanceColorUtilities.getAlphaColor( stampColor, alpha); } else { stampColor = SubstanceColorUtilities.getAlphaColor(scheme .getWatermarkStampColor(), alpha); } graphics.setColor(stampColor); graphics.fillRect(x + col * cellDim, y + row * cellDim, sqDim, sqDim); } } return true; }