Package org.pushingpixels.substance.api.painter.border

Examples of org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter


      width = Math.min(width, this.size - 2);
      int delta = (this.size - width) / 2;

      SubstanceFillPainter fillPainter = SubstanceCoreUtilities
          .getFillPainter(slider);
      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(slider);

      SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, currState);
      SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, ColorSchemeAssociationKind.BORDER,
              currState);

      HashMapKey baseKey = SubstanceCoreUtilities.getHashKey(this.size,
          width, baseFillScheme.getDisplayName(), baseBorderScheme
              .getDisplayName(), fillPainter.getDisplayName(),
          borderPainter.getDisplayName(), this.isMirrorred);

      Icon baseLayer = SliderHorizontalIcon.icons.get(baseKey);
      if (baseLayer == null) {
        baseLayer = getSingleLayer(slider, width, delta, fillPainter,
            borderPainter, baseFillScheme, baseBorderScheme);
        SliderHorizontalIcon.icons.put(baseKey, baseLayer);
      }

      if (currState.isDisabled() || (activeStates.size() == 1))
        return baseLayer;

      BufferedImage result = SubstanceCoreUtilities.getBlankImage(
          baseLayer.getIconWidth(), baseLayer.getIconHeight());
      Graphics2D g2d = result.createGraphics();
      baseLayer.paintIcon(slider, g2d, 0, 0);

      for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
          .entrySet()) {
        ComponentState activeState = activeEntry.getKey();
        if (activeState == currState)
          continue;

        float contribution = activeEntry.getValue().getContribution();
        if (contribution == 0.0f)
          continue;

        SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider, activeState);
        SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider,
                ColorSchemeAssociationKind.BORDER, activeState);

        HashMapKey key = SubstanceCoreUtilities.getHashKey(this.size,
            width, fillScheme.getDisplayName(), borderScheme
                .getDisplayName(),
            fillPainter.getDisplayName(), borderPainter
                .getDisplayName(), this.isMirrorred);

        Icon layer = SliderHorizontalIcon.icons.get(key);
        if (layer == null) {
          layer = getSingleLayer(slider, width, delta, fillPainter,
View Full Code Here


        width--;
      int delta = (this.size - width) / 2;

      SubstanceFillPainter fillPainter = SubstanceCoreUtilities
          .getFillPainter(slider);
      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(slider);

      SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, currState);
      SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, ColorSchemeAssociationKind.BORDER,
              currState);

      HashMapKey baseKey = SubstanceCoreUtilities.getHashKey(this.size,
          width, baseFillScheme.getDisplayName(), baseBorderScheme
              .getDisplayName(), fillPainter.getDisplayName(),
          borderPainter.getDisplayName());

      Icon baseLayer = SliderRoundIcon.icons.get(baseKey);
      if (baseLayer == null) {
        baseLayer = getSingleLayer(slider, width, delta, fillPainter,
            borderPainter, baseFillScheme, baseBorderScheme);
        SliderRoundIcon.icons.put(baseKey, baseLayer);
      }

      if (currState.isDisabled() || (activeStates.size() == 1))
        return baseLayer;

      BufferedImage result = SubstanceCoreUtilities.getBlankImage(
          baseLayer.getIconWidth(), baseLayer.getIconHeight());
      Graphics2D g2d = result.createGraphics();
      baseLayer.paintIcon(slider, g2d, 0, 0);

      for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
          .entrySet()) {
        ComponentState activeState = activeEntry.getKey();
        if (activeState == currState)
          continue;

        float contribution = activeEntry.getValue().getContribution();
        if (contribution == 0.0f)
          continue;

        SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider, activeState);
        SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider,
                ColorSchemeAssociationKind.BORDER, activeState);

        HashMapKey key = SubstanceCoreUtilities.getHashKey(this.size,
            width, fillScheme.getDisplayName(), borderScheme
                .getDisplayName(),
            fillPainter.getDisplayName(), borderPainter
                .getDisplayName());

        Icon layer = SliderRoundIcon.icons.get(key);
        if (layer == null) {
          layer = getSingleLayer(slider, width, delta, fillPainter,
View Full Code Here

      height = Math.min(height, this.size - 2);
      int delta = (this.size - height) / 2 - 1;

      SubstanceFillPainter fillPainter = SubstanceCoreUtilities
          .getFillPainter(slider);
      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(slider);

      SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, currState);
      SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, ColorSchemeAssociationKind.BORDER,
              currState);

      HashMapKey baseKey = SubstanceCoreUtilities.getHashKey(this.size,
          height, slider.getComponentOrientation(), baseFillScheme
              .getDisplayName(), baseBorderScheme
              .getDisplayName(), fillPainter.getDisplayName(),
          borderPainter.getDisplayName(), this.isMirrorred);

      Icon baseLayer = SliderVerticalIcon.icons.get(baseKey);
      if (baseLayer == null) {
        baseLayer = getSingleLayer(slider, height, delta, fillPainter,
            borderPainter, baseFillScheme, baseBorderScheme);
        SliderVerticalIcon.icons.put(baseKey, baseLayer);
      }

      if (currState.isDisabled() || (activeStates.size() == 1))
        return baseLayer;

      BufferedImage result = SubstanceCoreUtilities.getBlankImage(
          baseLayer.getIconWidth(), baseLayer.getIconHeight());
      Graphics2D g2d = result.createGraphics();
      baseLayer.paintIcon(slider, g2d, 0, 0);

      for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
          .entrySet()) {
        ComponentState activeState = activeEntry.getKey();
        if (activeState == currState)
          continue;

        float contribution = activeEntry.getValue().getContribution();
        if (contribution == 0.0f)
          continue;

        SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider, activeState);
        SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider,
                ColorSchemeAssociationKind.BORDER, activeState);

        HashMapKey key = SubstanceCoreUtilities.getHashKey(this.size,
            height, slider.getComponentOrientation(), fillScheme
                .getDisplayName(), borderScheme
                .getDisplayName(),
            fillPainter.getDisplayName(), borderPainter
                .getDisplayName(), this.isMirrorred);

        Icon layer = SliderVerticalIcon.icons.get(key);
        if (layer == null) {
          layer = getSingleLayer(slider, height, delta, fillPainter,
View Full Code Here

      int deltaBottom = (openSides != null)
          && openSides.contains(Side.BOTTOM) ? 3 : 0;

      GeneralPath contour = null;

      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(button);

      int borderDelta = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(button)) / 2.0);
      finalBackground = SubstanceCoreUtilities.getBlankImage(width,
          height);
      Graphics2D finalGraphics = (Graphics2D) finalBackground
          .getGraphics();
      // finalGraphics.setColor(Color.red);
      // finalGraphics.fillRect(0, 0, width, height);
      finalGraphics.translate(-deltaLeft, -deltaTop);
      if (side != null) {
        switch (side) {
        case TOP:
        case BOTTOM:
          // rotate by 90% for better visuals
          contour = SubstanceOutlineUtilities.getBaseOutline(height
              + deltaTop + deltaBottom, width + deltaLeft
              + deltaRight, radius, null, borderDelta);

          int translateY = height;
          if (SubstanceCoreUtilities.isScrollButton(button)) {
            translateY += (1 + ((side == SubstanceConstants.Side.BOTTOM) ? 1
                : -2));
          }
          AffineTransform at = AffineTransform.getTranslateInstance(
              0, translateY);
          at.rotate(-Math.PI / 2);
          finalGraphics.setTransform(at);

          if (isContentAreaFilled) {
            fillPainter.paintContourBackground(finalGraphics,
                button, height + deltaTop + deltaBottom, width
                    + deltaLeft + deltaRight, contour,
                false, colorScheme, true);
          }
          if (isBorderPainted) {
            borderPainter.paintBorder(finalGraphics, button, height
                + deltaTop + deltaBottom, width + deltaLeft
                + deltaRight, contour, null, borderScheme);
          }
          break;
        case RIGHT:
        case LEFT:
          // arrow in horizontal bar
          contour = SubstanceOutlineUtilities.getBaseOutline(width
              + deltaLeft + deltaRight, height + deltaTop
              + deltaBottom, radius, null, borderDelta);

          if (isContentAreaFilled) {
            fillPainter.paintContourBackground(finalGraphics,
                button, width + deltaLeft + deltaRight, height
                    + deltaTop + deltaBottom, contour,
                false, colorScheme, true);
          }
          if (isBorderPainted) {
            borderPainter.paintBorder(finalGraphics, button, width
                + deltaLeft + deltaRight, height + deltaTop
                + deltaBottom, contour, null, borderScheme);
          }
          break;
        }
      } else {
        contour = SubstanceOutlineUtilities.getBaseOutline(width
            + deltaLeft + deltaRight, height + deltaTop
            + deltaBottom, radius, null, borderDelta);

        fillPainter.paintContourBackground(finalGraphics, button, width
            + deltaLeft + deltaRight, height + deltaTop
            + deltaBottom, contour, false, colorScheme, true);
        if (isBorderPainted) {
          borderPainter.paintBorder(finalGraphics, button, width
              + deltaLeft + deltaRight, height + deltaTop
              + deltaBottom, contour, null, borderScheme);
        }
      }
View Full Code Here

      return;

    Component compForQuerying = (rendererPane != null) ? rendererPane : c;
    SubstanceHighlightPainter highlightPainter = SubstanceCoreUtilities
        .getSkin(compForQuerying).getHighlightPainter();
    SubstanceBorderPainter highlightBorderPainter = SubstanceCoreUtilities
        .getHighlightBorderPainter(compForQuerying);
    Graphics2D g2d = (Graphics2D) g.create(rect.x, rect.y, rect.width,
        rect.height);

    if (openSides == null) {
      openSides = EnumSet.noneOf(Side.class);
    }
    if (rect.width * rect.height < 100000) {
      String openKey = "";
      for (Side oSide : openSides) {
        openKey += oSide.name() + "-";
      }

      HashMapKey key = SubstanceCoreUtilities.getHashKey(highlightPainter
          .getDisplayName(), highlightBorderPainter.getDisplayName(),
          rect.width, rect.height, fillScheme.getDisplayName(),
          borderScheme.getDisplayName(), borderAlpha, openKey);
      BufferedImage result = smallCache.get(key);
      if (result == null) {
        result = createHighlighterImage(c, rect, borderAlpha,
View Full Code Here

        "Office Blue 2007 Outer", new float[] { 0.0f, 0.5f, 1.0f },
        new ColorSchemeSingleColorQuery[] {
            ColorSchemeSingleColorQuery.EXTRALIGHT,
            ColorSchemeSingleColorQuery.DARK,
            ColorSchemeSingleColorQuery.MID });
    SubstanceBorderPainter innerBorderPainter = new DelegateFractionBasedBorderPainter(
        "Office Blue 2007 Inner", outerBorderPainter, new int[] {
            0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF },
        new ColorSchemeTransform() {
          @Override
          public SubstanceColorScheme transform(
View Full Code Here

    Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
        .getStateContributionMap();

    SubstanceFillPainter fillPainter = SubstanceCoreUtilities
        .getFillPainter(this.menuItem);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(this.menuItem);
    ComponentState currState = modelStateInfo.getCurrModelState();

    SubstanceColorScheme baseFillColorScheme = SubstanceColorSchemeUtilities
        .getColorScheme(this.menuItem, ColorSchemeAssociationKind.FILL,
            currState);
    SubstanceColorScheme baseMarkColorScheme = SubstanceColorSchemeUtilities
        .getColorScheme(this.menuItem, ColorSchemeAssociationKind.MARK,
            currState);
    SubstanceColorScheme baseBorderColorScheme = SubstanceColorSchemeUtilities
        .getColorScheme(this.menuItem,
            ColorSchemeAssociationKind.BORDER, currState);
    float visibility = stateTransitionTracker
        .getFacetStrength(ComponentStateFacet.SELECTION);
    boolean isCheckMarkFadingOut = !currState
        .isFacetActive(ComponentStateFacet.SELECTION);

    int fontSize = SubstanceSizeUtils.getComponentFontSize(this.menuItem);
    int checkMarkSize = this.size + 3;

    HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(fontSize,
        checkMarkSize, fillPainter.getDisplayName(), borderPainter
            .getDisplayName(),
        baseFillColorScheme.getDisplayName(), baseMarkColorScheme
            .getDisplayName(), baseBorderColorScheme
            .getDisplayName(), visibility, isCheckMarkFadingOut);
    Icon iconBase = iconMap.get(keyBase);
    if (iconBase == null) {
      iconBase = new ImageIcon(SubstanceImageCreator.getCheckBox(
          this.menuItem, fillPainter, borderPainter, checkMarkSize,
          currState, baseFillColorScheme, baseMarkColorScheme,
          baseBorderColorScheme, visibility, isCheckMarkFadingOut));
      iconMap.put(keyBase, iconBase);
    }
    if (currState.isDisabled() || (activeStates.size() == 1)) {
      return iconBase;
    }

    BufferedImage result = SubstanceCoreUtilities.getBlankImage(iconBase
        .getIconWidth(), iconBase.getIconHeight());
    Graphics2D g2d = result.createGraphics();
    // draw the base layer
    iconBase.paintIcon(this.menuItem, g2d, 0, 0);

    // draw 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();
      if (stateContribution > 0.0f) {
        g2d.setComposite(AlphaComposite.SrcOver
            .derive(stateContribution));
        SubstanceColorScheme fillColorScheme = SubstanceColorSchemeUtilities
            .getColorScheme(this.menuItem,
                ColorSchemeAssociationKind.FILL, activeState);
        SubstanceColorScheme markColorScheme = SubstanceColorSchemeUtilities
            .getColorScheme(this.menuItem,
                ColorSchemeAssociationKind.MARK, activeState);
        SubstanceColorScheme borderColorScheme = SubstanceColorSchemeUtilities
            .getColorScheme(this.menuItem,
                ColorSchemeAssociationKind.BORDER, activeState);

        HashMapKey keyLayer = SubstanceCoreUtilities.getHashKey(
            fontSize, checkMarkSize, fillPainter.getDisplayName(),
            borderPainter.getDisplayName(), fillColorScheme
                .getDisplayName(), markColorScheme
                .getDisplayName(), borderColorScheme
                .getDisplayName(), visibility);
        Icon iconLayer = iconMap.get(keyLayer);
        if (iconLayer == null) {
View Full Code Here

        DecorationAreaType.FOOTER);

    setSelectedTabFadeStart(0.2);
    setSelectedTabFadeEnd(0.9);

    SubstanceBorderPainter outerBorderPainter = new FractionBasedBorderPainter(
        "Magellan Outer", new float[] { 0.0f, 0.5f, 1.0f },
        new ColorSchemeSingleColorQuery[] {
            ColorSchemeSingleColorQuery.ULTRADARK,
            ColorSchemeSingleColorQuery.DARK,
            ColorSchemeSingleColorQuery.DARK });
    SubstanceBorderPainter innerBorderPainter = new DelegateBorderPainter(
        "Magellan Inner", new ClassicBorderPainter(), 0xA0FFFFFF,
        0x60FFFFFF, 0x40FFFFFF, new ColorSchemeTransform() {
          @Override
          public SubstanceColorScheme transform(
              SubstanceColorScheme scheme) {
View Full Code Here

        "Gemini Outer", new float[] { 0.0f, 0.5f, 1.0f },
        new ColorSchemeSingleColorQuery[] {
            ColorSchemeSingleColorQuery.ULTRADARK,
            ColorSchemeSingleColorQuery.ULTRADARK,
            ColorSchemeSingleColorQuery.ULTRADARK });
    SubstanceBorderPainter innerBorderPainter = new DelegateFractionBasedBorderPainter(
        "Gemini Inner", outerBorderPainter, new int[] { 0x60FFFFFF,
            0x40FFFFFF, 0x20FFFFFF }, new ColorSchemeTransform() {
          @Override
          public SubstanceColorScheme transform(
              SubstanceColorScheme scheme) {
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter

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.