A slope module for building svg images
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sloum eac4729aaf Adds namespace support 2 weeks ago
README.md Adds namespace support 2 weeks ago
main.slo Adds namespace support 2 weeks ago
module.json Adds namespace support 2 weeks ago

README.md

svg-make

A slope module for building svg images.

Procedures

Any procedure that takes an attributes association should have said association be key value pairs of attributes that will be a part of the given element that is being created.

make-root

(svg-make::make-root [view-box-x: number] [view-box-y: number] [width: number] [height: number] [attributes: assoc] [children: list]) ; => string

children should be a list of strings representing shapes or other svg primatives that go inside the base svg element. view-box-x and view-box-y represent the coordinate system size (normally the last two numbers in viewBox). The offset is always 0 0 in this implementation.

make-line

(svg-make::make-line [x1: number] [y1: number] [x2: number] [y2: number] [attributes: assoc]) ; => string

make-polyline

(svg-make::make-polyline [points: string|list] [attributes: assoc]) ; => string

If points is a list, it should be a list of numbers.

polyline-builder

(svg-make::polyline-builder [attributes: assoc]) ; => lambda

The returned lambda has the following signature:

([[number...]]) ; => string|#t

If given no values it will produce a polyline element as a string. Otherwise, it will add the given number(s) to the internal point list. Standard usage would be to store the lambda as a variable and the closure used in its creation will enable it to be used similar to an object for producing a list programatically via values that are not necessarily known at the time that svg-polyline-builder is called.

make-circle

(svg-make::make-circle [x: number] [y: number] [radius: number] [[attributes: assoc]]) ; => string

The x and y values form the center point of the circle.

make-ellipse

(svg-make::make-ellipse [x: number] [y: number] [x-radius: number] [y-radius: number] [[attributes: assoc]]) ; => string

The x and y values form the center point of the ellipsoid with separate radii for x and y given as individual arguments.

make-rect

(svg-make::make-rect [x: number] [y: number] [width: number] [height: number] [[attributes: assoc]]) ; => string

make-clip-path

(svg-make::make-clip-path [id: string] [attributes: assoc] [children: list|string]) ; => string

The id represents an id attribute in the resulting svg's xml so that it can be referenced by other elements. children can be passed as a string (as may be the case for a single child) or as a list of strings.

make-mask

(svg-make::make-mask [id: string] [attributes: assoc] [children: list|string]) ; => string

The id represents an id attribute in the resulting svg's xml so that it can be referenced by other elements. children can be passed as a string (as may be the case for a single child) or as a list of strings.

make-group

(svg-make::make-group [id: string] [attributes: assoc] [children: list|string]) ; => string

The id represents an id attribute in the resulting svg's xml so that it can be referenced by other elements. children can be passed as a string (as may be the case for a single child) or as a list of strings.

hsla-color

(svg-make::hsla-color [hue: number|#f] [saturation: number|#f] [lightness: number|#f] [alpha: number|#f]) ; => string

Any value given as #f will have a random value within the available range for the given value.

rgba-color

(svg-make::rgba-color [red: number|#f] [green: number|#f] [blue: number|#f] [alpha: number|#f]) ; => string

Any value given as #f will have a random value within the available range for the given value.

hex-color

(svg-make::hex-color [red: number|#f] [green: number|#f] [blue: number|#f] [alpha: number|#f]) => string

Any value given as #f will have a random value within the available range for the given value.