GeneralPath contour = null;
// SubstanceGradientPainter painter = new StandardGradientPainter();
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);
painter.paintContourBackground(finalGraphics, button,
height + deltaTop + deltaBottom, width + deltaLeft
+ deltaRight, contour, false, colorScheme,
colorScheme2, cyclePos, true,
colorScheme != colorScheme2);
if (!noBorder) {
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);
painter.paintContourBackground(finalGraphics, button, width
+ deltaLeft + deltaRight, height + deltaTop
+ deltaBottom, contour, false, colorScheme,
colorScheme2, cyclePos, true,
colorScheme != colorScheme2);
if (!noBorder) {
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);
painter.paintContourBackground(finalGraphics, button, width
+ deltaLeft + deltaRight, height + deltaTop
+ deltaBottom, contour, false, colorScheme,
colorScheme2, cyclePos, true,
colorScheme != colorScheme2);
if (!noBorder) {
borderPainter.paintBorder(finalGraphics, button, width
+ deltaLeft + deltaRight, height + deltaTop
+ deltaBottom, contour, null, borderScheme,
borderScheme2, cyclePos,
borderScheme != borderScheme2);
}