/** * Creates a new color scheme bundle that has the same settings as this color scheme bundle with * the addition of applying the specified color scheme transformation on all the relevant color * schemes * * @param transform Color scheme transformation. * @return The new color scheme bundle. */ SubstanceColorSchemeBundle transform(ColorSchemeTransform transform) { // transform the basic schemes SubstanceColorSchemeBundle result = new SubstanceColorSchemeBundle( transform.transform(this.activeColorScheme), transform.transform(this.enabledColorScheme), transform.transform(this.disabledColorScheme)); for (Map.Entry<ColorSchemeAssociationKind, Map<ComponentState, SubstanceColorScheme>> entry : this.colorSchemeMap.entrySet()) { for (Map.Entry<ComponentState, SubstanceColorScheme> subEntry : entry.getValue().entrySet()) { result .colorSchemeMap .get(entry.getKey()) .put(subEntry.getKey(), transform.transform(subEntry.getValue())); } } // alphas are the same if (this.stateAlphaMap != null) { result.stateAlphaMap = new HashMap<ComponentState, Float>(this.stateAlphaMap); } // highlight alphas are the same if (this.stateHighlightSchemeAlphaMap != null) { result.stateHighlightSchemeAlphaMap = new HashMap<ComponentState, Float>(this.stateHighlightSchemeAlphaMap); } return result; }
/** * Creates a new skin that has the same settings as this skin with the addition of applying the * specified color scheme transformation on all the relevant color schemes. * * @param transform Color scheme transformation. * @param name The name of the new skin. * @return The new skin. */ public SubstanceSkin transform(ColorSchemeTransform transform, final String name) { SubstanceSkin result = new SubstanceSkin() { @Override public String getDisplayName() { return name; } }; // same painters result.borderPainter = this.borderPainter; result.buttonShaper = this.buttonShaper; result.decorationPainter = this.decorationPainter; result.fillPainter = this.fillPainter; result.highlightPainter = this.highlightPainter; result.highlightBorderPainter = this.highlightBorderPainter; // same watermark and transformed scheme result.watermark = this.watermark; if (this.watermarkScheme != null) result.watermarkScheme = transform.transform(this.watermarkScheme); // issue 428 - transform the default color scheme // result.defaultColorScheme = transform // .transform(this.defaultColorScheme); // same misc settings result.selectedTabFadeEnd = this.selectedTabFadeEnd; result.selectedTabFadeStart = this.selectedTabFadeStart; // transform the scheme bundles if (this.colorSchemeBundleMap != null) { result.colorSchemeBundleMap = new HashMap<DecorationAreaType, SubstanceColorSchemeBundle>(); for (Map.Entry<DecorationAreaType, SubstanceColorSchemeBundle> bundleEntry : this.colorSchemeBundleMap.entrySet()) { result.colorSchemeBundleMap.put( bundleEntry.getKey(), bundleEntry.getValue().transform(transform)); } } // same set of decoration areas if (this.decoratedAreaSet != null) { result.decoratedAreaSet = new HashSet<DecorationAreaType>(this.decoratedAreaSet); } // transform the background schemes if (this.backgroundColorSchemeMap != null) { result.backgroundColorSchemeMap = new HashMap<DecorationAreaType, SubstanceColorScheme>(); for (Map.Entry<DecorationAreaType, SubstanceColorScheme> entry : this.backgroundColorSchemeMap.entrySet()) { result.backgroundColorSchemeMap.put(entry.getKey(), transform.transform(entry.getValue())); } } // same map of overlay painters result.overlayPaintersMap = new HashMap<DecorationAreaType, List<SubstanceOverlayPainter>>(this.overlayPaintersMap); return result; }