public final class IconPatternBuilder extends Object implements AutoCloseable
The icon must be set by calling the icon method before calling build. All other methods are optional.
ComplexStrokePatternFactory#iconBuilder()
Modifier and Type | Method and Description |
---|---|
ComplexStrokePattern |
build()
Build the icon pattern as configured.
|
void |
close() |
protected void |
finalize() |
IconPatternBuilder |
icon(IIcon icon)
Sets the icon to be displayed.
|
IconPatternBuilder |
offset(double offset)
Sets the offset of the icon, relative to the base line, in pixels.
|
IconPatternBuilder |
opacity(double opacity)
The opacity of the icon, determines how transparent an icon will be painted.
|
IconPatternBuilder |
rotateUp(boolean rotateUp)
Indicates if the icon should be flipped when it is turned upside down.
|
IconPatternBuilder |
rotation(Angle rotation)
The rotation angle around the center of the icon's image, specified in degrees.
|
IconPatternBuilder |
scale(double scale)
Sets the factor by which the icon will be scaled.
|
public void close()
close
in interface AutoCloseable
@NotNull public ComplexStrokePattern build() throws IllegalStateException
ComplexStrokePattern
.IllegalStateException
- when the icon has not been set.@NotNull public IconPatternBuilder icon(@NotNull IIcon icon) throws IllegalArgumentException
May not be null
.
icon
- the icon to be displayed.IllegalArgumentException
- icon may not be null
.@NotNull public IconPatternBuilder rotateUp(boolean rotateUp)
Defaults to false.
rotateUp
- Indicates if the icon should be flipped when it is turned upside down.@NotNull public IconPatternBuilder offset(double offset)
Defaults to 0
.
offset
- the offset of the icon.@NotNull public IconPatternBuilder scale(double scale) throws IllegalArgumentException
Defaults to 1
(no scaling).
scale
- the scale factor.IllegalArgumentException
- scale must be >0
.@NotNull public IconPatternBuilder opacity(double opacity) throws IllegalArgumentException
It needs to be specified between 0
and 1
. 0
indicates that the icon is painted completely transparent and 1
indicates that the original opacity of the icon is used.
opacity
- the icon's opacity in the [0,1]
interval, defaults to 1.IllegalArgumentException
- opacity must be in range [0,1]
.@NotNull public IconPatternBuilder rotation(@NotNull Angle rotation)
Rotations are applied in a clock-wise fashion relatively to the direction of the underlying line. When rotateUp
is set to true, the flipping occurs on the already rotated icon. The default is 0
, which implies the icon is not rotated.
rotation
- the rotation, defaults to 0
degrees.