Quartz.Sketch.Protocol protocol (Quartz v0.8.1)

View Source

A protocol that must be implemented by anything you want to draw on a figure.

Quartz defines a number of sketches, but nothing forbids you to add more as long as you implement this protocol on your struct.

Summary

Types

t()

All the types that implement this protocol.

Functions

Return lengths that are part of the sketch. These will usually be anything that can be measured in units of length.

Transform lengths inside an object, given a length-transformation function.

Types

length()

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

t()

@type t() :: term()

All the types that implement this protocol.

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()

bbox_bounds(obj)

@spec bbox_bounds(t()) :: Quartz.Sketch.BBoxBounds.t()

lengths(obj)

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

Return lengths that are part of the sketch. These will usually be anything that can be measured in units of length.

to_svg(obj)

@spec to_svg(t()) :: any()

to_unpositioned_svg(obj)

@spec to_unpositioned_svg(t()) :: any()

transform_lengths(obj, fun)

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

Transform lengths inside an object, given a length-transformation function.

This will be used to solve the constraints on your object, when needed.