S.Svg
Utilities for writing (and reading) simple SVGs, for use in debugging and quick visualization.
module Color : sig ... end
Describing colours with which to paint paths and draw text.
val color : ?alpha:float -> Color.color -> Color.t
color ?alpha c
Create a colour with the transparency alpha
(default = 0.8
). Alias to Color.make
.
Declarative construction of artists to be applied to an svg in the order that they are supplied to write
.
text ?size ?color v s
Draw the text s
with the given color
(default Black
) and size
(default 11
) at the position v
.
val paint :
?closed:bool ->
?fill_rule:fill_rule ->
?show_coords:bool ->
?width:float ->
?brush:Color.t ->
?pen:Color.t ->
('cpp, 'ctr) t ->
artist
paint ?closed ?fill_rule ?show_coords ?width ?brush ?pen path
Draw a path
or filled polygon (depending on closed
, which defaults to true
, and fill_rule
(defaults to `NonZero
)). width
and pen
set the thickness and color of the outline respectively, while brush
governs the filling color. Point coordinates will be drawn if a show_coords
is provided, otherwise they will be left off.
subject ?closed ?fill_rule path
paint
subject path(s) with default Clipper2 pen and brush settings.
clip ?fill_rule path
paint
clipping path(s) with default Clipper2 pen and brush settings.
val solution :
?closed:bool ->
?fill_rule:fill_rule ->
?show_coords:bool ->
('cpp, 'ctr) t ->
artist
solution ?closed ?fill_rule ?show_coords path
paint
solution path(s) with default Clipper2 pen and brush settings.
val read : string -> paths
read filename
Read paths from from the svg file at the given path.