public class VectorImageBuilder
extends java.lang.Object
Users can add the paths that compose the image and build the corresponding VectorImage instance. The paths
will be drawn in the order of addition.
| Constructor and Description |
|---|
VectorImageBuilder(float width,
float height)
Creates a new builder for vector images.
|
| Modifier and Type | Method and Description |
|---|---|
VectorImageBuilder |
addGradientPath(Path path,
LinearGradient gradient,
VectorGraphicsPainter.FillType fillType)
Adds the given path with specified gradient and fill type.
|
VectorImageBuilder |
addPath(Path path,
int color,
VectorGraphicsPainter.FillType fillType)
Adds the given path with specified color and fill type.
|
VectorImage |
build()
Creates the vector image from the builder state.
|
public VectorImageBuilder(float width,
float height)
width - the width of the imageheight - the height of the imagejava.lang.IllegalArgumentException - if either width or height is negative or zero.public VectorImageBuilder addPath(Path path, int color, VectorGraphicsPainter.FillType fillType)
The given color value is interpreted as a 32-bit ARGB color, where the high-order byte is the alpha channel and
the remaining bytes contain the red, green and blue channels, respectively. A fully opaque color will have an
alpha of 255, while a fully transparent color will have an alpha of 0. For example, passing the
color 0xff0000ff to this method results in a path with an opaque blue fill.
If the specified color is fully transparent (0x00 for the alpha channel), the path is not added.
path - the path to addcolor - the color to fill the path withfillType - the fill type to useGraphicsContext.OPAQUE,
GraphicsContext.TRANSPARENTpublic VectorImageBuilder addGradientPath(Path path, LinearGradient gradient, VectorGraphicsPainter.FillType fillType)
The colors of the gradient are interpreted as 32-bit ARGB colors, where the high-order byte is the alpha channel
and the remaining bytes contain the red, green and blue channels, respectively. A fully opaque color will have an
alpha of 255, while a fully transparent color will have an alpha of 0. For example, the color
0xff0000ff results in an opaque blue.
path - the path to addgradient - the gradient to fill the path withfillType - the fill type to useGraphicsContext.OPAQUE,
GraphicsContext.TRANSPARENTpublic VectorImage build()