public final class WavePatternBuilder extends Object implements AutoCloseable
ComplexStrokePatternFactory#waveBuilder()
Modifier and Type | Method and Description |
---|---|
WavePatternBuilder |
amplitude(double amplitude)
The amplitude or height of the wave.
|
WavePatternBuilder |
angle(double angle)
The angle of the wave pattern in degrees.
|
ComplexStrokePattern |
build()
Build the wave pattern as configured.
|
void |
close() |
WavePatternBuilder |
fillColor(android.graphics.Color color)
Sets the fill color.
|
protected void |
finalize() |
WavePatternBuilder |
fixedLength(double fixedLength)
Set the length of the pattern in pixels.
|
WavePatternBuilder |
lineColor(android.graphics.Color color)
Sets the line color.
|
WavePatternBuilder |
lineWidth(double lineWidth)
Sets the line width.
|
WavePatternBuilder |
relativeLength(double relativeLength)
Set the length of the pattern relative to the length of the entire line, as a value between
0 and 1 . |
WavePatternBuilder |
startAngle(Angle startAngle)
This determines at which point on the sine function the wave begins.
|
public void close()
close
in interface AutoCloseable
@NotNull public ComplexStrokePattern build()
ComplexStrokePattern
.@NotNull public WavePatternBuilder fixedLength(double fixedLength) throws IllegalArgumentException
The length cannot be both fixed and relative, if both methods are used, only the last one affects the result.
If no length is set, a 10 pixel fixed length will be used as default.
fixedLength
- the length in pixels.IllegalArgumentException
- fixedLength must be >=0
.@NotNull public WavePatternBuilder relativeLength(double relativeLength) throws IllegalArgumentException
0
and 1
.
The length cannot be both fixed and relative, if both methods are used, only the last one affects the result.
If no length is set, a 10 pixel fixed length will be used as default.
relativeLength
- a value in [0,1]
.IllegalArgumentException
- relativeLength must be in range [0,1]
.@NotNull public WavePatternBuilder amplitude(double amplitude) throws IllegalArgumentException
amplitude
- The amplitude of the wave. This is a value in pixels, relative to the base line. Defaults to 10
.IllegalArgumentException
- amplitude must be >0
.@NotNull public WavePatternBuilder startAngle(@NotNull Angle startAngle)
0
is on the baseline, 90
is above the baseline at the max amplitude. A startAngle of 180
will result in a wave that starts on the baseline, but first goes to the right of the baseline instead of to the left.
startAngle
- The start angle of the wave, defaults to 0
degrees.@NotNull public WavePatternBuilder angle(double angle) throws IllegalArgumentException
When values greater than 360 degrees are used the pattern keeps going, e.g. an angle of 720 will result in two complete waves.
angle
- The angle of the wave, defaults to 360
degrees.IllegalArgumentException
- angle must be >=0
.@NotNull public WavePatternBuilder lineColor(@NotNull android.graphics.Color color)
color
- the line's color, defaults to black.@NotNull public WavePatternBuilder fillColor(@NotNull android.graphics.Color color)
color
- the fill color, by default there is no fill.@NotNull public WavePatternBuilder lineWidth(double lineWidth) throws IllegalArgumentException
lineWidth
- the line's width, defaults to 1
.IllegalArgumentException
- lineWidth must be >0
.