StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.
| 1 | mod allocator; |
| 2 | mod manager; |
| 3 | |
| 4 | pub(crate) use manager::{Manager, TextureId}; |
| 5 | |
| 6 | use pathfinder_geometry::rect::{RectF, RectI}; |
| 7 | use thiserror::Error; |
| 8 | |
| 9 | /// A region of an atlas that has been allocated. |
| 10 | #[derive(Copy, Debug, Clone)] |
| 11 | pub(crate) struct AllocatedRegion { |
| 12 | /// The region of the atlas that was allocated in UV (texture) coordinates. |
| 13 | pub uv_region: RectF, |
| 14 | /// The region of the atlas that was allocated in screen coordinates. |
| 15 | pub pixel_region: RectI, |
| 16 | } |
| 17 | |
| 18 | /// Error that can happen when attempting to allocate an element into the atlas. |
| 19 | #[derive(Error, Debug)] |
| 20 | pub(crate) enum AllocationError { |
| 21 | /// Texture atlas is full. |
| 22 | #[error("Unable to insert; atlas is full")] |
| 23 | Full, |
| 24 | |
| 25 | /// The item cannot fit within a single texture. |
| 26 | #[error("Unable to insert; item is too large to fit into atlas")] |
| 27 | ItemTooLarge, |
| 28 | } |
| 29 |