Skip to main content

CustomPointerIcon

Struct CustomPointerIcon 

Source
pub struct CustomPointerIcon { /* private fields */ }
Expand description

An application-drawn pointer shape: RGBA pixels plus the hotspot, the pixel inside the image that sits exactly on the pointer’s position.

The alpha channel is not premultiplied, which is what both winit and the browser expect of cursor images.

Implementations§

Source§

impl CustomPointerIcon

Source

pub fn new( image: ImageBitmap, hotspot_x: u32, hotspot_y: u32, ) -> Result<CustomPointerIcon, PointerIconError>

Builds a custom pointer icon from image, with its hotspot at (hotspot_x, hotspot_y) pixels from the image’s top-left corner.

Source

pub fn image(&self) -> &ImageBitmap

The icon’s pixels, tightly packed RGBA8 with straight (not premultiplied) alpha.

Source

pub fn hotspot_x(&self) -> u32

The hotspot’s x offset from the image’s left edge, in pixels.

Source

pub fn hotspot_y(&self) -> u32

The hotspot’s y offset from the image’s top edge, in pixels.

Source

pub fn id(&self) -> u64

A stable identity derived from the pixels and the hotspot. Platform backends key their per-window cursor caches on it so an icon that reappears across frames is uploaded to the windowing system once.

Trait Implementations§

Source§

impl Clone for CustomPointerIcon

Source§

fn clone(&self) -> CustomPointerIcon

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CustomPointerIcon

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for CustomPointerIcon

Source§

impl From<CustomPointerIcon> for PointerIcon

Source§

fn from(icon: CustomPointerIcon) -> PointerIcon

Converts to this type from the input type.
Source§

impl Hash for CustomPointerIcon

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CustomPointerIcon

Source§

fn eq(&self, other: &CustomPointerIcon) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CustomPointerIcon

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.