/** * Returns outline that has a triangle poiting downwards. The top two * corners in the outline are rounded. This function can be used to draw * slider thumbs. * * @param width * Width of some UI component. * @param height * Height of some UI component. * @param radius * Corner radius for the top two corners. * @param insets * Insets to compute the outline. * @return Outline that has a triangle poiting downwards. */ public static GeneralPath getTriangleButtonOutline(int width, int height, float radius, int insets) { return getTriangleButtonOutline(width, height, radius, new Insets( insets, insets, insets, insets)); }
/** * Returns outline that has a triangle poiting downwards. The top two * corners in the outline are rounded. This function can be used to draw * slider thumbs. * * @param width * Width of some UI component. * @param height * Height of some UI component. * @param radius * Corner radius for the top two corners. * @param insets * Insets to compute the outline. * @return Outline that has a triangle poiting downwards. */ public static GeneralPath getTriangleButtonOutline(int width, int height, float radius, int insets) { return getTriangleButtonOutline(width, height, radius, new Insets( insets, insets, insets, insets)); }
private Icon getSingleLayer(JSlider slider, int width, int delta, SubstanceFillPainter fillPainter, SubstanceBorderPainter borderPainter, SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme) { int borderDelta = (int) Math.floor(SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)) / 2.0); Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline( width, this.size - 1, 2, borderDelta); BufferedImage stateImage = SubstanceCoreUtilities.getBlankImage( this.size - 1, this.size - 1); Graphics2D g2d = stateImage.createGraphics(); g2d.translate(delta, 0); fillPainter.paintContourBackground(g2d, slider, width, this.size - 1, contour, false, fillScheme, true); int borderThickness = (int) SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)); GeneralPath contourInner = SubstanceOutlineUtilities .getTriangleButtonOutline(width, this.size - 1, 2, borderThickness + borderDelta); borderPainter.paintBorder(g2d, slider, width, this.size - 1, contour, contourInner, borderScheme); g2d.translate(-delta, 0); if (this.isMirrorred) stateImage = SubstanceImageCreator.getRotated(stateImage, 2); return new ImageIcon(stateImage); }
private Icon getSingleLayer(JSlider slider, int width, int delta, SubstanceFillPainter fillPainter, SubstanceBorderPainter borderPainter, SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme) { int borderDelta = (int) Math.floor(SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)) / 2.0); Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline( width, this.size - 1, 2, borderDelta); BufferedImage stateImage = SubstanceCoreUtilities.getBlankImage( this.size - 1, this.size - 1); Graphics2D g2d = stateImage.createGraphics(); g2d.translate(delta, 0); fillPainter.paintContourBackground(g2d, slider, width, this.size - 1, contour, false, fillScheme, true); int borderThickness = (int) SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)); GeneralPath contourInner = SubstanceOutlineUtilities .getTriangleButtonOutline(width, this.size - 1, 2, borderThickness + borderDelta); borderPainter.paintBorder(g2d, slider, width, this.size - 1, contour, contourInner, borderScheme); g2d.translate(-delta, 0); if (this.isMirrorred) stateImage = SubstanceImageCreator.getRotated(stateImage, 2); return new ImageIcon(stateImage); }
.getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)) / 2.0); Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline( height, this.size, 2, borderDelta); .getComponentFontSize(slider)); GeneralPath contourInner = SubstanceOutlineUtilities .getTriangleButtonOutline(height, this.size, 2, borderThickness + borderDelta);
.getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)) / 2.0); Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline( height, this.size, 2, borderDelta); .getComponentFontSize(slider)); GeneralPath contourInner = SubstanceOutlineUtilities .getTriangleButtonOutline(height, this.size, 2, borderThickness + borderDelta);