Class ImageWrapperDecorationPainter
- java.lang.Object
-
- org.pushingpixels.radiance.theming.api.painter.decoration.ImageWrapperDecorationPainter
-
- All Implemented Interfaces:
RadianceDecorationPainter
,RadianceTrait
- Direct Known Subclasses:
BrushedMetalDecorationPainter
,MarbleNoiseDecorationPainter
public abstract class ImageWrapperDecorationPainter extends java.lang.Object implements RadianceDecorationPainter
Implementation ofRadianceDecorationPainter
that uses an image source to paint on decoration areas.
-
-
Field Summary
Fields Modifier and Type Field Description protected RadianceDecorationPainter
baseDecorationPainter
The base decoration painter - the colorized image tiles are painted over the painting of this painter.protected java.util.LinkedHashMap<java.lang.String,java.awt.image.BufferedImage>
colorizedTileMap
Map of colorized tiles.protected java.awt.Image
originalTile
Contains the original (not colorized) image of this painter.protected float
textureAlpha
Alpha channel for the texture image (colorized tiles applied on top of thebaseDecorationPainter
painting).
-
Constructor Summary
Constructors Constructor Description ImageWrapperDecorationPainter()
Creates a new image wrapper decoration painter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.image.BufferedImage
getColorizedTile(double scale, RadianceColorScheme scheme)
Returns a colorized image tile.void
paintDecorationArea(java.awt.Graphics2D graphics, java.awt.Component comp, RadianceThemingSlices.DecorationAreaType decorationAreaType, int width, int height, RadianceSkin skin)
Paints the decoration area as a fully filled rectangle.void
paintDecorationArea(java.awt.Graphics2D graphics, java.awt.Component comp, RadianceThemingSlices.DecorationAreaType decorationAreaType, java.awt.Shape contour, RadianceColorScheme colorScheme)
Paints the decoration area as a specified shape.private void
paintExtraBackground(java.awt.Graphics2D graphics, java.awt.Component comp, RadianceThemingSlices.DecorationAreaType decorationAreaType, int width, int height, RadianceSkin skin)
Paints the background of non-title decoration areas.private void
paintTitleBackground(java.awt.Graphics2D graphics, java.awt.Component comp, RadianceThemingSlices.DecorationAreaType decorationAreaType, int width, int height, RadianceSkin skin)
Paints the title background.void
setBaseDecorationPainter(RadianceDecorationPainter baseDecorationPainter)
Sets the base decoration painter.void
setTextureAlpha(float textureAlpha)
Sets the alpha channel for the image texture.private void
tileArea(java.awt.Graphics2D g, java.awt.Component comp, RadianceColorScheme tileScheme, int offsetTextureX, int offsetTextureY, int width, int height)
Tiles the specified area with colorized version of the image tile.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pushingpixels.radiance.theming.api.trait.RadianceTrait
getDisplayName
-
-
-
-
Field Detail
-
originalTile
protected java.awt.Image originalTile
Contains the original (not colorized) image of this painter.
-
baseDecorationPainter
protected RadianceDecorationPainter baseDecorationPainter
The base decoration painter - the colorized image tiles are painted over the painting of this painter. Can benull
.
-
colorizedTileMap
protected java.util.LinkedHashMap<java.lang.String,java.awt.image.BufferedImage> colorizedTileMap
Map of colorized tiles.
-
textureAlpha
protected float textureAlpha
Alpha channel for the texture image (colorized tiles applied on top of thebaseDecorationPainter
painting).
-
-
Method Detail
-
paintDecorationArea
public void paintDecorationArea(java.awt.Graphics2D graphics, java.awt.Component comp, RadianceThemingSlices.DecorationAreaType decorationAreaType, int width, int height, RadianceSkin skin)
Description copied from interface:RadianceDecorationPainter
Paints the decoration area as a fully filled rectangle.- Specified by:
paintDecorationArea
in interfaceRadianceDecorationPainter
- Parameters:
graphics
- Graphics context.comp
- Component.decorationAreaType
- Decoration area type. Must not benull
.width
- Width.height
- Height.skin
- Skin for painting the decoration area.
-
paintTitleBackground
private void paintTitleBackground(java.awt.Graphics2D graphics, java.awt.Component comp, RadianceThemingSlices.DecorationAreaType decorationAreaType, int width, int height, RadianceSkin skin)
Paints the title background.- Parameters:
graphics
- Graphics context.comp
- Component.decorationAreaType
- Decoration area type. Must not benull
.width
- Width.height
- Height.skin
- Skin for painting the title background.
-
paintExtraBackground
private void paintExtraBackground(java.awt.Graphics2D graphics, java.awt.Component comp, RadianceThemingSlices.DecorationAreaType decorationAreaType, int width, int height, RadianceSkin skin)
Paints the background of non-title decoration areas.- Parameters:
graphics
- Graphics context.comp
- Component.decorationAreaType
- Decoration area type. Must not benull
.width
- Width.height
- Height.skin
- Skin for painting the background of non-title decoration areas.
-
paintDecorationArea
public void paintDecorationArea(java.awt.Graphics2D graphics, java.awt.Component comp, RadianceThemingSlices.DecorationAreaType decorationAreaType, java.awt.Shape contour, RadianceColorScheme colorScheme)
Description copied from interface:RadianceDecorationPainter
Paints the decoration area as a specified shape.- Specified by:
paintDecorationArea
in interfaceRadianceDecorationPainter
- Parameters:
graphics
- Graphics context.comp
- Component.decorationAreaType
- Decoration area type. Must not benull
.contour
- Contour to fill.colorScheme
- Color scheme for painting the decoration area.
-
tileArea
private void tileArea(java.awt.Graphics2D g, java.awt.Component comp, RadianceColorScheme tileScheme, int offsetTextureX, int offsetTextureY, int width, int height)
Tiles the specified area with colorized version of the image tile. This is called after thebaseDecorationPainter
has painted the area. This method should respect the currenttextureAlpha
value.- Parameters:
g
- Graphic context.comp
- Component.tileScheme
- Scheme for the tile colorization.offsetTextureX
- X offset for the tiling.offsetTextureY
- Y offset for the tiling.width
- Width of the tiling region.height
- Height of the tiling region.
-
setBaseDecorationPainter
public void setBaseDecorationPainter(RadianceDecorationPainter baseDecorationPainter)
Sets the base decoration painter.- Parameters:
baseDecorationPainter
- Base decoration painter.
-
setTextureAlpha
public void setTextureAlpha(float textureAlpha)
Sets the alpha channel for the image texture.- Parameters:
textureAlpha
- Alpha channel for the image texture.
-
getColorizedTile
protected java.awt.image.BufferedImage getColorizedTile(double scale, RadianceColorScheme scheme)
Returns a colorized image tile.- Parameters:
scheme
- Color scheme for the colorization.- Returns:
- Colorized tile.
-
-