[rust] delete examples for issues #1559 #1699

This commit is contained in:
joseLuís 2021-06-07 20:59:35 +02:00
parent 5d4ee0f294
commit 9bbfd96dd7
2 changed files with 0 additions and 75 deletions

View File

@ -1,38 +0,0 @@
//! https://github.com/dankamongmen/notcurses/issues/1559
use libnotcurses_sys::*;
const WIDTH: u32 = 10;
const HEIGHT: u32 = 10;
fn main() -> NcResult<()> {
let mut nc = Notcurses::new()?;
if !nc.check_pixel_support()? {
return Err(NcError::new_msg("Current terminal doesn't support pixels."));
}
let mut buffer = Vec::<u8>::with_capacity((HEIGHT * WIDTH * 4) as usize);
#[allow(unused_parens)]
for _byte in (0..={ HEIGHT * WIDTH }) {
buffer.push(230);
buffer.push(30);
buffer.push(40);
buffer.push(255);
}
let vframe = NcVisual::from_rgba(buffer.as_slice(), HEIGHT, WIDTH * 4, WIDTH)?;
let voptions =
NcVisualOptions::without_plane(0, 0, 0, 0, 0, 0, NCBLIT_PIXEL, 0, 0);
// vframe.inflate(1)?; // this works
vframe.resize(6, 1)?;
vframe.render(&mut nc, &voptions)?;
rsleep![&mut nc, 2];
vframe.destroy();
nc.stop()?;
Ok(())
}

View File

@ -1,37 +0,0 @@
// https://github.com/dankamongmen/notcurses/issues/1699
// https://github.com/dankamongmen/notcurses/issues/1700
use libnotcurses_sys::*;
const W: u32 = 32;
const H: u32 = 32;
fn main() -> NcResult<()> {
let nc = Notcurses::new()?;
println!("pixel support: {:?}", nc.check_pixel_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 = NcVisual::from_bgra(&buffer, H, W * 4, W)?;
// let vframe1 = NcVisual::from_rgba(&buffer, H, W * 4, W)?;
// let voptions = NcVisualOptions::without_plane(0, 0, 0, 0, H, W, NCBLIT_1x1, 0, 0);
let voptions = NcVisualOptions::without_plane(0, 0, 0, 0, H, W, NCBLIT_PIXEL, 0, 0);
vframe1.render(nc, &voptions)?;
nc.render()?;
sleep![2];
vframe1.destroy();
nc.stop()?;
Ok(())
}