/**
   * 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;
  }
Ejemplo n.º 2
0
  /**
   * Registers the specified color scheme bundle and background color scheme to be used on controls
   * in decoration areas.
   *
   * @param bundle The color scheme bundle to use on controls in decoration areas.
   * @param backgroundColorScheme The color scheme to use for background of controls in decoration
   *     areas.
   * @param areaTypes Enumerates the area types that are affected by the parameters.
   */
  public void registerDecorationAreaSchemeBundle(
      SubstanceColorSchemeBundle bundle,
      SubstanceColorScheme backgroundColorScheme,
      DecorationAreaType... areaTypes) {
    if (bundle == null) return;

    if (backgroundColorScheme == null) {
      throw new IllegalArgumentException("Cannot pass null background color scheme");
    }

    for (DecorationAreaType areaType : areaTypes) {
      this.decoratedAreaSet.add(areaType);
      this.colorSchemeBundleMap.put(areaType, bundle);
      this.backgroundColorSchemeMap.put(areaType, backgroundColorScheme);

      // if (areaType == DecorationAreaType.NONE) {
      // this.defaultColorScheme = bundle.getDefaultColorScheme();
      // }
    }
    this.statesWithAlpha.addAll(bundle.getStatesWithAlpha());
  }
Ejemplo n.º 3
0
  /** Creates a new <code>Autumn</code> skin. */
  public AutumnSkin() {
    SubstanceSkin.ColorSchemes schemes =
        SubstanceSkin.getColorSchemes("org/pushingpixels/substance/api/skin/autumn.colorschemes");

    SubstanceColorScheme activeScheme = schemes.get("Autumn Active");
    SubstanceColorScheme enabledScheme = schemes.get("Autumn Enabled");
    SubstanceColorScheme disabledScheme = enabledScheme;

    SubstanceColorSchemeBundle defaultSchemeBundle =
        new SubstanceColorSchemeBundle(activeScheme, enabledScheme, disabledScheme);
    defaultSchemeBundle.registerColorScheme(
        disabledScheme, 0.6f, ComponentState.DISABLED_UNSELECTED);
    defaultSchemeBundle.registerColorScheme(activeScheme, 0.6f, ComponentState.DISABLED_SELECTED);

    this.registerDecorationAreaSchemeBundle(defaultSchemeBundle, DecorationAreaType.NONE);

    SubstanceColorSchemeBundle titlePaneSchemeBundle =
        new SubstanceColorSchemeBundle(activeScheme, enabledScheme, disabledScheme);
    titlePaneSchemeBundle.registerColorScheme(
        disabledScheme, 0.6f, ComponentState.DISABLED_UNSELECTED);
    titlePaneSchemeBundle.registerColorScheme(activeScheme, 0.6f, ComponentState.DISABLED_SELECTED);

    SubstanceColorScheme borderScheme = enabledScheme.saturate(0.2f);
    titlePaneSchemeBundle.registerColorScheme(
        borderScheme, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED);

    this.registerDecorationAreaSchemeBundle(
        titlePaneSchemeBundle,
        activeScheme,
        DecorationAreaType.PRIMARY_TITLE_PANE,
        DecorationAreaType.SECONDARY_TITLE_PANE);

    SubstanceColorScheme watermarkScheme = schemes.get("Autumn Watermark");

    this.registerAsDecorationArea(
        activeScheme,
        DecorationAreaType.PRIMARY_TITLE_PANE,
        DecorationAreaType.SECONDARY_TITLE_PANE,
        DecorationAreaType.HEADER);

    this.registerAsDecorationArea(
        watermarkScheme,
        DecorationAreaType.GENERAL,
        DecorationAreaType.FOOTER,
        DecorationAreaType.TOOLBAR);

    // add an overlay painter to paint a drop shadow along the top
    // edge of toolbars
    this.addOverlayPainter(TopShadowOverlayPainter.getInstance(), DecorationAreaType.TOOLBAR);

    // add an overlay painter to paint separator lines along the bottom
    // edges of title panes and menu bars
    this.bottomLineOverlayPainter = new BottomLineOverlayPainter(ColorSchemeSingleColorQuery.DARK);
    this.addOverlayPainter(
        this.bottomLineOverlayPainter,
        DecorationAreaType.PRIMARY_TITLE_PANE,
        DecorationAreaType.SECONDARY_TITLE_PANE,
        DecorationAreaType.HEADER);

    this.buttonShaper = new ClassicButtonShaper();
    this.fillPainter = new MatteFillPainter();
    this.borderPainter =
        new CompositeBorderPainter(
            "Autumn",
            new ClassicBorderPainter(),
            new DelegateBorderPainter(
                "Autumn Inner",
                new ClassicBorderPainter(),
                new ColorSchemeTransform() {
                  @Override
                  public SubstanceColorScheme transform(SubstanceColorScheme scheme) {
                    return scheme.tint(0.8f);
                  }
                }));

    this.highlightPainter = new ClassicHighlightPainter();

    MarbleNoiseDecorationPainter decorationPainter = new MarbleNoiseDecorationPainter();
    decorationPainter.setTextureAlpha(0.7f);
    this.decorationPainter = decorationPainter;
  }
Ejemplo n.º 4
0
 /**
  * Registers the specified color scheme bundle to be used on controls in decoration areas.
  *
  * @param bundle The color scheme bundle to use on controls in decoration areas.
  * @param areaTypes Enumerates the area types that are affected by the parameters.
  */
 public void registerDecorationAreaSchemeBundle(
     SubstanceColorSchemeBundle bundle, DecorationAreaType... areaTypes) {
   this.registerDecorationAreaSchemeBundle(bundle, bundle.getEnabledColorScheme(), areaTypes);
 }