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

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


    SubstanceFillPainter fillPainter = SubstanceCoreUtilities
        .getFillPainter(button);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(button);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(button);

    BufferedImage bgImage = getFullAlphaBackground(button, button
        .getModel(), shaper, fillPainter, borderPainter, width, height);
View Full Code Here


    int height = combo.getHeight();
    int y = 0;

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

    BufferedImage bgImage = getFullAlphaBackground(combo, comboModel,
        fillPainter, borderPainter, width, height);
View Full Code Here

      result = SubstanceCoreUtilities.getBlankImage(width, height);
      SimplisticFillPainter.INSTANCE.paintContourBackground(result
          .createGraphics(), scrollBar, width, height, contour,
          false, mainScheme, true);

      SubstanceBorderPainter borderPainter = new SimplisticSoftBorderPainter();
      borderPainter.paintBorder(result.getGraphics(), scrollBar, width,
          height, contour, null, mainBorderScheme);

      SubstanceScrollBarUI.trackHorizontalMap.put(key, result);
    }
    return result;
View Full Code Here

      result = SubstanceCoreUtilities.getBlankImage(height, width);
      SimplisticFillPainter.INSTANCE.paintContourBackground(result
          .createGraphics(), scrollBar, height, width, contour,
          false, mainScheme, true);

      SubstanceBorderPainter borderPainter = new SimplisticSoftBorderPainter();
      borderPainter.paintBorder(result.getGraphics(), scrollBar, height,
          width, contour, null, mainBorderScheme);
      result = SubstanceImageCreator.getRotated(result, 3);

      SubstanceScrollBarUI.trackVerticalMap.put(key, result);
    }
View Full Code Here

      SubstanceColorScheme borderScheme) {
    SubstanceFillPainter painter = SubstanceCoreUtilities
        .getFillPainter(scrollBar);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(scrollBar);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        scheme.getDisplayName(), borderScheme.getDisplayName(), painter
            .getDisplayName(), shaper.getDisplayName(),
        borderPainter.getDisplayName());
    BufferedImage result = SubstanceScrollBarUI.thumbVerticalMap.get(key);
    if (result == null) {
      // System.out.println("Cache miss - computing");
      // System.out.println("New image for vertical thumb");
      float radius = width / 2;
      if (shaper instanceof ClassicButtonShaper)
        radius = SubstanceSizeUtils
            .getClassicButtonCornerRadius(SubstanceSizeUtils
                .getComponentFontSize(scrollBar));

      int borderDelta = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(scrollBar)) / 2.0);
      GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(
          height, width, radius, null, borderDelta);

      result = SubstanceCoreUtilities.getBlankImage(height, width);
      painter.paintContourBackground(result.createGraphics(), scrollBar,
          height, width, contour, false, scheme, true);

      // int borderThickness = (int) SubstanceSizeUtils
      // .getBorderStrokeWidth(SubstanceSizeUtils
      // .getComponentFontSize(scrollBar));
      // GeneralPath contourInner = SubstanceOutlineUtilities
      // .getBaseOutline(height, width, radius, null,
      // borderThickness + borderDelta);
      borderPainter.paintBorder(result.getGraphics(), scrollBar, height,
          width, contour, null, borderScheme);
      result = SubstanceImageCreator.getRotated(result, 3);
      // System.out.println(key);
      SubstanceScrollBarUI.thumbVerticalMap.put(key, result);
    }
View Full Code Here

      SubstanceColorScheme borderScheme) {
    SubstanceFillPainter painter = SubstanceCoreUtilities
        .getFillPainter(scrollBar);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(scrollBar);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        scheme.getDisplayName(), borderScheme.getDisplayName(), painter
            .getDisplayName(), shaper.getDisplayName(),
        borderPainter.getDisplayName());

    float radius = height / 2;
    if (shaper instanceof ClassicButtonShaper)
      radius = SubstanceSizeUtils
          .getClassicButtonCornerRadius(SubstanceSizeUtils
              .getComponentFontSize(scrollBar));
    int borderDelta = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(scrollBar)) / 2.0);
    GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(width,
        height, radius, null, borderDelta);
    BufferedImage opaque = SubstanceScrollBarUI.thumbHorizontalMap.get(key);
    if (opaque == null) {
      // System.out.println("New image for horizontal thumb");

      opaque = SubstanceCoreUtilities.getBlankImage(width, height);
      painter.paintContourBackground(opaque.createGraphics(), scrollBar,
          width, height, contour, false, scheme, true);

      borderPainter.paintBorder(opaque.getGraphics(), scrollBar, width,
          height, contour, null, borderScheme);
      SubstanceScrollBarUI.thumbHorizontalMap.put(key, opaque);
    }

    return opaque;
View Full Code Here

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

    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);

    HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(fontSize,
        checkMarkSize, fillPainter.getDisplayName(), borderPainter
            .getDisplayName(),
        baseFillColorScheme.getDisplayName(), baseMarkColorScheme
            .getDisplayName(), baseBorderColorScheme
            .getDisplayName(), visibility);
    Icon iconBase = iconMap.get(keyBase);
    if (iconBase == null) {
      iconBase = new ImageIcon(SubstanceImageCreator.getRadioButton(
          this.menuItem, fillPainter, borderPainter, checkMarkSize,
          currState, 0, baseFillColorScheme, baseMarkColorScheme,
          baseBorderColorScheme, visibility));
      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

   * @see SubstanceSkin#getBorderPainter()
   * @see SubstanceSkin#getHighlightBorderPainter()
   */
  public static SubstanceBorderPainter getHighlightBorderPainter(
      Component comp) {
    SubstanceBorderPainter result = SubstanceCoreUtilities.getSkin(comp)
        .getHighlightBorderPainter();
    if (result != null)
      return result;
    return getBorderPainter(comp);
  }
View Full Code Here

      SubstanceColorScheme fillColorScheme,
      SubstanceColorScheme borderScheme, int width, int height) {
    Graphics2D g2d = (Graphics2D) graphics.create();

    SubstanceFillPainter fillPainter = ClassicFillPainter.INSTANCE;
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(this.slider);

    int componentFontSize = SubstanceSizeUtils
        .getComponentFontSize(this.slider);
    int borderDelta = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(componentFontSize) / 2.0);
    float radius = SubstanceSizeUtils
        .getClassicButtonCornerRadius(componentFontSize) / 2.0f;
    int borderThickness = (int) SubstanceSizeUtils
        .getBorderStrokeWidth(componentFontSize);

    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        radius, borderDelta, borderThickness, fillColorScheme
            .getDisplayName(), borderScheme.getDisplayName());

    BufferedImage trackImage = trackCache.get(key);
    if (trackImage == null) {
      trackImage = SubstanceCoreUtilities.getBlankImage(width + 1,
          height + 1);
      Graphics2D cacheGraphics = trackImage.createGraphics();

      Shape contour = SubstanceOutlineUtilities.getBaseOutline(width + 1,
          height + 1, radius, null, borderDelta);

      fillPainter.paintContourBackground(cacheGraphics, slider, width,
          height, contour, false, fillColorScheme, false);

      GeneralPath contourInner = SubstanceOutlineUtilities
          .getBaseOutline(width + 1, height + 1, radius
              - borderThickness, null, borderThickness
              + borderDelta);
      borderPainter.paintBorder(cacheGraphics, slider, width + 1,
          height + 1, contour, contourInner, borderScheme);

      trackCache.put(key, trackImage);
      cacheGraphics.dispose();
    }
View Full Code Here

    insets.bottom /= 2;
    insets.right /= 2;

    SubstanceFillPainter fillPainter = SubstanceCoreUtilities
        .getFillPainter(this.slider);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(this.slider);
    float radius = SubstanceSizeUtils
        .getClassicButtonCornerRadius(SubstanceSizeUtils
            .getComponentFontSize(slider)) / 2.0f;
    int borderDelta = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(slider)) / 2.0);

    // fill selected portion
    if (this.slider.isEnabled()) {
      if (this.slider.getOrientation() == SwingConstants.HORIZONTAL) {
        int middleOfThumb = this.thumbRect.x
            + (this.thumbRect.width / 2) - paintRect.x;
        int fillMinX;
        int fillMaxX;

        if (drawInverted) {
          fillMinX = middleOfThumb;
          fillMaxX = width;
        } else {
          fillMinX = 0;
          fillMaxX = middleOfThumb;
        }

        int fillWidth = fillMaxX - fillMinX;
        int fillHeight = height + 1;
        if ((fillWidth > 0) && (fillHeight > 0)) {
          Shape contour = SubstanceOutlineUtilities.getBaseOutline(
              fillWidth, fillHeight, radius, null, borderDelta);
          g2d.translate(fillMinX, 0);
          fillPainter.paintContourBackground(g2d, this.slider,
              fillWidth, fillHeight, contour, false, fillScheme,
              false);
          borderPainter.paintBorder(g2d, this.slider, fillWidth,
              fillHeight, contour, null, borderScheme);
        }
      } else {
        int middleOfThumb = this.thumbRect.y
            + (this.thumbRect.height / 2) - paintRect.y;
        int fillMin;
        int fillMax;

        if (this.drawInverted()) {
          fillMin = 0;
          fillMax = middleOfThumb;
          // fix for issue 368 - inverted vertical sliders
          g2d.translate(width + 2 - middleOfThumb, 0);
        } else {
          fillMin = middleOfThumb;
          fillMax = width + 1;
        }

        int fillWidth = fillMax - fillMin;
        int fillHeight = height + 1;
        if ((fillWidth > 0) && (fillHeight > 0)) {
          Shape contour = SubstanceOutlineUtilities.getBaseOutline(
              fillWidth, fillHeight, radius, null, borderDelta);

          fillPainter.paintContourBackground(g2d, this.slider,
              fillWidth, fillHeight, contour, false, fillScheme,
              false);
          borderPainter.paintBorder(g2d, this.slider, fillWidth,
              fillHeight, contour, null, borderScheme);
        }
      }
    }
    g2d.dispose();
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.