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

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


   * @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


  public static void paintBorder(Component c, Graphics2D graphics, int x,
      int y, int width, int height, float radius,
      SubstanceColorScheme borderScheme1,
      SubstanceColorScheme borderScheme2, float cyclePos) {

    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(c);
    graphics.translate(x, y);
    int componentFontSize = SubstanceSizeUtils.getComponentFontSize(c);
    int borderDelta = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(componentFontSize) / 2.0);
    Shape contour = SubstanceOutlineUtilities.getBaseOutline(width, height,
        radius, null, borderDelta);
    int borderThickness = (int) SubstanceSizeUtils
        .getBorderStrokeWidth(componentFontSize);
    GeneralPath contourInner = (c instanceof JTextComponent) ? null
        : SubstanceOutlineUtilities.getBaseOutline(width, height,
            radius - borderThickness, null, borderThickness
                + borderDelta);
    borderPainter.paintBorder(graphics, c, width, height, contour,
        contourInner, borderScheme1, borderScheme2, cyclePos,
        borderScheme1 != borderScheme2);
    graphics.translate(-x, -y);
  }
View Full Code Here

    dotGraphics.setColor(markColor2);
    dotGraphics.fillOval(0, 0, bumpDotDiameter, bumpDotDiameter);

    dotGraphics.setComposite(AlphaComposite.getInstance(
        AlphaComposite.SRC_OVER, 0.4f));
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(divider);
    borderPainter.paintBorder(dotGraphics, divider, width, height,
        new Ellipse2D.Float(0, 0, bumpDotDiameter - 1,
            bumpDotDiameter - 1), null, colorScheme1, colorScheme2,
        interpolationCyclePos, colorScheme1 != colorScheme2);

    graphics.setComposite(TransitionLayout.getAlphaComposite(divider, 0.8f,
View Full Code Here

    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 fontSize = SubstanceSizeUtils.getComponentFontSize(button);
    int checkMarkSize = SubstanceSizeUtils.getCheckBoxMarkSize(fontSize);

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

    // System.out.println(prevState + " -> [" + cyclePos + "] " +
    // currState);
    // System.out.println("\t" + prevBorderColorScheme.getDisplayName()
    // + " -> " + currBorderColorScheme.getDisplayName());

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

      SubstanceColorScheme colorScheme2,
      SubstanceColorScheme borderScheme,
      SubstanceColorScheme borderScheme2, 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, colorScheme, colorScheme2,
          cyclePos, true, colorScheme != colorScheme2);
    }

    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, borderScheme2, cyclePos,
        borderScheme != borderScheme2);

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

      SubstanceColorScheme borderScheme,
      SubstanceColorScheme borderScheme2) {

    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();
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        isSelected, cyclePos, tabPlacement, fillPainter
            .getDisplayName(), borderPainter.getDisplayName(),
        shaper.getDisplayName(), tabPlacement == SwingConstants.BOTTOM,
        side.name(), colorScheme.getDisplayName(), colorScheme2
            .getDisplayName(), borderScheme.getDisplayName(),
        borderScheme2.getDisplayName(), tabColor);
View Full Code Here

            width, height, 1, null);
        fillPainter.paintContourBackground(finalGraphics, tabPane,
            width, height, contour, false, fillScheme, fillScheme2,
            cyclePos, true, fillScheme != fillScheme2);
        // 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, markScheme2,
            cyclePos, markScheme != markScheme2);
      }

      finalGraphics.setStroke(new BasicStroke(SubstanceSizeUtils
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());

    if (!trackCache.containsKey(key)) {
      BufferedImage 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, fillColorScheme,
          0, false, 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,
          borderScheme, 0, false);

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