pub enum SpriteSource<'a> {
Bitmap {
bytes: &'a [u8],
format: SpriteFormat,
tint: Color,
},
Shader {
state_hash: u32,
painter: &'a dyn Fn(&mut dyn SurfacePainter),
},
Svg {
source: StrRef<'a>,
is_path_only: bool,
tint: Color,
stroke_width_x10: u8,
},
Arc {
thickness: u8,
start_deg10: u16,
sweep_deg10: u16,
fill_sweep_deg10: u16,
track_color: Color,
fill_color: Color,
},
}Expand description
Sprite 贴图数据源(支持静态/帧池预烘焙位图掩码,或过程化 SDF 精灵贴图)。
Variants§
Bitmap
预烘焙 A4/A8 Alpha 掩码或 Rgb565 位图切片。
Shader
过程化矢量精灵(分配于 ScratchArena,如旋转表针或动态仪表盘层)。
Svg
原生矢量 SVG 文档或单路径 d 字符串(纯 POD,支持软件多核条带并行与 GPU SpriteAtlas HiDPI 跨帧缓存)。
Fields
Arc
原生解析圆弧/圆环 SDF 图元(纯 POD,GPU 端单 Draw Call 片元直算零上传,软件端支持多线程并行光栅)。
Trait Implementations§
Source§impl<'a> Clone for SpriteSource<'a>
impl<'a> Clone for SpriteSource<'a>
impl<'a> Copy for SpriteSource<'a>
Source§impl<'a> Debug for SpriteSource<'a>
impl<'a> Debug for SpriteSource<'a>
impl<'a> Eq for SpriteSource<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SpriteSource<'a>
impl<'a> !Send for SpriteSource<'a>
impl<'a> !Sync for SpriteSource<'a>
impl<'a> !UnwindSafe for SpriteSource<'a>
impl<'a> Forget for SpriteSource<'a>
impl<'a> Freeze for SpriteSource<'a>
impl<'a> Move for SpriteSource<'a>
impl<'a> Unpin for SpriteSource<'a>
impl<'a> UnsafeUnpin for SpriteSource<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。