new SvgImageBuilder()
Creates a SVG Image Builder.
Methods
-
clear()
-
Removes all content (path segments and texts)
Returns:
The current SvgImageBuilder instance
-
lineTo(x, y)
-
Draws a straight line from the cursor position to the specified position
Parameters:
Name Type Description xnumber Horizontal coordinate
ynumber Vertical coordinate
Returns:
The current SvgImageBuilder instance
-
moveTo(x, y)
-
Moves the cursor to the specified position
Parameters:
Name Type Description xnumber Horizontal coordinate
ynumber Vertical coordinate
Returns:
The current SvgImageBuilder instance
-
setDimension(width, height)
-
Sets the image's size
Parameters:
Name Type Description widthnumber Image width in pixel
heightnumber Image height in pixel
Returns:
The current SvgImageBuilder instance
-
setFontColor(r, g, b [, a])
-
Sets all texts font color
Parameters:
Name Type Argument Description rnumber Red component (between 0 and 255)
gnumber Green component (between 0 and 255)
bnumber Blue component (between 0 and 255)
anumber <optional>
Alpha component (between 0 and 1)
Returns:
The current SvgImageBuilder instance
-
setFontFamily(family)
-
Sets texts fonts family
Parameters:
Name Type Description familystring Font family name
Returns:
The current SvgImageBuilder instance
-
setFontSize(size)
-
Sets texts font size
Parameters:
Name Type Description sizenumber Font size
Returns:
The current SvgImageBuilder instance
-
setStrokeColor(r, g, b [, a])
-
Sets the path's stroke color
Parameters:
Name Type Argument Description rnumber Red component (between 0 and 255)
gnumber Green component (between 0 and 255)
bnumber Blue component (between 0 and 255)
anumber <optional>
Alpha component (between 0 and 1)
-
setStrokeWidth(width)
-
Sets the path's stroke width
Parameters:
Name Type Description widthnumber -
textAt(x, y, value [, verticalText])
-
Adds a text at the specified position
Parameters:
Name Type Argument Description xnumber Horizontal coordinate
ynumber Vertical coordinate
valuestring Text content
verticalTextboolean <optional>
If true, text is written vertically (without rotating the letters)
Returns:
The current SvgImageBuilder instance
-
toDataUrl()
-
Returns the built image as a data url.
Returns:
- Type
- string
-
toString()
-
Returns the image as SVG
Returns:
- Type
- string
Olympe SDK