Struct cosmic_text::SwashCache
source · pub struct SwashCache {
pub image_cache: HashMap<CacheKey, Option<SwashImage>, BuildHasherDefault<FxHasher>>,
pub outline_command_cache: HashMap<CacheKey, Option<Vec<Command>>, BuildHasherDefault<FxHasher>>,
/* private fields */
}
Expand description
Cache for rasterizing with the swash scaler
Fields§
§image_cache: HashMap<CacheKey, Option<SwashImage>, BuildHasherDefault<FxHasher>>
§outline_command_cache: HashMap<CacheKey, Option<Vec<Command>>, BuildHasherDefault<FxHasher>>
Implementations§
source§impl SwashCache
impl SwashCache
sourcepub fn get_image_uncached(
&mut self,
font_system: &mut FontSystem,
cache_key: CacheKey,
) -> Option<SwashImage>
pub fn get_image_uncached( &mut self, font_system: &mut FontSystem, cache_key: CacheKey, ) -> Option<SwashImage>
Create a swash Image from a cache key, without caching results
sourcepub fn get_image(
&mut self,
font_system: &mut FontSystem,
cache_key: CacheKey,
) -> &Option<SwashImage>
pub fn get_image( &mut self, font_system: &mut FontSystem, cache_key: CacheKey, ) -> &Option<SwashImage>
Create a swash Image from a cache key, caching results
pub fn get_outline_commands( &mut self, font_system: &mut FontSystem, cache_key: CacheKey, ) -> Option<&[Command]>
sourcepub fn with_pixels<F: FnMut(i32, i32, Color)>(
&mut self,
font_system: &mut FontSystem,
cache_key: CacheKey,
base: Color,
f: F,
)
pub fn with_pixels<F: FnMut(i32, i32, Color)>( &mut self, font_system: &mut FontSystem, cache_key: CacheKey, base: Color, f: F, )
Enumerate pixels in an Image, use with_image
for better performance
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SwashCache
impl RefUnwindSafe for SwashCache
impl Send for SwashCache
impl Sync for SwashCache
impl Unpin for SwashCache
impl UnwindSafe for SwashCache
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> 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