Class SubstanceImageCreator
java.lang.Object
org.pushingpixels.substance.internal.utils.SubstanceImageCreator
Provides utility functions for creating various images for Substance
look and feel. This class is for internal use only.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCustom fill painter for filling the checkmarks of checkboxes and radio buttons. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImagegetArrow(float width, float height, float strokeWidth, int direction, SubstanceColorScheme scheme) Retrieves arrow image.static IcongetArrowIcon(float width, float height, float strokeWidth, int direction, SubstanceColorScheme scheme) Retrieves arrow icon.static IcongetArrowIcon(int fontSize, int direction, SubstanceColorScheme colorScheme) Returns arrow icon for the specified parameters.static BufferedImagegetCheckBox(AbstractButton button, SubstanceFillPainter fillPainter, SubstanceBorderPainter borderPainter, int dimension, ComponentState componentState, SubstanceColorScheme fillColorScheme, SubstanceColorScheme markColorScheme, SubstanceColorScheme borderColorScheme, float checkMarkVisibility, boolean isCheckMarkFadingOut) Retrieves check box of the specified size that matches the specified component state.static IcongetCloseIcon(int iSize, SubstanceColorScheme colorScheme, SubstanceColorScheme backgroundScheme) Returnscloseicon.static IcongetCloseIcon(SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnscloseicon.static BufferedImagegetColorSchemeImage(Component comp, Icon original, SubstanceColorScheme colorScheme, float originalBrightnessFactor) Creates a new version of the specified icon that is rendered in the colors of the specified color scheme.static BufferedImagegetColorSchemeImage(BufferedImage original, SubstanceColorScheme colorScheme, float originalBrightnessFactor) Creates a new version of the specified image that is rendered in the colors of the specified color scheme.static ImageRetrieves crayons image for the crayon panel of color chooser.static IcongetDoubleArrowIcon(int fontSize, float width, float height, float strokeWidth, int direction, SubstanceColorScheme colorScheme) Retrieves arrow icon.static IcongetDoubleArrowIconDelta(int fontSize, float deltaWidth, float deltaHeight, float deltaStrokeWidth, int direction, SubstanceColorScheme colorScheme) Returns double arrow icon for the specified parameters.static BufferedImagegetDragImage(Component c, SubstanceColorScheme colorScheme, int width, int height, int maxNumberOfStripes) Returns drag bumps image.static IcongetHexaMarker(int value, SubstanceColorScheme colorScheme) Returns small icon representation of the specified integer value.static IcongetMaximizeIcon(int iSize, SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsmaximizeicon.static IcongetMaximizeIcon(SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsmaximizeicon.static IcongetMinimizeIcon(int iSize, SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsminimizeicon.static IcongetMinimizeIcon(SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsminimizeicon.static BufferedImageReturns the negative of the specified image.static BufferedImagegetRadioButton(JComponent component, SubstanceFillPainter fillPainter, SubstanceBorderPainter borderPainter, int dimension, ComponentState componentState, int offsetX, SubstanceColorScheme fillColorScheme, SubstanceColorScheme markColorScheme, SubstanceColorScheme borderColorScheme, float checkMarkVisibility) Retrieves radio button of the specified size that matches the specified parameters.static BufferedImagegetResizeGripImage(Component c, SubstanceColorScheme colorScheme, int dimension, boolean isCrowded) Returns resize grip image.static IcongetRestoreIcon(SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsrestoreicon.static BufferedImagegetRotated(BufferedImage bi, int quadrantClockwise) Returns rotated image.static VolatileImagegetRotated(VolatileImage bi, int quadrantClockwise) Returns rotated image.static IcongetSearchIcon(int dimension, SubstanceColorScheme colorScheme, boolean leftToRight) Returns search icon.static BufferedImagegetSingleCrayon(Color mainColor, int width, int height) Retrieves a single crayon of the specified color and dimensions for the crayon panel in color chooser.static IcongetSmallLockIcon(SubstanceColorScheme scheme, Component c) Returns a lock icon that matches the specified scheme.static BufferedImageReturns diagonal stripe image.static BufferedImagegetTreeIcon(JTree tree, SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme, boolean isCollapsed) Retrieves tree icon.static IcongetWatermarkIcon(SubstanceWatermark watermark) Returns an icon that matches the specified watermark.static IconmakeTransparent(Component c, Icon icon, double alpha) Makes the specified icon transparent.static voidpaintBorder(Component c, Graphics2D graphics, int x, int y, int width, int height, float radius, SubstanceColorScheme borderScheme) Paints border instance of specified dimensions and status.static voidpaintCompositeRoundedBackground(JComponent component, Graphics g, int width, int height, int cornerRadius, AbstractButton decrButton, AbstractButton incrButton, boolean flipSides) Retrieves composite background for the specified parameters.static voidpaintRectangularBackground(Component c, Graphics g, int startX, int startY, int width, int height, SubstanceColorScheme colorScheme, float borderAlpha, boolean isVertical) Paints rectangular gradient background.static voidpaintRectangularStripedBackground(Component c, Graphics g, int startX, int startY, int width, int height, SubstanceColorScheme colorScheme, BufferedImage stripeImage, int stripeOffset, float borderAlpha, boolean isVertical) Paints rectangular gradient background with spots and optional replicated stripe image.static voidpaintSimpleBorder(Component c, Graphics2D g2d, int width, int height, SubstanceColorScheme borderColorScheme) Paints simple border.static voidpaintSimpleBorderAliased(Component c, Graphics2D g2d, int width, int height, SubstanceColorScheme colorScheme) static voidpaintSplitDividerBumpImage(Graphics g, SubstanceSplitPaneDivider divider, int x, int y, int width, int height, boolean isHorizontal, SubstanceColorScheme colorScheme) Paints the bump dots on the split pane dividers.static voidpaintTextComponentBorder(JComponent c, Graphics graphics, int x, int y, int width, int height, float radius, SubstanceColorScheme borderScheme) Paints border instance of specified dimensions and status.static IcontoGreyscale(Icon icon) Translated the specified icon to grey scale.
-
Constructor Details
-
SubstanceImageCreator
public SubstanceImageCreator()
-
-
Method Details
-
paintBorder
public static void paintBorder(Component c, Graphics2D graphics, int x, int y, int width, int height, float radius, SubstanceColorScheme borderScheme) Paints border instance of specified dimensions and status.- Parameters:
c- Component.graphics- Graphics context.x- Component left X (in graphics context).y- Component top Y (in graphics context).width- Border width.height- Border height.radius- Border radius.borderScheme- border color scheme.
-
paintTextComponentBorder
public static void paintTextComponentBorder(JComponent c, Graphics graphics, int x, int y, int width, int height, float radius, SubstanceColorScheme borderScheme) Paints border instance of specified dimensions and status.- Parameters:
c- Component.graphics- Graphics context.x- Component left X (in graphics context).y- Component top Y (in graphics context).width- Border width.height- Border height.radius- Border radius.borderScheme- Border color scheme.
-
getArrowIcon
Returns arrow icon for the specified parameters.- Parameters:
fontSize- Font size.direction- Arrow direction.colorScheme- Arrow icon color scheme.- Returns:
- Arrow icon.
-
getArrowIcon
public static Icon getArrowIcon(float width, float height, float strokeWidth, int direction, SubstanceColorScheme scheme) Retrieves arrow icon.- Parameters:
width- Arrow width.height- Arrow height.strokeWidth- Stroke width.direction- Arrow direction.scheme- Color scheme for the arrow.- Returns:
- Arrow image.
- See Also:
-
getArrow
public static BufferedImage getArrow(float width, float height, float strokeWidth, int direction, SubstanceColorScheme scheme) Retrieves arrow image.- Parameters:
width- Arrow width.height- Arrow height.strokeWidth- Stroke width.direction- Arrow direction.scheme- Color scheme for the arrow.- Returns:
- Arrow image.
- See Also:
-
getDoubleArrowIconDelta
public static Icon getDoubleArrowIconDelta(int fontSize, float deltaWidth, float deltaHeight, float deltaStrokeWidth, int direction, SubstanceColorScheme colorScheme) Returns double arrow icon for the specified parameters.- Parameters:
fontSize- Font size.deltaWidth- Arrow width delta.deltaHeight- Arrow height delta.deltaStrokeWidth- Arrow stroke width delta.direction- Arrow direction.colorScheme- Color scheme for the arrow.- Returns:
- Double arrow icon.
-
getDoubleArrowIcon
public static Icon getDoubleArrowIcon(int fontSize, float width, float height, float strokeWidth, int direction, SubstanceColorScheme colorScheme) Retrieves arrow icon.- Parameters:
width- Arrow width.height- Arrow height.strokeWidth- Stroke width.direction- Arrow direction.colorScheme- Color scheme for the arrow.- Returns:
- Arrow image.
- See Also:
-
getRotated
Returns rotated image.- Parameters:
bi- Image to rotate.quadrantClockwise- Amount of quadrants to rotate in clockwise directio. The rotation angle is 90 times this value.- Returns:
- Rotated image.
-
getRotated
Returns rotated image.- Parameters:
bi- Image to rotate.quadrantClockwise- Amount of quadrants to rotate in clockwise directio. The rotation angle is 90 times this value.- Returns:
- Rotated image.
-
toGreyscale
Translated the specified icon to grey scale.- Parameters:
icon- Icon.- Returns:
- Greyscale version of the specified icon.
-
makeTransparent
Makes the specified icon transparent.- Parameters:
c- Component.icon- Icon.alpha- The alpha of the resulting image. The closer this value is to 0.0, the more transparent resulting image will be.- Returns:
- Transparent version of the specified icon.
-
getRadioButton
public static BufferedImage getRadioButton(JComponent component, SubstanceFillPainter fillPainter, SubstanceBorderPainter borderPainter, int dimension, ComponentState componentState, int offsetX, SubstanceColorScheme fillColorScheme, SubstanceColorScheme markColorScheme, SubstanceColorScheme borderColorScheme, float checkMarkVisibility) Retrieves radio button of the specified size that matches the specified parameters.- Parameters:
component- Component.dimension- Radio button dimension.componentState- Component state.offsetX- Offset on X axis - should be positive in order to see the entire radio button.fillColorScheme- Color scheme for the inner fill.markColorScheme- Color scheme for the check mark.borderColorScheme- Color scheme for the border.checkMarkVisibility- Check mark visibility in 0.0-1.0 range.- Returns:
- Radio button of the specified size that matches the specified parameters.
-
getCheckBox
public static BufferedImage getCheckBox(AbstractButton button, SubstanceFillPainter fillPainter, SubstanceBorderPainter borderPainter, int dimension, ComponentState componentState, SubstanceColorScheme fillColorScheme, SubstanceColorScheme markColorScheme, SubstanceColorScheme borderColorScheme, float checkMarkVisibility, boolean isCheckMarkFadingOut) Retrieves check box of the specified size that matches the specified component state.- Parameters:
button- Button for the check mark.dimension- Check box size.componentState- Component state.fillColorScheme- Color scheme for the inner fill.markColorScheme- Color scheme for the check mark.borderColorScheme- Color scheme for the border.checkMarkVisibility- Check mark visibility in 0.0-1.0 range.isCheckMarkFadingOut- iftrue, the value ofinterpolationCyclePos10is used as the alpha channel.- Returns:
- Check box of the specified size that matches the specified component state.
-
paintCompositeRoundedBackground
public static void paintCompositeRoundedBackground(JComponent component, Graphics g, int width, int height, int cornerRadius, AbstractButton decrButton, AbstractButton incrButton, boolean flipSides) Retrieves composite background for the specified parameters. The composite background consists of three layers:- Layer that matches the
increasedstate. - Layer that matches the
decreasedstate. - Regular layer with rounded background.
- The left half of the first layer
- The right half of the second layer
- The third layer
- Parameters:
component- Component.width- Image width.height- Image height.cornerRadius- Corner radius.decrButton- Thedecreasebutton.incrButton- Theincreasebutton.flipSides- Iftrue, the drawn halves of the first and the second layers above will be swapped.
- Layer that matches the
-
getMinimizeIcon
public static Icon getMinimizeIcon(SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsminimizeicon.- Parameters:
scheme- Color scheme for the icon.- Returns:
Minimizeicon.
-
getMinimizeIcon
public static Icon getMinimizeIcon(int iSize, SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsminimizeicon.- Parameters:
iSize- Icon dimension.scheme- Color scheme for the icon.- Returns:
Minimizeicon.
-
getRestoreIcon
public static Icon getRestoreIcon(SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsrestoreicon.- Parameters:
scheme- Color scheme for the icon.- Returns:
Restoreicon.
-
getMaximizeIcon
public static Icon getMaximizeIcon(SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsmaximizeicon.- Parameters:
scheme- Color scheme for the icon.- Returns:
Maximizeicon.
-
getMaximizeIcon
public static Icon getMaximizeIcon(int iSize, SubstanceColorScheme scheme, SubstanceColorScheme backgroundScheme) Returnsmaximizeicon.- Parameters:
iSize- Icon dimension.scheme- Color scheme for the icon.- Returns:
Maximizeicon.
-
getCloseIcon
Returnscloseicon.- Parameters:
scheme- Color scheme for the icon.- Returns:
Closeicon.
-
getCloseIcon
public static Icon getCloseIcon(int iSize, SubstanceColorScheme colorScheme, SubstanceColorScheme backgroundScheme) Returnscloseicon.- Parameters:
iSize- Icon dimension.colorScheme- Color scheme for the icon.- Returns:
Closeicon.
-
paintRectangularBackground
public static void paintRectangularBackground(Component c, Graphics g, int startX, int startY, int width, int height, SubstanceColorScheme colorScheme, float borderAlpha, boolean isVertical) Paints rectangular gradient background.- Parameters:
g- Graphic context.startX- Background starting X coord.startY- Background starting Y coord.width- Background width.height- Background height.colorScheme- Color scheme for the background.borderAlpha- Border alpha.isVertical- iftrue, the gradient will be vertical, iffalse, the gradient will be horizontal.
-
paintSimpleBorder
public static void paintSimpleBorder(Component c, Graphics2D g2d, int width, int height, SubstanceColorScheme borderColorScheme) Paints simple border.- Parameters:
g2d- Graphics context.width- Border width.height- Border height.borderColorScheme- Border color scheme.
-
paintSimpleBorderAliased
public static void paintSimpleBorderAliased(Component c, Graphics2D g2d, int width, int height, SubstanceColorScheme colorScheme) -
paintRectangularStripedBackground
public static void paintRectangularStripedBackground(Component c, Graphics g, int startX, int startY, int width, int height, SubstanceColorScheme colorScheme, BufferedImage stripeImage, int stripeOffset, float borderAlpha, boolean isVertical) Paints rectangular gradient background with spots and optional replicated stripe image.- Parameters:
g- Graphics context.startX- X start coordinate.startY- Y start coordinate.width- Background width.height- Background height.colorScheme- Color scheme for the background.stripeImage- Stripe image to replicate.stripeOffset- Offset of the first stripe replication.borderAlpha- Border alpha.isVertical- Indication of horizontal / vertical orientation.
-
getStripe
Returns diagonal stripe image.- Parameters:
baseSize- Stripe base in pixels.color- Stripe color.- Returns:
- Diagonal stripe image.
-
getDragImage
public static BufferedImage getDragImage(Component c, SubstanceColorScheme colorScheme, int width, int height, int maxNumberOfStripes) Returns drag bumps image.- Parameters:
c- Component.colorScheme- Color scheme.width- Drag bumps width.height- Drag bumps height.maxNumberOfStripes- The maximum number of bump stripes (rows or columns).- Returns:
- Drag bumps image.
-
paintSplitDividerBumpImage
public static void paintSplitDividerBumpImage(Graphics g, SubstanceSplitPaneDivider divider, int x, int y, int width, int height, boolean isHorizontal, SubstanceColorScheme colorScheme) Paints the bump dots on the split pane dividers.- Parameters:
g- Graphics context.divider- Split pane divider.x- X coordinate of the bump dots.y- Y coordinate of the bump dots.width- Width of the bump dots area.height- Height of the bump dots area.isHorizontal- Indicates whether the dots are horizontal.colorScheme- First color scheme.
-
getResizeGripImage
public static BufferedImage getResizeGripImage(Component c, SubstanceColorScheme colorScheme, int dimension, boolean isCrowded) Returns resize grip image.- Parameters:
c- Component.colorScheme- Color scheme.dimension- Resize grip width.isCrowded- Indicates whether the grips should be painted closely.- Returns:
- Resize grip image.
-
getTreeIcon
public static BufferedImage getTreeIcon(JTree tree, SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme, boolean isCollapsed) Retrieves tree icon.- Parameters:
tree- Tree.fillScheme- Icon fill color scheme.borderScheme- Icon border color scheme.isCollapsed- Collapsed state.- Returns:
- Tree icon.
-
getSingleCrayon
Retrieves a single crayon of the specified color and dimensions for the crayon panel in color chooser.- Parameters:
mainColor- Crayon main color.width- Crayon width.height- Crayon height.- Returns:
- Crayon image.
-
getCrayonsImage
Retrieves crayons image for the crayon panel of color chooser.- Returns:
- Crayons image.
-
getHexaMarker
Returns small icon representation of the specified integer value. The remainder of dividing the integer by 16 is translated to four circles arranged in 2*2 grid.- Parameters:
value- Integer value to represent.colorScheme- Icon color scheme.- Returns:
- Icon representation of the specified integer value.
-
getSearchIcon
public static Icon getSearchIcon(int dimension, SubstanceColorScheme colorScheme, boolean leftToRight) Returns search icon.- Parameters:
dimension- Icon dimension.colorScheme- Icon color scheme.leftToRight- LTR indication of the resulting icon.- Returns:
- Search icon.
-
getWatermarkIcon
Returns an icon that matches the specified watermark.- Parameters:
watermark- Watermark instance.- Returns:
- Icon that matches the specified watermark.
-
getSmallLockIcon
Returns a lock icon that matches the specified scheme.- Parameters:
scheme- Scheme instance.- Returns:
- Lock icon that matches the specified scheme.
-
getNegated
Returns the negative of the specified image.- Parameters:
bi- Image.- Returns:
- The negative of the specified image.
-
getColorSchemeImage
public static BufferedImage getColorSchemeImage(Component comp, Icon original, SubstanceColorScheme colorScheme, float originalBrightnessFactor) Creates a new version of the specified icon that is rendered in the colors of the specified color scheme.- Parameters:
comp- Component.original- The original icon.colorScheme- Color scheme.- Returns:
- Scheme-based version of the original icon.
-
getColorSchemeImage
public static BufferedImage getColorSchemeImage(BufferedImage original, SubstanceColorScheme colorScheme, float originalBrightnessFactor) Creates a new version of the specified image that is rendered in the colors of the specified color scheme.- Parameters:
original- The original image.colorScheme- Color scheme.- Returns:
- Scheme-based version of the original icon.
-