Examples of SubstanceBorderPainter


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

      if (result != null)
        return result;

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

      int borderDelta = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(slider)) / 2.0);
      Shape contour = new Ellipse2D.Float(borderDelta, borderDelta, width
          - 2 * borderDelta - 1, width - 2 * borderDelta - 1);

      BufferedImage stateImage = SubstanceCoreUtilities.getBlankImage(
          sliderIcon.size - 1, sliderIcon.size - 1);
      Graphics2D g2d = stateImage.createGraphics();
      g2d.translate(delta, delta);

      fillPainter.paintContourBackground(g2d, slider, width,
          sliderIcon.size - 1, contour, false, colorScheme,
          colorScheme2, cyclePos, true, colorScheme != colorScheme2);
      // BufferedImage biResult = SubstanceCoreUtilities.getBlankImage(
      // sliderIcon.size - 1, sliderIcon.size - 1);
      // Graphics2D bg2d = (Graphics2D) biResult.getGraphics();
      // // bg2d.setColor(Color.red);
      // // bg2d.drawRect(0, 0, sliderIcon.size-2, sliderIcon.size-2);
      // bg2d.drawImage(stateImage, 0, 0, null);

      int borderThickness = (int) SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(slider));
      Shape contourInner = new Ellipse2D.Float(borderDelta
          + borderThickness, borderDelta + borderThickness, width - 2
          * borderDelta - 2 * borderThickness - 1, width - 2
          * borderDelta - 2 * borderThickness - 1);

      borderPainter.paintBorder(g2d, slider, width, sliderIcon.size - 1,
          contour, contourInner, borderScheme, borderScheme2,
          cyclePos, borderScheme != borderScheme2);
      // bg2d.translate(-delta, -delta);

      result = new ImageIcon(stateImage);
View Full Code Here

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

      if (result != null)
        return result;

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

      int borderDelta = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(slider)) / 2.0);
      Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline(
          height, sliderIcon.size, 2, borderDelta);

      BufferedImage stateImage = SubstanceCoreUtilities.getBlankImage(
          sliderIcon.size - 1, sliderIcon.size - 1);
      Graphics2D g2d = stateImage.createGraphics();
      g2d.translate(delta, 0);

      fillPainter.paintContourBackground(g2d, slider, height,
          sliderIcon.size, contour, false, colorScheme, colorScheme2,
          cyclePos, true, colorScheme != colorScheme2);
      // BufferedImage biResult = SubstanceCoreUtilities.getBlankImage(
      // sliderIcon.size - 1, sliderIcon.size - 1);
      // Graphics2D bg2d = (Graphics2D) biResult.getGraphics();
      // bg2d.translate(delta, 0);
      // bg2d.drawImage(stateImage, 0, 0, null);

      int borderThickness = (int) SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(slider));
      GeneralPath contourInner = SubstanceOutlineUtilities
          .getTriangleButtonOutline(height, sliderIcon.size, 2,
              borderThickness + borderDelta);

      borderPainter.paintBorder(g2d, slider, height, sliderIcon.size - 1,
          contour, contourInner, borderScheme, borderScheme2,
          cyclePos, borderScheme != borderScheme2);
      // bg2d.translate(-delta, 0);

      if (sliderIcon.isMirrorred)
View Full Code Here

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

      }
    }

    SubstanceFillPainter fillPainter = SubstanceCoreUtilities
        .getFillPainter(this.menuItem);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(this.menuItem);
    int fontSize = SubstanceSizeUtils.getComponentFontSize(this.menuItem);

    HashMapKey key = SubstanceCoreUtilities.getHashKey(fontSize, currState
        .name(), prevState.name(), fillPainter.getDisplayName(),
        borderPainter.getDisplayName(), currFillColorScheme
            .getDisplayName(),
        prevFillColorScheme.getDisplayName(), currMarkColorScheme
            .getDisplayName(),
        prevMarkColorScheme.getDisplayName(), currBorderColorScheme
            .getDisplayName(), prevBorderColorScheme
View Full Code Here

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

      // System.out.println(button.getName() + ":" + deltaLeft + ":" +
      // deltaRight + ":" + deltaTop + ":" + deltaBottom);

      GeneralPath contour = null;

      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(button);

      int borderDelta = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(button)) / 2.0);
      BufferedImage 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, colorScheme2, cyclePos,
                true, colorScheme != colorScheme2);
          }
          if (isBorderPainted) {
            borderPainter.paintBorder(finalGraphics, button, height
                + deltaTop + deltaBottom, width + deltaLeft
                + deltaRight, contour, null, borderScheme,
                borderScheme2, cyclePos,
                borderScheme != borderScheme2);
          }
          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, colorScheme2, cyclePos,
                true, colorScheme != colorScheme2);
          }
          if (isBorderPainted) {
            borderPainter.paintBorder(finalGraphics, button, width
                + deltaLeft + deltaRight, height + deltaTop
                + deltaBottom, contour, null, borderScheme,
                borderScheme2, cyclePos,
                borderScheme != borderScheme2);
          }
          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,
            colorScheme2, cyclePos, true,
            colorScheme != colorScheme2);
        if (isBorderPainted) {
          borderPainter.paintBorder(finalGraphics, button, width
              + deltaLeft + deltaRight, height + deltaTop
              + deltaBottom, contour, null, borderScheme,
              borderScheme2, cyclePos,
              borderScheme != borderScheme2);
        }
View Full Code Here

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

      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, currScheme.getDisplayName(),
          prevScheme.getDisplayName(), currBorderScheme
              .getDisplayName(), prevBorderScheme
              .getDisplayName(), cyclePos, borderAlpha, openKey);
      BufferedImage result = smallCache.get(key);
View Full Code Here

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

      int width, int height, int tabPlacement,
      SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme,
      boolean paintOnlyBorder) {
    SubstanceFillPainter fillPainter = SubstanceCoreUtilities
        .getFillPainter(tabPane);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(tabPane);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(tabPane);

    int borderDelta = (int) Math.ceil(2.0 * SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(tabPane)));
    int borderInsets = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(tabPane)) / 2.0);
    int dy = 2 + borderDelta;
    Set<Side> straightSides = EnumSet.of(Side.BOTTOM);

    int cornerRadius = height / 3;
    if (shaper instanceof ClassicButtonShaper) {
      cornerRadius = (int) SubstanceSizeUtils
          .getClassicButtonCornerRadius(SubstanceSizeUtils
              .getComponentFontSize(tabPane));
      if ((tabPlacement == TOP) || (tabPlacement == BOTTOM))
        width -= 1;
      else
        height -= 1;
    }

    GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(width,
        height + dy, cornerRadius, straightSides, borderInsets);

    BufferedImage result = SubstanceCoreUtilities.getBlankImage(width,
        height);
    Graphics2D resGraphics = result.createGraphics();

    if (!paintOnlyBorder) {
      fillPainter.paintContourBackground(resGraphics, tabPane, width,
          height + dy, contour, false, fillScheme, true);
    }

    int borderThickness = (int) SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(tabPane));
    GeneralPath contourInner = borderPainter.isPaintingInnerContour() ? SubstanceOutlineUtilities
        .getBaseOutline(width, height + dy, cornerRadius
            - borderThickness, straightSides, borderThickness
            + borderInsets)
        : null;

    borderPainter.paintBorder(resGraphics, tabPane, width, height + dy,
        contour, contourInner, borderScheme);

    resGraphics.dispose();
    return result;
  }
View Full Code Here

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

      SubstanceConstants.Side side, SubstanceColorScheme colorScheme,
      SubstanceColorScheme borderScheme) {

    SubstanceFillPainter fillPainter = SubstanceCoreUtilities
        .getFillPainter(tabPane);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(tabPane);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(tabPane);
    Component compForBackground = tabPane.getTabComponentAt(tabIndex);
    if (compForBackground == null)
      compForBackground = tabPane.getComponentAt(tabIndex);
    if (compForBackground == null)
      compForBackground = tabPane;
    Color tabColor = compForBackground.getBackground();
    if (isSelected && (tabColor instanceof UIResource)) {
      // special handling of tabs placed in decoration areas
      tabColor = SubstanceColorUtilities
          .getBackgroundFillColor(compForBackground);
    }
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        isSelected, tabPlacement, fillPainter.getDisplayName(),
        borderPainter.getDisplayName(), shaper.getDisplayName(),
        tabPlacement == SwingConstants.BOTTOM, side.name(), colorScheme
            .getDisplayName(), borderScheme.getDisplayName(),
        tabColor);

    SubstanceSkin skin = SubstanceCoreUtilities.getSkin(tabPane);
View Full Code Here

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

        GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(
            width, height, 1, null);
        fillPainter.paintContourBackground(finalGraphics, tabPane,
            width, height, contour, false, fillScheme, true);
        // finalGraphics.drawImage(background, 0, 0, null);
        SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
            .getBorderPainter(tabPane);
        finalGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
        borderPainter.paintBorder(finalGraphics, tabPane, width,
            height, contour, null, markScheme);
      }

      finalGraphics.setStroke(new BasicStroke(SubstanceSizeUtils
          .getTabCloseButtonStrokeWidth(SubstanceSizeUtils
View Full Code Here

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

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

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

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

    int fontSize = SubstanceSizeUtils.getComponentFontSize(button);
    int checkMarkSize = SubstanceSizeUtils.getCheckBoxMarkSize(fontSize);

    HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(fontSize,
        checkMarkSize, fillPainter.getDisplayName(), borderPainter
            .getDisplayName(),
        baseFillColorScheme.getDisplayName(), baseMarkColorScheme
            .getDisplayName(), baseBorderColorScheme
            .getDisplayName(), visibility, isCheckMarkFadingOut);
    Icon iconBase = icons.get(keyBase);
    if (iconBase == null) {
      iconBase = new ImageIcon(SubstanceImageCreator.getCheckBox(button,
          fillPainter, borderPainter, checkMarkSize, currState,
          baseFillColorScheme, baseMarkColorScheme,
          baseBorderColorScheme, visibility, isCheckMarkFadingOut));
      icons.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(button, 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(button,
                ColorSchemeAssociationKind.FILL, activeState);
        SubstanceColorScheme markColorScheme = SubstanceColorSchemeUtilities
            .getColorScheme(button,
                ColorSchemeAssociationKind.MARK, activeState);
        SubstanceColorScheme borderColorScheme = SubstanceColorSchemeUtilities
            .getColorScheme(button,
                ColorSchemeAssociationKind.BORDER, activeState);

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

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

    int fontSize = SubstanceSizeUtils.getComponentFontSize(button);
    int checkMarkSize = SubstanceSizeUtils.getRadioButtonMarkSize(fontSize);

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

    SubstanceColorScheme baseFillColorScheme = SubstanceColorSchemeUtilities
        .getColorScheme(button, ColorSchemeAssociationKind.FILL,
            currState);
    SubstanceColorScheme baseMarkColorScheme = SubstanceColorSchemeUtilities
        .getColorScheme(button, ColorSchemeAssociationKind.MARK,
            currState);
    SubstanceColorScheme baseBorderColorScheme = SubstanceColorSchemeUtilities
        .getColorScheme(button, ColorSchemeAssociationKind.BORDER,
            currState);
    float visibility = stateTransitionTracker
        .getFacetStrength(ComponentStateFacet.SELECTION);

    HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(fontSize,
        checkMarkSize, fillPainter.getDisplayName(), borderPainter
            .getDisplayName(),
        baseFillColorScheme.getDisplayName(), baseMarkColorScheme
            .getDisplayName(), baseBorderColorScheme
            .getDisplayName(), visibility);
    Icon iconBase = icons.get(keyBase);
    if (iconBase == null) {
      iconBase = new ImageIcon(SubstanceImageCreator.getRadioButton(
          button, fillPainter, borderPainter, checkMarkSize,
          currState, 0, baseFillColorScheme, baseMarkColorScheme,
          baseBorderColorScheme, visibility));
      icons.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(button, 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(button,
                ColorSchemeAssociationKind.FILL, activeState);
        SubstanceColorScheme markColorScheme = SubstanceColorSchemeUtilities
            .getColorScheme(button,
                ColorSchemeAssociationKind.MARK, activeState);
        SubstanceColorScheme borderColorScheme = SubstanceColorSchemeUtilities
            .getColorScheme(button,
                ColorSchemeAssociationKind.BORDER, activeState);

        HashMapKey keyLayer = SubstanceCoreUtilities.getHashKey(
            fontSize, checkMarkSize, fillPainter.getDisplayName(),
            borderPainter.getDisplayName(), fillColorScheme
                .getDisplayName(), markColorScheme
                .getDisplayName(), borderColorScheme
                .getDisplayName(), visibility);
        Icon iconLayer = icons.get(keyLayer);
        if (iconLayer == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.