Quartz.Sketch (Quartz v0.8.1)

View Source

Functions to work with objects that implement the Sketch.Protocol.

Summary

Functions

Given a rendered and measured Resvg node, assign measurements to the sketch from the measurements of the node. This is used to assign width, height and depth to text elements and to other elements for which the only way to measure them is to render the,.

Get the baseline of the bounding box of a sketch.

Get the bottom of the bounding box of a sketch.

Get the bounding box bounds of a sketch.

Get the (horizontal) center of the bounding box of a sketch.

Get the height of the bounding box of a sketch.

Get the horizon (vertical center) of the bounding box of a sketch.

Get the left limit of the bounding box of a sketch.

Get the right limit of the bounding box of a sketch.

Get the top of the bounding box of a sketch.

Get the width of the bounding box of a sketch.

Draw a sketch inside a figure.

Get all the lengths in a sketch.

Render an object into SVG.

Render a sketch while setting its position to zero. What exactly means setting the position to zero is implementation-dependent.

Apply a transformation to the sketch's lengths. Which lengths must be transformed is implementation-dependent.

Types

length()

@type length() :: Dantzig.Polynomial.t() | number()

t()

@type t() :: any()

Functions

assign_measurements_from_resvg_node(obj, resvg_node)

@spec assign_measurements_from_resvg_node(t(), %Resvg.Native.Node{
  height: term(),
  id: term(),
  width: term(),
  x: term(),
  y: term()
}) :: t()

Given a rendered and measured Resvg node, assign measurements to the sketch from the measurements of the node. This is used to assign width, height and depth to text elements and to other elements for which the only way to measure them is to render the,.

bbox_baseline(obj)

@spec bbox_baseline(t()) :: length()

Get the baseline of the bounding box of a sketch.

bbox_bottom(obj)

@spec bbox_bottom(t()) :: length()

Get the bottom of the bounding box of a sketch.

bbox_bounds(obj)

@spec bbox_bounds(t()) :: length()

Get the bounding box bounds of a sketch.

bbox_center(obj)

@spec bbox_center(t()) :: length()

Get the (horizontal) center of the bounding box of a sketch.

bbox_height(obj)

@spec bbox_height(t()) :: length()

Get the height of the bounding box of a sketch.

bbox_horizon(obj)

@spec bbox_horizon(t()) :: length()

Get the horizon (vertical center) of the bounding box of a sketch.

bbox_left(obj)

@spec bbox_left(t()) :: length()

Get the left limit of the bounding box of a sketch.

bbox_right(obj)

@spec bbox_right(t()) :: length()

Get the right limit of the bounding box of a sketch.

bbox_top(obj)

@spec bbox_top(t()) :: length()

Get the top of the bounding box of a sketch.

bbox_width(obj)

@spec bbox_width(t()) :: length()

Get the width of the bounding box of a sketch.

draw(obj)

@spec draw(t()) :: t()

Draw a sketch inside a figure.

lengths(obj)

@spec lengths(t()) :: [length()]

Get all the lengths in a sketch.

to_svg(obj)

@spec to_svg(t() | binary()) :: Quartz.SVG.t()

Render an object into SVG.

to_unpositioned_svg(obj)

@spec to_unpositioned_svg(t()) :: Quartz.SVG.t()

Render a sketch while setting its position to zero. What exactly means setting the position to zero is implementation-dependent.

This function is used to get the size (bbox dimensions) of a sketch.

transform_lengths(obj, fun)

@spec transform_lengths(t(), (length() -> length())) :: t()

Apply a transformation to the sketch's lengths. Which lengths must be transformed is implementation-dependent.

This function is used to substitute variables into their values in the lengths (position, size, etc.) of a sketch after solving for all the constraints.