[−][src]Struct launchy::DeviceCanvas
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
impl<Spec: DeviceSpec> DeviceCanvas<Spec>
[src]
pub fn guess(
callback: impl FnMut(CanvasMessage) + Send + 'static
) -> Result<Self, MidiError>
[src]
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>
[src]
Trait Implementations
impl<Spec: DeviceSpec> Canvas for DeviceCanvas<Spec>
[src]
fn bounding_box_width(&self) -> u32
[src]
fn bounding_box_height(&self) -> u32
[src]
fn is_valid(&self, x: u32, y: u32) -> bool
[src]
fn lowest_visible_brightness(&self) -> f32
[src]
fn get_old_unchecked_ref(&self, x: u32, y: u32) -> &Color
[src]
fn get_new_unchecked_mut(&mut self, x: u32, y: u32) -> &mut Color
[src]
fn get_new_unchecked_ref(&self, x: u32, y: u32) -> &Color
[src]
fn flush(&mut self) -> Result<(), MidiError>
[src]
fn get(&self, pad: Pad) -> Option<Color>
[src]
fn get_old_unchecked(&self, x: u32, y: u32) -> Color
[src]
fn get_new_unchecked(&self, x: u32, y: u32) -> Color
[src]
fn set_unchecked(&mut self, x: u32, y: u32, color: Color)
[src]
fn get_ref(&self, pad: Pad) -> Option<&Color>
[src]
fn get_mut(&mut self, pad: Pad) -> Option<&mut Color>
[src]
fn get_new(&self, pad: Pad) -> Option<Color>
[src]
fn at_new(&self, pad: Pad) -> Color
[src]
#[must_use]fn set(&mut self, pad: Pad, color: Color) -> Option<()>
[src]
fn iter(&self) -> CanvasIterator
[src]
fn toggle(&mut self, pad: Pad, color: Color) -> Option<()>
[src]
fn clear(&mut self) where
Self: Sized,
[src]
Self: Sized,
fn into_padded(self) -> PaddingCanvas<Self> where
Self: Sized,
[src]
Self: Sized,
impl<S: DeviceSpec> DrawTarget<Rgb888> for DeviceCanvas<S>
[src]
type Error = ()
Error type to return when a drawing operation fails. Read more
fn draw_pixel(&mut self, pixel: Pixel<Rgb888>) -> Result<(), ()>
[src]
fn size(&self) -> Size
[src]
fn draw_iter<T>(&mut self, item: T) -> Result<(), Self::Error> where
T: IntoIterator<Item = Pixel<C>>,
[src]
T: IntoIterator<Item = Pixel<C>>,
fn clear(&mut self, color: C) -> Result<(), Self::Error>
[src]
fn draw_line(
&mut self,
item: &Styled<Line, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
[src]
&mut self,
item: &Styled<Line, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
fn draw_triangle(
&mut self,
item: &Styled<Triangle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
[src]
&mut self,
item: &Styled<Triangle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
fn draw_rectangle(
&mut self,
item: &Styled<Rectangle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
[src]
&mut self,
item: &Styled<Rectangle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
fn draw_circle(
&mut self,
item: &Styled<Circle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
[src]
&mut self,
item: &Styled<Circle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
fn draw_image<'b, I>(
&mut self,
item: &'a Image<'b, I, C>
) -> Result<(), Self::Error> where
C: PixelColor + From<<C as PixelColor>::Raw>,
I: ImageDimensions,
&'b I: IntoPixelIter<C>,
[src]
&mut self,
item: &'a Image<'b, I, C>
) -> Result<(), Self::Error> where
C: PixelColor + From<<C as PixelColor>::Raw>,
I: ImageDimensions,
&'b I: IntoPixelIter<C>,
impl<S: DeviceSpec> Index<Pad> for DeviceCanvas<S>
[src]
impl<S: DeviceSpec> IndexMut<Pad> for DeviceCanvas<S>
[src]
Auto Trait Implementations
impl<Spec> !RefUnwindSafe for DeviceCanvas<Spec>
impl<Spec> Send for DeviceCanvas<Spec> where
<Spec as DeviceSpec>::Output: Send,
<Spec as DeviceSpec>::Output: Send,
impl<Spec> !Sync for DeviceCanvas<Spec>
impl<Spec> Unpin for DeviceCanvas<Spec> where
<Spec as DeviceSpec>::Output: Unpin,
<Spec as DeviceSpec>::Output: Unpin,
impl<Spec> !UnwindSafe for DeviceCanvas<Spec>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,