@Override public String toString() { return this.scheme.getDisplayName(); }
/** * Returns the color scheme based on its display name. This method is * the only API that is published for use in custom application skins. * * @param displayName * Display name of a color scheme. * @return The color scheme with the matching display name. */ public SubstanceColorScheme get(String displayName) { for (SubstanceColorScheme scheme : this.schemes) { if (scheme.getDisplayName().equals(displayName)) { return scheme; } } return null; }
/** * Returns the color scheme based on its display name. This method is * the only API that is published for use in custom application skins. * * @param displayName * Display name of a color scheme. * @return The color scheme with the matching display name. */ public SubstanceColorScheme get(String displayName) { for (SubstanceColorScheme scheme : this.schemes) { if (scheme.getDisplayName().equals(displayName)) { return scheme; } } return null; }
/** * Returns the index of the color scheme that has the specified display * name. This method is for internal use only and should not be used in * custom application skins. * * @param displayName * Display name of a color scheme. * @return The index of the color scheme that has the specified display * name. */ private int indexOf(String displayName) { for (int i = 0; i < this.schemes.size(); i++) { SubstanceColorScheme curr = this.schemes.get(i); if (curr.getDisplayName().equals(displayName)) { return i; } } return -1; }
/** * Returns the index of the color scheme that has the specified display * name. This method is for internal use only and should not be used in * custom application skins. * * @param displayName * Display name of a color scheme. * @return The index of the color scheme that has the specified display * name. */ private int indexOf(String displayName) { for (int i = 0; i < this.schemes.size(); i++) { SubstanceColorScheme curr = this.schemes.get(i); if (curr.getDisplayName().equals(displayName)) { return i; } } return -1; }
/** * Creates the resolver of derived colors for the specified light color * scheme. * * @param scheme * The original color scheme. */ public DerivedColorsResolverLight(SubstanceColorScheme scheme) { if (scheme.isDark()) { throw new IllegalArgumentException("The scheme must be light: " + scheme.getDisplayName()); } this.scheme = scheme; }
/** * Creates the resolver of derived colors for the specified dark color * scheme. * * @param scheme * The original color scheme. */ public DerivedColorsResolverDark(SubstanceColorScheme scheme) { if (!scheme.isDark()) { throw new IllegalArgumentException("The scheme must be dark: " + scheme.getDisplayName()); } this.scheme = scheme; }
/** * Returns a colorized image tile. * * @param scheme * Color scheme for the colorization. * @return Colorized tile. */ protected Image getColorizedTile(SubstanceColorScheme scheme) { Image result = this.colorizedTileMap.get(scheme.getDisplayName()); if (result == null) { BufferedImage tileBi = new BufferedImage(this.originalTile .getWidth(null), this.originalTile.getHeight(null), BufferedImage.TYPE_INT_ARGB); tileBi.getGraphics().drawImage(this.originalTile, 0, 0, null); result = SubstanceImageCreator.getColorSchemeImage(tileBi, scheme, 0.0f); this.colorizedTileMap.put(scheme.getDisplayName(), result); } return result; } }
/** * Returns a colorized image tile. * * @param scheme * Color scheme for the colorization. * @return Colorized tile. */ protected Image getColorizedTile(SubstanceColorScheme scheme) { Image result = this.colorizedTileMap.get(scheme.getDisplayName()); if (result == null) { BufferedImage tileBi = new BufferedImage(this.originalTile .getWidth(null), this.originalTile.getHeight(null), BufferedImage.TYPE_INT_ARGB); tileBi.getGraphics().drawImage(this.originalTile, 0, 0, null); result = SubstanceImageCreator.getColorSchemeImage(tileBi, scheme, 0.0f); this.colorizedTileMap.put(scheme.getDisplayName(), result); } return result; } }
public static ColorSchemeFilter getColorSchemeFilter( SubstanceColorScheme scheme, float originalBrightnessFactor) { HashMapKey key = SubstanceCoreUtilities.getHashKey(scheme .getDisplayName(), originalBrightnessFactor); ColorSchemeFilter filter = filters.get(key); if (filter == null) { filter = new ColorSchemeFilter(scheme, originalBrightnessFactor); filters.put(key, filter); } return filter; }
public static ColorSchemeFilter getColorSchemeFilter( SubstanceColorScheme scheme, float originalBrightnessFactor) { HashMapKey key = SubstanceCoreUtilities.getHashKey(scheme .getDisplayName(), originalBrightnessFactor); ColorSchemeFilter filter = filters.get(key); if (filter == null) { filter = new ColorSchemeFilter(scheme, originalBrightnessFactor); filters.put(key, filter); } return filter; }
public void paintDecorationArea(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { SubstanceColorScheme scheme = skin .getBackgroundColorScheme(decorationAreaType); if (width * height < 100000) { HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height, scheme.getDisplayName()); BufferedImage result = smallImageCache.get(key); if (result == null) { result = SubstanceCoreUtilities.getBlankImage(width, height); this.internalPaint((Graphics2D) result.getGraphics(), comp, width, height, scheme); smallImageCache.put(key, result); } graphics.drawImage(result, 0, 0, null); return; } this.internalPaint(graphics, comp, width, height, scheme); }
@Override public void paintDecorationArea(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { SubstanceColorScheme scheme = skin .getBackgroundColorScheme(decorationAreaType); if (width * height < 100000) { HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height, scheme.getDisplayName()); BufferedImage result = smallImageCache.get(key); if (result == null) { result = SubstanceCoreUtilities.getBlankImage(width, height); this.internalPaint((Graphics2D) result.getGraphics(), comp, width, height, scheme); smallImageCache.put(key, result); } graphics.drawImage(result, 0, 0, null); return; } this.internalPaint(graphics, comp, width, height, scheme); }
/** * Retrieves a transformed color scheme. * * @param orig * Original color scheme. * @return Transformed color scheme. */ private SubstanceColorScheme getShiftScheme(SubstanceColorScheme orig) { HashMapKey key = SubstanceCoreUtilities.getHashKey(orig .getDisplayName(), this.getDisplayName(), this.transform); SubstanceColorScheme result = transformMap.get(key); if (result == null) { result = this.transform.transform(orig); transformMap.put(key, result); } return result; }
/** * Retrieves a transformed color scheme. * * @param orig * Original color scheme. * @return Transformed color scheme. */ private SubstanceColorScheme getShiftScheme(SubstanceColorScheme orig) { HashMapKey key = SubstanceCoreUtilities.getHashKey(orig .getDisplayName(), this.getDisplayName(), this.transform); SubstanceColorScheme result = transformMap.get(key); if (result == null) { result = this.transform.transform(orig); transformMap.put(key, result); } return result; }
/** * Retrieves a transformed color scheme. * * @param orig * Original color scheme. * @return Transformed color scheme. */ private SubstanceColorScheme getShiftScheme(SubstanceColorScheme orig) { HashMapKey key = SubstanceCoreUtilities.getHashKey(orig .getDisplayName(), this.getDisplayName(), this.transform); SubstanceColorScheme result = transformMap.get(key); if (result == null) { result = this.transform.transform(orig); transformMap.put(key, result); } return result; }
/** * Retrieves a transformed color scheme. * * @param orig * Original color scheme. * @return Transformed color scheme. */ private SubstanceColorScheme getShiftScheme(SubstanceColorScheme orig) { HashMapKey key = SubstanceCoreUtilities.getHashKey(orig .getDisplayName(), this.getDisplayName(), this.transform); SubstanceColorScheme result = transformMap.get(key); if (result == null) { result = this.transform.transform(orig); transformMap.put(key, result); } return result; }
/** * Creates a new inverted scheme. * * @param origScheme * The original color scheme. */ public NegatedColorScheme(SubstanceColorScheme origScheme) { super("Negated " + origScheme.getDisplayName(), !origScheme.isDark()); this.origScheme = origScheme; this.foregroundColor = SubstanceColorUtilities.invertColor(origScheme .getForegroundColor()); this.mainUltraDarkColor = SubstanceColorUtilities .invertColor(origScheme.getUltraDarkColor()); this.mainDarkColor = SubstanceColorUtilities.invertColor(origScheme .getDarkColor()); this.mainMidColor = SubstanceColorUtilities.invertColor(origScheme .getMidColor()); this.mainLightColor = SubstanceColorUtilities.invertColor(origScheme .getLightColor()); this.mainExtraLightColor = SubstanceColorUtilities .invertColor(origScheme.getExtraLightColor()); this.mainUltraLightColor = SubstanceColorUtilities .invertColor(origScheme.getUltraLightColor()); }
/** * Creates a new inverted scheme. * * @param origScheme * The original color scheme. */ public InvertedColorScheme(SubstanceColorScheme origScheme) { super("Inverted " + origScheme.getDisplayName(), getResolver(origScheme).invert()); this.origScheme = origScheme; this.foregroundColor = SubstanceColorUtilities.invertColor(origScheme .getForegroundColor()); this.mainUltraDarkColor = SubstanceColorUtilities .invertColor(origScheme.getUltraLightColor()); this.mainDarkColor = SubstanceColorUtilities.invertColor(origScheme .getExtraLightColor()); this.mainMidColor = SubstanceColorUtilities.invertColor(origScheme .getLightColor()); this.mainLightColor = SubstanceColorUtilities.invertColor(origScheme .getMidColor()); this.mainExtraLightColor = SubstanceColorUtilities .invertColor(origScheme.getDarkColor()); this.mainUltraLightColor = SubstanceColorUtilities .invertColor(origScheme.getUltraDarkColor()); }
/** * Creates a new inverted scheme. * * @param origScheme * The original color scheme. */ public NegatedColorScheme(SubstanceColorScheme origScheme) { super("Negated " + origScheme.getDisplayName(), getResolver(origScheme).invert()); this.origScheme = origScheme; this.foregroundColor = SubstanceColorUtilities.invertColor(origScheme .getForegroundColor()); this.mainUltraDarkColor = SubstanceColorUtilities .invertColor(origScheme.getUltraDarkColor()); this.mainDarkColor = SubstanceColorUtilities.invertColor(origScheme .getDarkColor()); this.mainMidColor = SubstanceColorUtilities.invertColor(origScheme .getMidColor()); this.mainLightColor = SubstanceColorUtilities.invertColor(origScheme .getLightColor()); this.mainExtraLightColor = SubstanceColorUtilities .invertColor(origScheme.getExtraLightColor()); this.mainUltraLightColor = SubstanceColorUtilities .invertColor(origScheme.getUltraLightColor()); }