pub struct Cursor { /* private fields */ }Expand description
The loaded XCursor theme, held for the whole capture so cursor lookups stay cheap.
The default cursor’s frames are parsed once and kept here because they are consulted on nearly
every frame; the theme handle is retained alongside them so the rarer named cursors (hand1,
text, …) can still be resolved on demand. Everything is sized to the one resolved pixel size.
Implementations§
Source§impl Cursor
impl Cursor
Sourcepub fn load(size_override: i32) -> Cursor
pub fn load(size_override: i32) -> Cursor
Load the theme named by XCURSOR_THEME (default "default") at the requested size.
size_override comes from CaptureSettings.cursor_size (selkies --cursor-size /
XCURSOR_SIZE); a value <= 0 falls back to 24. When the theme’s default icon cannot be
loaded, a 16×16 solid-red placeholder stands in so the caller always has a valid image.
Sourcepub fn get_image(&self, scale: u32, time: Duration) -> Image
pub fn get_image(&self, scale: u32, time: Duration) -> Image
The default cursor’s animation frame for time, at the theme size times scale.
Sourcepub fn get_image_by_name(
&self,
name: &str,
scale: u32,
time: Duration,
) -> Option<Image>
pub fn get_image_by_name( &self, name: &str, scale: u32, time: Duration, ) -> Option<Image>
A named cursor’s animation frame for time, or None when the theme lacks it.
Sourcepub fn get_sprite(&self, name: &str) -> Option<(RgbaImage, u32, u32)>
pub fn get_sprite(&self, name: &str) -> Option<(RgbaImage, u32, u32)>
A named cursor icon as a premultiplied RGBA image plus its hotspot (x, y), ready for
cap_and_encode to size and convert to the straight alpha web clients want. Xcursor
stores premultiplied colour, which is also what the compositing paths (get_image*)
need for blending, so it is carried through unconverted.
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnsafeUnpin for Cursor
impl UnwindSafe for Cursor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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>
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