[−][src]Crate nines
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
feature | Overview |
---|---|
debug | Enable extra asserts for debugging nines itself. |
unsigned-scalar | Allow 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 |