Class GuiSvgBuilder
java.lang.Object
com.render.api.gui.GuiSvgBuilder
Small fluent helper for assembling SVG markup in code.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classElement-level builder used byelement(String, Consumer). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a root-level attribute.build()Builds the final SVG markup.circle(float cx, float cy, float radius, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a circle element.element(String name, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a generic SVG element.ellipse(float cx, float cy, float radiusX, float radiusY, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends an ellipse element.line(float x1, float y1, float x2, float y2, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a line element.path(String data, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a path element.polygon(String points, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a polygon element.polyline(String points, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a polyline element.Appends raw SVG markup inside the root node.rect(float x, float y, float width, float height, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a rectangle element.size(float width, float height) Sets the root SVG size.toSource()Converts the builder output into aGuiSvgSource.viewBox(float minX, float minY, float width, float height) Sets the root SVG viewBox.
-
Constructor Details
-
GuiSvgBuilder
public GuiSvgBuilder()
-
-
Method Details
-
size
Sets the root SVG size.- Parameters:
width- SVG widthheight- SVG height- Returns:
- this builder
-
viewBox
Sets the root SVG viewBox.- Parameters:
minX- minimum xminY- minimum ywidth- viewBox widthheight- viewBox height- Returns:
- this builder
-
attribute
Adds a root-level attribute.- Parameters:
name- attribute namevalue- attribute value- Returns:
- this builder
-
raw
Appends raw SVG markup inside the root node.- Parameters:
markup- raw child markup- Returns:
- this builder
-
element
Appends a generic SVG element.- Parameters:
name- element nameconsumer- element configuration callback- Returns:
- this builder
-
rect
public GuiSvgBuilder rect(float x, float y, float width, float height, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a rectangle element. -
circle
public GuiSvgBuilder circle(float cx, float cy, float radius, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a circle element. -
ellipse
public GuiSvgBuilder ellipse(float cx, float cy, float radiusX, float radiusY, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends an ellipse element. -
line
public GuiSvgBuilder line(float x1, float y1, float x2, float y2, Consumer<GuiSvgBuilder.ElementBuilder> consumer) Appends a line element. -
path
Appends a path element. -
polygon
Appends a polygon element. -
polyline
Appends a polyline element. -
build
-
toSource
-