Expand description
9-Slice scaling math.
left right ┌──→ +x
┊←──── outer ────→┊ │
┊ ┊ ↓
┊ ┊←─ inner ─→┊ ┊ + y
┊ ┊ ┊ ┊
┌──┬───────────┬──┐┈┈┈┈┈┈┈┈ top
│ │ │ │ ↑
├──┼───────────┼──┤┈┈┈┈ │
│ │ │ │ ↑ │
│ │ │ │ inner outer
│ │ │ │ ↓ │
├──┼───────────┼──┤┈┈┈┈ │
│ │ │ │ ↓
└──┴───────────┴──┘┈┈┈┈┈┈ bottom
§References
- Wikipedia: 9-slice scaling
- Unity: 9-slicing Sprites
- CSS Backgrounds and Borders ML3: ¶6 Border Images
§Crate Features
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.
- Valid
Dimensions - Slice dimensions with non-negative & non-NAN dimensions (including borders.)
- Valid
Rect - 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.