Crate nines

Source
Expand description

9-Slice scaling math.

left             right   ┌──→ +x
 ┊←──── outer ────→┊     │
 ┊                 ┊     ↓
 ┊  ┊←─ inner ─→┊  ┊    + y
 ┊  ┊           ┊  ┊
 ┌──┬───────────┬──┐┈┈┈┈┈┈┈┈ top
 │  │           │  │          ↑
 ├──┼───────────┼──┤┈┈┈┈      │
 │  │           │  │   ↑      │
 │  │           │  │ inner  outer
 │  │           │  │   ↓      │
 ├──┼───────────┼──┤┈┈┈┈      │
 │  │           │  │          ↓
 └──┴───────────┴──┘┈┈┈┈┈┈ bottom

§References

§Crate Features

featureOverview
debugEnable extra asserts for debugging nines itself.
unsigned-scalarAllow Scalar to use underflow-prone uNN types.

Structs§

Axises
A { horizontal, vertical } pair.
Dimensions
The dimensions of a nine-square layout. See also ValidDimensions.
Error
A generic nines error. Currently opaque by design.
Layout
Describe a layout to render with. You’ll probably start with a:
Rect
A rectangle. See also ValidRect. Generally not inclusive of the right/bottom edge.
Style
The scaling style of a nine-square layout.
ValidDimensions
Slice dimensions with non-negative & non-NAN dimensions (including borders.)
ValidRect
A rectangle with non-negative & non-NAN dimensions.

Enums§

Scale
How to scale images. Based roughly off of the CSS3 border-image-repeat property values.

Traits§

Scalar
iNN or fNN intrinsics. Opt-in to underflow-prone uNN support via "unsigned-scalars" feature.