pub struct Canvas { /* private fields */ }Expand description
LVGL canvas — a widget backed by a user-supplied pixel buffer.
The caller must keep the buffer alive for the lifetime of the widget.
Buffer size is w * h * bytes_per_pixel(cf).
Initial cut exposes buffer setup, background fill, per-pixel writes,
and the layer init/finish dance that LVGL 9 requires for draw
operations. draw_rect/arc/label wrappers can be added later.
Implementations§
Source§impl Canvas
impl Canvas
Sourcepub fn fill_bg(self, color: Color, opa: u8) -> Self
pub fn fill_bg(self, color: Color, opa: u8) -> Self
Fill the entire canvas with the given colour and opacity.
Sourcepub fn set_pixel(self, x: i32, y: i32, color: Color) -> Self
pub fn set_pixel(self, x: i32, y: i32, color: Color) -> Self
Set a single pixel to the given colour.
Sourcepub fn raw_obj(self) -> *mut lv_obj_t
pub fn raw_obj(self) -> *mut lv_obj_t
Returns the raw lv_obj_t * for low-level canvas operations
(e.g. passing to lv_canvas_init_layer / draw descriptor calls
from other crates).
Sourcepub fn init_layer(self, layer: *mut lv_layer_t) -> Self
pub fn init_layer(self, layer: *mut lv_layer_t) -> Self
Fluent: initialise a draw layer bound to this canvas. Pair with
Canvas::finish_layer around low-level draw operations.
Sourcepub fn finish_layer(self, layer: *mut lv_layer_t) -> Self
pub fn finish_layer(self, layer: *mut lv_layer_t) -> Self
Fluent: flush a draw layer previously opened with
Canvas::init_layer, committing its draw tasks to the canvas.
Source§impl Canvas
impl Canvas
Sourcepub fn set_buffer(self, buf: CanvasBuffer<'_>) -> Self
pub fn set_buffer(self, buf: CanvasBuffer<'_>) -> Self
Safe replacement for the legacy Canvas::buffer — accepts a
typed CanvasBuffer borrowed for at least as long as the canvas
is used.
Trait Implementations§
impl Copy for Canvas
impl Send for Canvas
impl Sync for Canvas
Auto Trait Implementations§
impl Freeze for Canvas
impl RefUnwindSafe for Canvas
impl Unpin for Canvas
impl UnsafeUnpin for Canvas
impl UnwindSafe for Canvas
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EventTarget for Twhere
T: Widget,
impl<T> EventTarget for Twhere
T: Widget,
Source§fn on_fn(self, code: lv_event_code_t, handler: fn(EventCtx<'_>)) -> Self
fn on_fn(self, code: lv_event_code_t, handler: fn(EventCtx<'_>)) -> Self
Source§fn on_clicked(self, handler: fn(EventCtx<'_>)) -> Self
fn on_clicked(self, handler: fn(EventCtx<'_>)) -> Self
Source§fn on_value_change(self, handler: fn(EventCtx<'_>)) -> Self
fn on_value_change(self, handler: fn(EventCtx<'_>)) -> Self
Source§fn on_with<T: Send + Sync + 'static>(
self,
code: lv_event_code_t,
handler: &'static EventHandler<T>,
) -> Self
fn on_with<T: Send + Sync + 'static>( self, code: lv_event_code_t, handler: &'static EventHandler<T>, ) -> Self
InitCell and an EventCtx.Source§fn on_clicked_with<T: Send + Sync + 'static>(
self,
handler: &'static EventHandler<T>,
) -> Self
fn on_clicked_with<T: Send + Sync + 'static>( self, handler: &'static EventHandler<T>, ) -> Self
EventTarget::on_with).Source§fn on_value_change_with<T: Send + Sync + 'static>(
self,
handler: &'static EventHandler<T>,
) -> Self
fn on_value_change_with<T: Send + Sync + 'static>( self, handler: &'static EventHandler<T>, ) -> Self
EventTarget::on_with).Source§impl<T> Layout for Twhere
T: Widget,
impl<T> Layout for Twhere
T: Widget,
Source§fn pos(self, x: i32, y: i32) -> Self
fn pos(self, x: i32, y: i32) -> Self
Source§fn align(self, a: u8, x_ofs: i32, y_ofs: i32) -> Self
fn align(self, a: u8, x_ofs: i32, y_ofs: i32) -> Self
Source§fn add_flag(self, f: u32) -> Self
fn add_flag(self, f: u32) -> Self
LV_OBJ_FLAG_* values).Source§fn remove_flag(self, f: u32) -> Self
fn remove_flag(self, f: u32) -> Self
Source§fn add_state(self, s: u32) -> Self
fn add_state(self, s: u32) -> Self
LV_STATE_CHECKED).Source§fn remove_state(self, s: u32) -> Self
fn remove_state(self, s: u32) -> Self
Source§fn grid_dsc(self, cols: &'static [i32], rows: &'static [i32]) -> Self
fn grid_dsc(self, cols: &'static [i32], rows: &'static [i32]) -> Self
Source§fn grid_cell(
self,
col_align: u32,
col_pos: i32,
col_span: i32,
row_align: u32,
row_pos: i32,
row_span: i32,
) -> Self
fn grid_cell( self, col_align: u32, col_pos: i32, col_span: i32, row_align: u32, row_pos: i32, row_span: i32, ) -> Self
Source§fn flex_flow(self, flow: FlexFlow) -> Self
fn flex_flow(self, flow: FlexFlow) -> Self
Source§fn flex_align(self, main: FlexAlign, cross: FlexAlign, track: FlexAlign) -> Self
fn flex_align(self, main: FlexAlign, cross: FlexAlign, track: FlexAlign) -> Self
lv_obj_set_flex_align.Source§fn layout(self, kind: LayoutKind) -> Self
fn layout(self, kind: LayoutKind) -> Self
Source§fn scroll_to_y(self, y: i32, anim: bool) -> Self
fn scroll_to_y(self, y: i32, anim: bool) -> Self
anim enables animation.Source§fn update_layout(self) -> Self
fn update_layout(self) -> Self
Source§fn content_width(self) -> i32
fn content_width(self) -> i32
Source§fn scroll_bottom(self) -> i32
fn scroll_bottom(self) -> i32
Source§impl<T> Styleable for Twhere
T: Widget,
impl<T> Styleable for Twhere
T: Widget,
Source§fn bg_opa(self, opa: u8) -> Self
fn bg_opa(self, opa: u8) -> Self
Source§fn border_color(self, c: Color) -> Self
fn border_color(self, c: Color) -> Self
Source§fn border_width(self, w: i32) -> Self
fn border_width(self, w: i32) -> Self
Source§fn radius(self, r: i32) -> Self
fn radius(self, r: i32) -> Self
LV_RADIUS_CIRCLE for a pill shape).Source§fn pad_bottom(self, p: i32) -> Self
fn pad_bottom(self, p: i32) -> Self
Source§fn text_color(self, c: Color) -> Self
fn text_color(self, c: Color) -> Self
Source§fn text_font(self, f: *const lv_font_t) -> Self
fn text_font(self, f: *const lv_font_t) -> Self
font_montserrat_32 or font_montserrat_14 for built-ins.Source§fn translate_y(self, v: i32, selector: u32) -> Self
fn translate_y(self, v: i32, selector: u32) -> Self
Source§fn margin_top(self, v: i32, selector: u32) -> Self
fn margin_top(self, v: i32, selector: u32) -> Self
Source§fn margin_bottom(self, v: i32, selector: u32) -> Self
fn margin_bottom(self, v: i32, selector: u32) -> Self
Source§fn margin_left(self, v: i32, selector: u32) -> Self
fn margin_left(self, v: i32, selector: u32) -> Self
Source§fn margin_right(self, v: i32, selector: u32) -> Self
fn margin_right(self, v: i32, selector: u32) -> Self
Source§fn max_height(self, v: i32, selector: u32) -> Self
fn max_height(self, v: i32, selector: u32) -> Self
set_height/content sizing).Source§fn arc_opa(self, opa: u8, selector: u32) -> Self
fn arc_opa(self, opa: u8, selector: u32) -> Self
Source§fn arc_rounded(self, rounded: bool, selector: u32) -> Self
fn arc_rounded(self, rounded: bool, selector: u32) -> Self
Source§fn opa_layered(self, opa: u8, selector: u32) -> Self
fn opa_layered(self, opa: u8, selector: u32) -> Self
Source§fn text_align(self, align: u32, selector: u32) -> Self
fn text_align(self, align: u32, selector: u32) -> Self
TEXT_ALIGN_*) for the given selector.