Struct launchy::DeviceCanvas
source · pub struct DeviceCanvas<Spec: DeviceSpec> { /* private fields */ }
Expand description
A generic Canvas
implementation for all launchpads, that relies on a DeviceSpec
. You as
a user of the library don’t need to access this struct directly. Use the “Canvas” type aliases
that each launchpad module provides, for example launchy::mk2::Canvas
or
launchy::s::Canvas
.
Implementations§
source§impl<Spec: DeviceSpec> DeviceCanvas<Spec>
impl<Spec: DeviceSpec> DeviceCanvas<Spec>
sourcepub fn guess(
callback: impl FnMut(CanvasMessage) + Send + 'static
) -> Result<Self, MidiError>
pub fn guess( callback: impl FnMut(CanvasMessage) + Send + 'static ) -> Result<Self, MidiError>
Create a new canvas by guessing both input and output MIDI connection by their name. If you
need precise control over the specific MIDI connections that will be used, use
[DeviceCanvas::from_ports
] instead // TODO: not implemented yet
pub fn guess_polling() -> Result<(Self, DeviceCanvasPoller), MidiError>
Trait Implementations§
source§impl<Spec: DeviceSpec> Canvas for DeviceCanvas<Spec>
impl<Spec: DeviceSpec> Canvas for DeviceCanvas<Spec>
source§fn bounding_box(&self) -> (u32, u32)
fn bounding_box(&self) -> (u32, u32)
The width and height of the smallest rectangle that still fully encapsulates the shape of
this canvas Read more
source§fn lowest_visible_brightness(&self) -> f32
fn lowest_visible_brightness(&self) -> f32
The lowest visible brightness on this canvas. Used to calibrate brightness across
Launchpads; users of the library probably don’t need to worry about this
source§fn low_level_get(&self, x: u32, y: u32) -> Option<&Color>
fn low_level_get(&self, x: u32, y: u32) -> Option<&Color>
Returns a reference to the currently displayed color at the given position
source§fn low_level_get_pending_mut(&mut self, x: u32, y: u32) -> Option<&mut Color>
fn low_level_get_pending_mut(&mut self, x: u32, y: u32) -> Option<&mut Color>
Returns a mutable reference to the in-buffer/unflushed color at the given position
source§fn low_level_get_pending(&self, x: u32, y: u32) -> Option<&Color>
fn low_level_get_pending(&self, x: u32, y: u32) -> Option<&Color>
Returns a reference to the in-buffer/unflushed color at the given position
source§fn flush(&mut self) -> Result<(), MidiError>
fn flush(&mut self) -> Result<(), MidiError>
Flush the accumulated changes to the underlying device Read more
source§fn get(&self, pad: Pad) -> Option<Color>
fn get(&self, pad: Pad) -> Option<Color>
Returns the currently displayed color at the given position, or None if out of bounds Read more
source§fn get_pending(&self, pad: Pad) -> Option<Color>
fn get_pending(&self, pad: Pad) -> Option<Color>
Returns the buffered/unflushed color at the given position, or None if out of bounds Read more
source§fn set(&mut self, pad: Pad, color: Color) -> Option<()>
fn set(&mut self, pad: Pad, color: Color) -> Option<()>
Sets the color at the given position. Returns None if out of bounds Read more
source§fn iter(&self) -> CanvasIterator ⓘ
fn iter(&self) -> CanvasIterator ⓘ
source§fn toggle(&mut self, pad: Pad, color: Color) -> Option<()>
fn toggle(&mut self, pad: Pad, color: Color) -> Option<()>
Toggles the button at the specified coordinate with the given color. Read more
source§fn clear(&mut self)where
Self: Sized,
fn clear(&mut self)where Self: Sized,
Clear the entire canvas by setting all buttons to black. Read more
source§fn into_padded(self) -> PaddingCanvas<Self>where
Self: Sized,
fn into_padded(self) -> PaddingCanvas<Self>where Self: Sized,
See
PaddingCanvas
for more detailsfn is_valid(&self, pad: Pad) -> bool
source§impl<S: DeviceSpec> Index<Pad> for DeviceCanvas<S>
impl<S: DeviceSpec> Index<Pad> for DeviceCanvas<S>
Auto Trait Implementations§
impl<Spec> !RefUnwindSafe for DeviceCanvas<Spec>
impl<Spec> Send for DeviceCanvas<Spec>where <Spec as DeviceSpec>::Output: Send,
impl<Spec> !Sync for DeviceCanvas<Spec>
impl<Spec> Unpin for DeviceCanvas<Spec>where <Spec as DeviceSpec>::Output: Unpin,
impl<Spec> !UnwindSafe for DeviceCanvas<Spec>
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