pub struct SpriteImage {
pub w: usize,
pub h: usize,
pub pixel_ratio: f64,
pub sdf: bool,
pub content: Option<[f64; 4]>,
pub stretch_x: Option<Vec<(f64, f64)>>,
pub stretch_y: Option<Vec<(f64, f64)>>,
pub cell: Vec<u8>,
}Expand description
A sprite image as MapLibre stores it in its icon atlas: premultiplied RGBA
(premultiplyAlpha, Math.round(c * a / 255)) with 1 px of zero padding.
Fields§
§w: usize§h: usize§pixel_ratio: f64§sdf: bool§content: Option<[f64; 4]>Stretchable image metadata (image px): content box [x1, y1, x2, y2] and stretch ranges, used with icon-text-fit.
stretch_x: Option<Vec<(f64, f64)>>§stretch_y: Option<Vec<(f64, f64)>>§cell: Vec<u8>(w + 2) * (h + 2) * 4 bytes.
Implementations§
Source§impl SpriteImage
impl SpriteImage
Sourcepub fn png_data_uri(&self) -> String
pub fn png_data_uri(&self) -> String
The image as a straight-alpha PNG data URI (unpadded).
Trait Implementations§
Source§impl Clone for SpriteImage
impl Clone for SpriteImage
Auto Trait Implementations§
impl Freeze for SpriteImage
impl RefUnwindSafe for SpriteImage
impl Send for SpriteImage
impl Sync for SpriteImage
impl Unpin for SpriteImage
impl UnsafeUnpin for SpriteImage
impl UnwindSafe for SpriteImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more