Package org.pushingpixels.substance.api

Examples of org.pushingpixels.substance.api.ColorSchemeAssociationKind


        .getCurrModelStateNoSelection() : modelStateInfo
        .getCurrModelState();

    // Use HIGHLIGHT for rollover menus (arrow icons)
    // and MARK for the rest
    ColorSchemeAssociationKind baseAssociationKind = isMenu
        && currState.isFacetActive(ComponentStateFacet.ROLLOVER) ? ColorSchemeAssociationKind.HIGHLIGHT
        : ColorSchemeAssociationKind.MARK;
    SubstanceColorScheme baseScheme = SubstanceColorSchemeUtilities
        .getColorScheme(this.component, baseAssociationKind, currState);
    float baseAlpha = SubstanceColorSchemeUtilities.getAlpha(
        this.component, currState);

    HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(this.component
        .getClass().getName(), this.orientation, SubstanceSizeUtils
        .getComponentFontSize(this.component), baseScheme
        .getDisplayName(), baseAlpha);
    Icon layerBase = iconMap.get(keyBase);
    if (layerBase == null) {
      Icon baseFullOpacity = this.delegate.getColorSchemeIcon(baseScheme);
      if (baseAlpha == 1.0f) {
        layerBase = baseFullOpacity;
        iconMap.put(keyBase, layerBase);
      } else {
        BufferedImage baseImage = SubstanceCoreUtilities.getBlankImage(
            baseFullOpacity.getIconWidth(), baseFullOpacity
                .getIconHeight());
        Graphics2D g2base = baseImage.createGraphics();
        g2base.setComposite(AlphaComposite.SrcOver.derive(baseAlpha));
        baseFullOpacity.paintIcon(this.component, g2base, 0, 0);
        g2base.dispose();
        layerBase = new ImageIcon(baseImage);
        iconMap.put(keyBase, layerBase);
      }
    }
    // System.out.println("Contribution map in painting");
    // for (Map.Entry<ComponentState,
    // StateTransitionTracker.StateContributionInfo> existing : activeStates
    // .entrySet()) {
    // System.out.println("\t" + existing.getKey() + " in ["
    // + existing.getValue().start + ":" + existing.getValue().end
    // + "] : " + existing.getValue().curr);
    // }

    if (currState.isDisabled() || (activeStates.size() == 1)) {
      return layerBase;
    }

    BufferedImage result = SubstanceCoreUtilities.getBlankImage(layerBase
        .getIconWidth(), layerBase.getIconHeight());
    Graphics2D g2d = result.createGraphics();
    // draw the base layer
    // System.out.println("Painting currState " + currState + ":" +
    // baseAlpha);
    layerBase.paintIcon(this.component, g2d, 0, 0);

    // draw the other active layers
    for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
        .entrySet()) {
      ComponentState activeState = activeEntry.getKey();
      // System.out.println("Painting state " + activeState + "[curr is "
      // + currState + "] with " + activeEntry.getValue());
      if (activeState == currState)
        continue;

      float stateContribution = activeEntry.getValue().getContribution();
      // System.out.println("Painting activeState "
      // + activeState
      // + ":"
      // + stateContribution
      // + "*"
      // + SubstanceColorSchemeUtilities.getAlpha(this.component,
      // activeState));
      if (stateContribution > 0.0f) {
        g2d.setComposite(AlphaComposite.SrcOver
            .derive(stateContribution));

        ColorSchemeAssociationKind associationKind = isMenu
            && activeState
                .isFacetActive(ComponentStateFacet.ROLLOVER) ? ColorSchemeAssociationKind.HIGHLIGHT
            : ColorSchemeAssociationKind.MARK;
        SubstanceColorScheme scheme = SubstanceColorSchemeUtilities
            .getColorScheme(this.component, associationKind,
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.api.ColorSchemeAssociationKind

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.