pub struct SymbolCache { /* private fields */ }Expand description
rasters of symbols per (id, width, palette), the least recently used one dropped beyond 256
Implementations§
Source§impl SymbolCache
impl SymbolCache
pub fn new() -> SymbolCache
pub fn is_empty(&self) -> bool
Sourcepub fn get(
&mut self,
g: &mut Gfx<'_>,
id: u32,
sym: &Symbol,
w: i32,
pal: &SymPalette,
) -> Option<Rc<Surface>>
pub fn get( &mut self, g: &mut Gfx<'_>, id: u32, sym: &Symbol, w: i32, pal: &SymPalette, ) -> Option<Rc<Surface>>
the raster of symbol id w px wide in this palette, made on the first call; None for
widths outside 1..=SYM_CACHE_MAX_W
Sourcepub fn draw(
&mut self,
g: &mut Gfx<'_>,
id: u32,
sym: &Symbol,
x: i32,
y: i32,
w: i32,
pal: &SymPalette,
opacity: u32,
)
pub fn draw( &mut self, g: &mut Gfx<'_>, id: u32, sym: &Symbol, x: i32, y: i32, w: i32, pal: &SymPalette, opacity: u32, )
draw symbol id w px wide with its top-left corner at x, y (draw context
coordinates) at opacity 0..255: the cached raster, wider than SYM_CACHE_MAX_W the
vectors (through a raster when translucent)
Trait Implementations§
Auto Trait Implementations§
impl !Send for SymbolCache
impl !Sync for SymbolCache
impl Forget for SymbolCache
impl Freeze for SymbolCache
impl RefUnwindSafe for SymbolCache
impl Unpin for SymbolCache
impl UnsafeUnpin for SymbolCache
impl UnwindSafe for SymbolCache
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