Difference between revisions of "Exploring Livarot"
Jump to navigation
Jump to search
Line 6: | Line 6: | ||
# Path Simplification | # Path Simplification | ||
# Path Flattening | # Path Flattening | ||
===How's it typically used?=== | |||
# Creating a livarot <code>Path</code> object by using Inkscape’s functions such as <code>Path_for_item</code> or <code>Path_for_pathvector</code>. These functions just store path descriptions inside the <code>Path</code> object. Such as <code>moveTo</code>,<code>lineTo</code>, <code>cubicTo</code>, etc. These are just instructions. | |||
# Calling <code>path->Convert</code> or <code>path->ConvertWithBackData</code>. Given a threshold value, these functions create a polygon that approximates the path descriptions given in step 1. The smaller the threshold value, the better the approximation. This approximation is the fundamental tool of livarot that gives it the ability to do things like path boolean operations. | |||
# Calling <code>path->Fill(shape, ...)</code> . This creates a directed graph structure from the approximated polygon. A directed graph just has points connected by edges. | |||
# Calling <code>shape->ConvertToShape(shape_input, ...)</code>. This function converts the graph created earlier, to a polygon without any self-intersections or duplicate points. It is one of the most important functions of livarot. It also takes a fill rule as the argument. | |||
# Here whatever actual function you wanna perform is called. If you’re tweaking, you would call <code>shape->MakeTweak</code>, if you’re performing outset/inset, you’d call <code>shape->MakeOffset</code>. Similar functions exist for boolean operations. | |||
# Calling <code>shape->ConvertToForme(path)</code>. This converts the shape object back to a path whose SVG description you can grab and put in the XML tree. |
Revision as of 08:01, 23 March 2020
Why is it being used?
- Tweak Tool
- Path Offsetting
- Boolean Operations
- Flowing Text
- Path Simplification
- Path Flattening
How's it typically used?
- Creating a livarot
Path
object by using Inkscape’s functions such asPath_for_item
orPath_for_pathvector
. These functions just store path descriptions inside thePath
object. Such asmoveTo
,lineTo
,cubicTo
, etc. These are just instructions. - Calling
path->Convert
orpath->ConvertWithBackData
. Given a threshold value, these functions create a polygon that approximates the path descriptions given in step 1. The smaller the threshold value, the better the approximation. This approximation is the fundamental tool of livarot that gives it the ability to do things like path boolean operations. - Calling
path->Fill(shape, ...)
. This creates a directed graph structure from the approximated polygon. A directed graph just has points connected by edges. - Calling
shape->ConvertToShape(shape_input, ...)
. This function converts the graph created earlier, to a polygon without any self-intersections or duplicate points. It is one of the most important functions of livarot. It also takes a fill rule as the argument. - Here whatever actual function you wanna perform is called. If you’re tweaking, you would call
shape->MakeTweak
, if you’re performing outset/inset, you’d callshape->MakeOffset
. Similar functions exist for boolean operations. - Calling
shape->ConvertToForme(path)
. This converts the shape object back to a path whose SVG description you can grab and put in the XML tree.