2 Pict Objects
annotation | |
| |
annotation | |
#true
> rectangle() is_a StaticPict
#true
> animate(fun (n): rectangle()) is_a StaticPict
#false
value | |
| |
annotation | |
> beside(stack(~sep: 5, text("Hello"), nothing, nothing, text("World")),
property | |
| |
property | |
| |
property | |
| |
property | |
> explain_bbox(p)
41.0
63.0
16.0
5.0
> explain_bbox(p.pad(-5)).pad(8)
> explain_bbox(text("Hello"))
> explain_bbox(text("Hello").pad(5))
> explain_bbox(text("Hello").pad(~left: 5, ~right: 10))
> explain_bbox(beside(~vert: #'topline,
text("Hello").drop_topline(-3),
text("World")))
> explain_bbox(text("Hello").translate(5, -5))
> p
> p
But default, all drawn elements of pict are rendered together, and then an alpha adjustment is applied to the combined drawing. If composite is #false, then individual elements of pict are drawn with an alpha adjustment. When the two modes produce different output, the default one is normally the intended effect, but drawing with composite as #false can be significantly faster in some cases.
> def p = text("Hello").colorize("firebrick").pad(-5).scale(2)
method | |
| |
| |
method | |
|
~line_width: 2,
~line: #'inherit,
~fill: "lightblue")
> p
> p.colorize("firebrick").line_width(0)
[
]
> stack(h, w)
[
,
]
> Find.top_left(w).in(stack(h, w))
0.0
21.0
If rebuild_prompt is true, then the result pict also has no replaceable dependencies.
See also Pict Findable and Replaceable Identity and Pict.blank.
> Find.top_left(w).in(p)
0.0
21.0
> Find.top_left(w).in(q)
Find.in: cannot find pict
pict: Pict("World", 11392370)
in pict: Pict("stack", "Hello", "World", 11392372)
The do_ghost argument is intended to help avoid if wrappers, enabling pict.ghost(test) instead of if test | pict.ghost() | pict, where the former works even without having to bind an intermediate variable if pict is replaced with a more complex expression.
See also Pict.blank.
> rectangle(~around: p)
square(~size: 20, ~fill: "lightblue"))
> explain_bbox(p).pad(20)
> explain_bbox(p.refocus(h)).pad(20)
method | ||||||||
| ||||||||
| ||||||||
method | ||||||||
|
For most pict constructions, the paragraph-end bounding box will be the same as the pict’s overall bounding box with a zero offset.
Whenever multiple picts are combined using stack or beside, the paragraph-end bounding box of the last pict provided to stack or beside is used for the result pict’s paragraph-end bounds. A beside combination in #'paragraph attach mode will then append relative to that last pict in the composition, instead of to the composition as a whole.
method | |
| |
method | |
Unlike epoch-specific metadata added with Pict.epoch_set_metadata, metadata added by Pict.set_metadata is not propagated to new picts that are derived from the returned pict. The Pict.children property of a pict can be used to search the metadata of its component picts.
property | ||
| ||
class | ||
| ||
| ||
method | ||
| ||
| ||
method | ||
| ||
method | ||
An identity has a description that is used by to_string for a pict, which can be helpful for debugging. A pict’s description is normally synthesized automatically, but it can be configured through Pict.set_description. A description provided to Pict.set_description is most useful as a string, another pict’s identity, a list of such values, or #false to suppress a debugging description.
The Pict.description method is a shorthand for getting the description of pict’s identity.
method | |||
| |||
method | |||
|
property | |
| |
property | |
| |
| |
function | |
|
The StaticPict.draw_handle property returns a Racket pict suitable for drawing directly or embedding in a Racket pict construction. It configures the drawing context with more modern defaults, including drawing in #'smoothed mode.