On this page:
beside
stack
overlay
pin
connect
table
switch
concurrent
sequential
animate_  map
beside.top
beside.topline
beside.center
beside.baseline
beside.bottom
stack.center
stack.left
stack.right
overlay.center
overlay.left
overlay.right
overlay.top
overlay.topline
overlay.baseline
overlay.bottom
overlay.left_  top
overlay.left_  topline
overlay.left_  center
overlay.left_  baseline
overlay.left_  bottom
overlay.center_  top
overlay.center_  topline
overlay.center_  center
overlay.center_  baseline
overlay.center_  bottom
overlay.right_  top
overlay.right_  topline
overlay.right_  center
overlay.right_  baseline
overlay.right_  bottom
overlay.top_  left
overlay.top_  center
overlay.top_  right
overlay.topline_  left
overlay.topline_  center
overlay.center_  left
overlay.center_  right
overlay.baseline_  left
overlay.baseline_  center
overlay.baseline_  right
overlay.bottom_  left
overlay.bottom_  center
overlay.bottom_  right
Horiz  Alignment
Horiz  Alignment.left
Horiz  Alignment.center
Horiz  Alignment.right
Vert  Alignment
Vert  Alignment.top
Vert  Alignment.topline
Vert  Alignment.center
Vert  Alignment.baseline
Vert  Alignment.bottom
Duration  Alignment
Duration  Alignment.sustain
Duration  Alignment.pad
Epoch  Alignment
Epoch  Alignment.early
Epoch  Alignment.center
Epoch  Alignment.stretch
Epoch  Alignment.late
Sequential  Join
Sequential  Join.step
Sequential  Join.splice
Overlay  Order
Overlay  Order.front
Overlay  Order.back
Connect  Style
Connect  Style.line
Connect  Style.arrow
Connect  Style.arrows
8.12

4 Pict Combiners🔗ℹ

function

fun beside(

  ~sep: sep :: Real = 0,

  ~vert: vert_align :: VertAlignment = #'center,

  ~order: order :: OverlayOrder = #'front,

  ~duration: duration_align :: DurationAlignment = #'sustain,

  ~epoch: epoch_align :: EpochAlignment = #'center,

  pict :: Pict, ...

) :: Pict

Creates a pict that combines the given picts horizontally with the first pict as leftmost.

If a pict extends horizontally outside its bounding box, then the front-ot-back order of picts can matter for the combined image. The order argument determines the order of each pict added to the right of the combined image.

The picts are first made concurrent via concurrent, passing along duration_align and epoch_align.

If no picts are provided, the result is nothing.

> beside(square(~size: 32), circle(~size: 16))

image

> beside(~vert: #'top, ~sep: 12, square(~size: 32), circle(~size: 16))

image

function

fun stack(

  ~sep: sep :: Real = 0,

  ~horiz: horiz_alig :: HorizAlignment = #'center,

  ~order: order :: OverlayOrder = #'front,

  ~duration: duration_align :: DurationAlignment = #'sustain,

  ~epoch: epoch_align :: EpochAlignment = #'center,

  pict :: Pict, ...

) :: Pict

Creates a pict that combines the given picts vertically with the first pict as topmost.

If a pict extends vertically outside its bounding box, then the front-ot-back order of picts can matter for the combined image. The order argument determines the order of each pict added to the bottom of the combined image.

The picts are first made concurrent via concurrent, passing along duration_align and epoch_align.

If no picts are provided, the result is nothing.

> stack(square(~size: 32), circle(~size: 16))

image

> stack(~horiz: #'right, ~sep: 12, square(~size: 32), circle(~size: 16))

image

function

fun overlay(

  ~horiz: horiz_align :: HorizAlignment = #'center,

  ~vert: vert_align :: VertAlignment = #'center,

  ~order: order :: OverlayOrder = #'front,

  ~duration: duration_align :: DurationAlignment = #'sustain,

  ~epoch: epoch_align :: EpochAlignment = #'center,

  pict :: Pict, ...

) :: Pict

Creates a pict that combines the given picts by overlaying. The order argument determines whether later picts are placed in front of earlier picts or behind them.

The picts are first made concurrent via concurrent, passing along duration_align and epoch_align.

If no picts are provided, the result is nothing.

> overlay(square(~size: 32, ~fill: "lightblue"),

          circle(~size: 16, ~fill: "lightgreen"))

image

> overlay(~horiz: #'right, ~vert: #'bottom, ~order: #'back,

          square(~size: 32),

          circle(~size: 16, ~line: "red"))

image

function

fun pin(

  pict :: Pict,

  ~on: on_pict :: Pict,

  ~at: finder :: Find,

  ~pinhole: pinhole_finder :: Find = Find.left_top(q),

  ~order: order :: OverlayOrder = #'front,

  ~duration: duration_align :: DurationAlignment = #'sustain,

  ~epoch: epoch_align :: EpochAlignment = #'center

) :: Pict

Returns a pict that draws pict in front of or behind on_pict at the location in on_pict determined by finder, where the location determined by pinhole_finder in pict is matched with that location. The resulting pict’s bounding box is the same as on_pict’s.

The picts are first made concurrent via concurrent, passing along duration_align and epoch_align.

> def circ = circle(~size: 16, ~fill: "lightgreen")

> pin(~on: overlay(square(~size: 32, ~fill: "lightblue"), circ),

      ~at: Find.right(circ),

      line(~dx: 10))

image

function

fun connect(

  ~on: on_pict :: Pict,

  from :: Find,

  to :: Find,

  ~style: style :: ConnectStyle = #'line,

  ~line: color :: ConnectMode = #'inherit,

  ~line_width: width :: LineWidth = #'inherit,

  ~order: order :: OverlayOrder = #'front,

  ~arrow_size: arrow_size :: Real = 16,

  ~arrow_solid: solid = #true,

  ~arrow_hidden: hidden = #false,

  ~start_angle: start_angle :: maybe(Real) = #false,

  ~start_pull: start_pull :: maybe(Real) = #false,

  ~end_angle: end_angle :: maybe(Real) = #false,

  ~end_pull: end_pull :: maybe(Real) = #false,

  ~label: label :: maybe(Pict) = #false,

  ~label_dx: label_dx :: Real = 0,

  ~label_dy: label_dy :: Real = 0,

  ~duration: duration_align :: DurationAlignment = #'sustain,

  ~epoch: epoch_align :: EpochAlignment = #'center

) :: Pict

Returns a pict like on_pict, but with a line added to connect from to to.

> def circ = circle(~size: 16, ~fill: "lightgreen")

> def sq = square(~size: 32, ~fill: "lightblue")

> connect(~on: beside(~sep: 32, sq, circ),

          Find.right(sq),

          Find.left(circ),

          ~style: #'arrow,

          ~line: "red",

          ~arrow_size: 8)

image

function

fun table(

  rows :: List.of(List),

  ~horiz: horiz :: HorizAlignment || List.of(HorizAlignment) = #'left,

  ~vert: vert :: VertAlignment || List.of(VertAlignment) = #'topline,

  ~hsep: hsep :: Real || List.of(Real) = 32,

  ~vsep: vsep :: Real || List.of(Real) = 1,

  ~pad: pad :: matching((_ :: Real)

                          || [_ :: Real, _ :: Real]

                          || [_ :: Real, _ :: Real, _ :: Real, _ :: Real])

          = 0,

  ~line: line_c :: maybe(ColorMode) = #false,

  ~line_width: line_width :: LineWidth = #'inherit,

  ~hline: hline :: maybe(ColorMode) = line_c,

  ~hline_width: hline_width :: LineWidth = line_width,

  ~vline: vline :: maybe(ColorMode) = line_c,

  ~vline_width: vline_width :: LineWidth = line_width

) :: Pict

Creates a table pict. For horiz, vert, vsep, and hsep, a value or final list element is repeated as meany times as needed to cover all rows, columns, or positions between them, and extra list elements are ignored.

> def circ = circle(~size: 16, ~fill: "lightgreen")

> def sq = square(~size: 32, ~fill: "lightblue")

> table([[blank(),              text("Square"), text("Circle")],

         [blank(),              sq,             circ],

         [text("rolls"),        blank(),        text("✔")],

         [text("easy to cut"),  text("✔"),      blank()]],

        ~horiz: [#'left, #'center],

        ~vert: #'top,

        ~vline: "black",

        ~pad: 5)

image

function

fun switch(

  ~splice: splice :: maybe(TimeOrder) = #false,

  ~join: join :: SequentialJoin = if splice | #'splice | #'step,

  pict :: Pict, ...

) :: Pict

Creates a pict that has the total duration of the given picts, where the resulting pict switches from one pict at the end of its time box to the next. The result pict’s rendering before its timebox is the same as the first pict, and its rendering after is the same as the last pict.

If no picts are provided, the result is nothing.

function

fun concurrent(

  ~duration: duration_align :: DurationAlignment = #'pad,

  ~epoch: epoch_align :: EpochAlignment = #'center,

  pict :: Pict, ...

) :: List.of(Pict)

Returns a list of picts like the given picts, except that time boxes and epochs of each are extended to match, including the same extent for each epoch in the time box.

If duration_align is #'pad, the time boxes are extended as needed in the “after” direction using Pict.pad. If duration_align is #'sustain, then Pict.sustain is used. Note that the default for duration_align is #'pad, but when concurrent is called by functions like beside, the defult is #'sustain.

The epoch_align argument determines how animations are positioned within an extent when extents are made larger to synchronize with concurrent, non-0 extents.

Any nothing among the picts is preserved in the output list, but it does not otherwise particiapte in making the other picts concurrent.

function

fun sequential(

  ~join: mode :: SequentialJoin = #'step,

  ~duration: duration_align :: DurationAlignment = #'pad,

  ~concurrent: to_concurrent = #true,

  pict :: Pict, ...

) :: List.of(AnimPict)

Returns a list of picts like the given picts, except the time box of each is padded in the “before” direction to sequentialize the picts.

If to_concurrent is true, then after the picts are sequentialized, they are passed to #'concurrent. The duration_align argument is passed along in that case.

Any nothing among the picts is preserved in the output list, but it does not otherwise particiapte in making the other picts sequential.

function

fun animate_map(

  picts :~ List.of(Pict),

  ~combine: combine :: Function.of_arity(1),

  ~duration: duration_align :: DurationAlignment = #'sustain,

  ~epoch: epoch_align :: EpochAlignment = #'center,

  ~non_sustain_combine: non_sustain_combine :: Function.of_arity(1)

                          = combine

) :: Pict

Constructs a pict by lifting an operation on static picts to one on animated picts. The combine function is called as needed on a list of static picts corresponding to the input picts, and it should return a static pict.

The picts are first made concurrent via concurrent, passing along duration_align and epoch_align.

function

fun beside.top(~sep: sep :: Real = 0, pict :: Pict, ...) :: Pict

 

function

fun beside.topline(~sep: sep :: Real = 0, pict :: Pict, ...) :: Pict

 

function

fun beside.center(~sep: sep :: Real = 0, pict :: Pict, ...) :: Pict

 

function

fun beside.baseline(~sep: sep :: Real = 0, pict :: Pict, ...) :: Pict

 

function

fun beside.bottom(~sep: sep :: Real = 0, pict :: Pict, ...) :: Pict

Shorthands for beside with a ~vert argument.

function

fun stack.center(~sep: sep :: Real = 0, pict :: Pict, ...) :: Pict

 

function

fun stack.left(~sep: sep :: Real = 0, pict :: Pict, ...) :: Pict

 

function

fun stack.right(~sep: sep :: Real = 0, pict :: Pict, ...) :: Pict

Shorthands for stack with a ~horiz argument.

function

fun overlay.center(pict :: Pict, ...) :: Pict

 

function

fun overlay.left(pict :: Pict, ...) :: Pict

 

function

fun overlay.right(pict :: Pict, ...) :: Pict

 

function

fun overlay.top(pict :: Pict, ...) :: Pict

 

function

fun overlay.topline(pict :: Pict, ...) :: Pict

 

function

fun overlay.baseline(pict :: Pict, ...) :: Pict

 

function

fun overlay.bottom(pict :: Pict, ...) :: Pict

 

function

fun overlay.left_top(pict :: Pict, ...) :: Pict

 

function

fun overlay.left_topline(pict :: Pict, ...) :: Pict

 

function

fun overlay.left_center(pict :: Pict, ...) :: Pict

 

function

fun overlay.left_baseline(pict :: Pict, ...) :: Pict

 

function

fun overlay.left_bottom(pict :: Pict, ...) :: Pict

 

function

fun overlay.center_top(pict :: Pict, ...) :: Pict

 

function

fun overlay.center_topline(pict :: Pict, ...) :: Pict

 

function

fun overlay.center_center(pict :: Pict, ...) :: Pict

 

function

fun overlay.center_baseline(pict :: Pict, ...) :: Pict

 

function

fun overlay.center_bottom(pict :: Pict, ...) :: Pict

 

function

fun overlay.right_top(pict :: Pict, ...) :: Pict

 

function

fun overlay.right_topline(pict :: Pict, ...) :: Pict

 

function

fun overlay.right_center(pict :: Pict, ...) :: Pict

 

function

fun overlay.right_baseline(pict :: Pict, ...) :: Pict

 

function

fun overlay.right_bottom(pict :: Pict, ...) :: Pict

 

function

fun overlay.top_left(pict :: Pict, ...) :: Pict

 

function

fun overlay.top_center(pict :: Pict, ...) :: Pict

 

function

fun overlay.top_right(pict :: Pict, ...) :: Pict

 

function

fun overlay.topline_left(pict :: Pict, ...) :: Pict

 

function

fun overlay.topline_center(pict :: Pict, ...) :: Pict

 

function

fun overlay.center_left(pict :: Pict, ...) :: Pict

 

function

fun overlay.center_right(pict :: Pict, ...) :: Pict

 

function

fun overlay.baseline_left(pict :: Pict, ...) :: Pict

 

function

fun overlay.baseline_center(pict :: Pict, ...) :: Pict

 

function

fun overlay.baseline_right(pict :: Pict, ...) :: Pict

 

function

fun overlay.bottom(pict :: Pict, ...) :: Pict

 

function

fun overlay.bottom_left(pict :: Pict, ...) :: Pict

 

function

fun overlay.bottom_center(pict :: Pict, ...) :: Pict

 

function

fun overlay.bottom_right(pict :: Pict, ...) :: Pict

Shorthands for overlay at all combinations of ~horiz and ~vert arguments in all orders.

enumeration

enum HorizAlignment:

  left

  center

  right

Options for horizontal alignment.

enumeration

enum VertAlignment:

  top

  topline

  center

  baseline

  bottom

Options for vertical alignment.

enumeration

enum DurationAlignment:

  sustain

  pad

Options for duration alignment.

enumeration

enum EpochAlignment:

  early

  center

  stretch

  late

Options for epoch alignment.

enumeration

enum SequentialJoin:

  step

  splice

Options for sequential joining.

enumeration

enum OverlayOrder:

  front

  back

Options for overlaying.

enumeration

enum ConnectStyle:

  line

  arrow

  arrows

Options for a connect style.