Java Code Examples for org.pushingpixels.substance.internal.utils.SubstanceColorUtilities#deriveByBrightness()
The following examples show how to use
org.pushingpixels.substance.internal.utils.SubstanceColorUtilities#deriveByBrightness() .
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: TopShadowOverlayPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 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); // need to handle components "embedded" in other components Component topMostWithSameDecorationAreaType = SubstanceCoreUtilities .getTopMostParentWithDecorationAreaType(comp, decorationAreaType); Point inTopMost = SwingUtilities.convertPoint(comp, new Point(0, 0), topMostWithSameDecorationAreaType); int dy = inTopMost.y; Graphics2D g2d = (Graphics2D) graphics.create(); g2d.translate(0, -dy); g2d.setPaint(new GradientPaint( 0, 0, SubstanceColorUtilities.getAlphaColor(shadowColor, this.startAlpha), 0, 4, SubstanceColorUtilities.getAlphaColor(shadowColor, 16))); g2d.fillRect(0, 0, comp.getWidth(), 4); g2d.dispose(); }
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: ColorWheelPanel.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Invoked when the mouse exits a component. */ public void mouseMoved(MouseEvent e) { GeneralPath oldPath = rolloverPath; rolloverPath = null; if (e.getSource() == imagePicker) { Point pt = e.getPoint(); if (paths != null) { int numPaths = paths.length; for (int i = 0; i < numPaths; i++) { if (paths[i].contains(pt.x, pt.y)) { rolloverPath = paths[i]; ModelColor[][] baseColors = ModelColor.getBaseColors(); int ring = i / ModelColor.NUM_SEGMENTS; ModelColor modelColor = baseColors[i % ModelColor.NUM_SEGMENTS][ring]; if (adjustRollover) { modelColor = new ModelColor(modelColor.H, saturationMultipler * modelColor.S, brightnessMultipler * modelColor.V); } rolloverColor = new Color(modelColor.getRed(), modelColor.getGreen(), modelColor.getBlue()); if (ring < 4) { rolloverColor = SubstanceColorUtilities.deriveByBrightness( rolloverColor, -0.5f); } else { rolloverColor = SubstanceColorUtilities.deriveByBrightness( rolloverColor, 0.8f); } break; } } } } if (rolloverPath != oldPath) repaint(); }
Example 4
Source File: DerivedColorsResolverDark.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Color getSelectionForegroundColor() { return SubstanceColorUtilities.deriveByBrightness(this.scheme.getUltraDarkColor(), -0.5f); }
Example 5
Source File: DerivedColorsResolverDark.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Color getSelectionBackgroundColor() { return SubstanceColorUtilities.deriveByBrightness(this.scheme.getUltraLightColor(), 0.2f); }
Example 6
Source File: DerivedColorsResolverLight.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Color getSelectionForegroundColor() { return SubstanceColorUtilities.deriveByBrightness(this.scheme.getUltraDarkColor(), -0.8f); }
Example 7
Source File: ShiftColorScheme.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Creates a new shifted color scheme. * * @param origScheme * The original color scheme. * @param backgroundShiftColor * Shift color for the background colors. * @param backgroundShiftFactor * Shift factor for the background colors. Should be in 0.0-1.0 * range. * @param foregroundShiftColor * Shift color for the foreground colors. * @param foregroundShiftFactor * Shift factor for the foreground colors. Should be in 0.0-1.0 * range. * @param shiftByBrightness * If <code>true</code>, the shift will account for the * brightness of the original color scheme colors. */ public ShiftColorScheme(SubstanceColorScheme origScheme, Color backgroundShiftColor, double backgroundShiftFactor, Color foregroundShiftColor, double foregroundShiftFactor, boolean shiftByBrightness) { super("Shift " + origScheme.getDisplayName() + " to backgr [" + backgroundShiftColor + "] " + (int) (100 * backgroundShiftFactor) + "%, foregr [" + foregroundShiftColor + "]" + (int) (100 * foregroundShiftFactor) + "%", origScheme.isDark()); this.backgroundShiftColor = backgroundShiftColor; this.backgroundShiftFactor = backgroundShiftFactor; this.foregroundShiftColor = foregroundShiftColor; this.foregroundShiftFactor = foregroundShiftFactor; this.origScheme = origScheme; this.foregroundColor = (this.foregroundShiftColor != null) ? SubstanceColorUtilities.getInterpolatedColor(this.foregroundShiftColor, origScheme.getForegroundColor(), this.foregroundShiftFactor) : origScheme.getForegroundColor(); shiftByBrightness = shiftByBrightness && (this.backgroundShiftColor != null); Color ultraDarkToShiftTo = shiftByBrightness ? SubstanceColorUtilities.deriveByBrightness(this.backgroundShiftColor, origScheme.getUltraDarkColor()) : this.backgroundShiftColor; this.mainUltraDarkColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities.getInterpolatedColor(ultraDarkToShiftTo, origScheme.getUltraDarkColor(), this.backgroundShiftFactor) : origScheme.getUltraDarkColor(); Color darkToShiftTo = shiftByBrightness ? SubstanceColorUtilities.deriveByBrightness(this.backgroundShiftColor, origScheme.getDarkColor()) : this.backgroundShiftColor; this.mainDarkColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities.getInterpolatedColor(darkToShiftTo, origScheme.getDarkColor(), this.backgroundShiftFactor) : origScheme.getDarkColor(); Color midToShiftTo = shiftByBrightness ? SubstanceColorUtilities.deriveByBrightness(this.backgroundShiftColor, origScheme.getMidColor()) : this.backgroundShiftColor; this.mainMidColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities.getInterpolatedColor(midToShiftTo, origScheme.getMidColor(), this.backgroundShiftFactor) : origScheme.getMidColor(); Color lightToShiftTo = shiftByBrightness ? SubstanceColorUtilities.deriveByBrightness(this.backgroundShiftColor, origScheme.getLightColor()) : this.backgroundShiftColor; this.mainLightColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities.getInterpolatedColor(lightToShiftTo, origScheme.getLightColor(), this.backgroundShiftFactor) : origScheme.getLightColor(); Color extraLightToShiftTo = shiftByBrightness ? SubstanceColorUtilities.deriveByBrightness(this.backgroundShiftColor, origScheme.getExtraLightColor()) : this.backgroundShiftColor; this.mainExtraLightColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities.getInterpolatedColor(extraLightToShiftTo, origScheme.getExtraLightColor(), this.backgroundShiftFactor) : origScheme.getExtraLightColor(); Color ultraLightToShiftTo = shiftByBrightness ? SubstanceColorUtilities.deriveByBrightness(this.backgroundShiftColor, origScheme.getUltraLightColor()) : this.backgroundShiftColor; this.mainUltraLightColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities.getInterpolatedColor(ultraLightToShiftTo, origScheme.getUltraLightColor(), this.backgroundShiftFactor) : origScheme.getUltraLightColor(); }