From bbc9f0e595c7752fbf127981c0f8ba5219155ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Tue, 22 Jun 2021 02:16:35 +0200 Subject: [PATCH] [rust] update example --- rust/examples/issue-rgb_packed.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rust/examples/issue-rgb_packed.rs b/rust/examples/issue-rgb_packed.rs index f2b571d12..27948f185 100644 --- a/rust/examples/issue-rgb_packed.rs +++ b/rust/examples/issue-rgb_packed.rs @@ -2,19 +2,19 @@ use libnotcurses_sys::*; // BUGFIX DISCOVERINGS so far: // -// - Height seems to be irrelevant (reference: 32) -// - using the C API only works with Widths: 1-18, 22-34, 43-50 +// - using a Height of 32, it only works with Widths: 1-18, 22-34, 43-50, … +// - using a Height of 4, it only works with Widths: 1-34, 43-50, … -const H: NcDim = 32; +const H: NcDim = 4; const W: NcDim = 35; fn main() -> NcResult<()> { - let mut nc = Nc::new()?; + let mut nc = Nc::without_altscreen()?; let mut plane = NcPlane::new(&mut nc, 0, 0, H, W)?; let buffer_rgb = vec![255; H as usize * W as usize * 3]; - let visual = NcVisual::from_rgb_packed(buffer_rgb.as_slice(), H, W * 3, W, 255)?; + let visual = NcVisual::from_rgb_packed(buffer_rgb.as_slice(), H, W * 3, W, 0xFE)?; let voptions = NcVisualOptions::with_plane( &mut plane, NCSCALE_NONE, @@ -32,7 +32,7 @@ fn main() -> NcResult<()> { plane.render()?; plane.rasterize()?; sleep![1]; - plane.destroy(); + plane.destroy()?; visual.destroy(); nc.stop()?; Ok(())