[rust] delete uneeded examples for closed issues

pull/1813/head
joseLuís 3 years ago
parent f388e3d7da
commit 42d0feb265

@ -1,29 +0,0 @@
use libnotcurses_sys::*;
const W: u32 = 32;
const H: u32 = 32;
fn main() {
let nc = NcDirect::new().expect("couldnt create ncdirect");
nc.check_pixel_support()
.expect("failed to check for sixel support");
// create a purple rectangle
let mut buffer = Vec::<u8>::with_capacity(H as usize * W as usize * 4);
#[allow(unused_parens)]
for _byte in (0..={ H * W }) {
buffer.push(190);
buffer.push(20);
buffer.push(80);
buffer.push(255);
}
let vframe1 = NcDirectF::from_bgra(&buffer, H, W * 4, W).expect("couldnt create visual");
let voptions1 = NcVisualOptions::without_plane(0, 0, 0, 0, H, W, NCBLIT_PIXEL, 0, 0);
let v = vframe1.ncdirectf_render(nc, &voptions1)
.expect("failed to render image to sixels");
nc.raster_frame(v, NCALIGN_LEFT).expect("failed to print sixels");
vframe1.ncdirectf_free();
nc.stop().expect("failed to destroy ncdirect context");
println!();
}

@ -1,23 +0,0 @@
use libnotcurses_sys::*;
const W: u32 = 32;
const H: u32 = 32;
fn main() -> NcResult<()> {
let nc = Nc::new()?;
// create a white rectangle
let buffer = vec![255; H as usize * W as usize * 4];
let v = NcVisual::from_rgba(buffer.as_slice(), H, W * 4, W)?;
let vo = NcVisualOptions::without_plane(0, 0, 0, 0, H, W, NCBLIT_PIXEL, 0, 0);
// BUG: render function fails when downsizing
v.resize(H / 2, W / 2)?;
v.render(nc, &vo)?;
rsleep![nc, 1];
v.destroy();
nc.stop()?;
Ok(())
}

@ -1,39 +0,0 @@
use libnotcurses_sys::*;
// BUGFIX DISCOVERINGS so far:
//
// - 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 = 4;
const W: NcDim = 35;
fn main() -> NcResult<()> {
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, 0xFE)?;
let voptions = NcVisualOptions::with_plane(
&mut plane,
NCSCALE_NONE,
0,
0,
0,
0,
0,
0,
NCBLIT_PIXEL,
0,
0,
);
visual.render(nc, &voptions)?;
plane.render()?;
plane.rasterize()?;
sleep![1];
plane.destroy()?;
visual.destroy();
nc.stop()?;
Ok(())
}
Loading…
Cancel
Save