[rust] updates against 2.3.4

- remove ncvisual_inflate and add ncvisual_resize_noninterpolative & fix example.
- add notcurses_detected_terminal & ncdirect_detected_terminal.
- take into account new static functions pending to implement:
  ncdirect_light_box, ncdirect_heavy_box, nccells_light_box, nccells_heavy_box, nccells_ascii_box.
- update module info headers notation.
pull/1760/head
joseLuís 3 years ago
parent 160868d9e8
commit 3d830f5e73

@ -85,7 +85,7 @@ fn main() -> NcResult<()> {
// inflate the ncvisual (doesn't use interpolation) // inflate the ncvisual (doesn't use interpolation)
let voptions4 = let voptions4 =
NcVisualOptions::without_plane(7, 33, 0, 0, pg.cell_y, pg.cell_x, NCBLIT_PIXEL, 0, 0); NcVisualOptions::without_plane(7, 33, 0, 0, pg.cell_y, pg.cell_x, NCBLIT_PIXEL, 0, 0);
v1.inflate(4)?; v1.resize_noninterpolative(pg.cell_y * 4, pg.cell_x * 4)?;
v1.render(&mut nc, &voptions4)?; v1.render(&mut nc, &voptions4)?;
rsleep![&mut nc, 1]; rsleep![&mut nc, 1];

@ -157,6 +157,7 @@ pub use ffi::{
ncdirect_cursor_right, ncdirect_cursor_right,
ncdirect_cursor_up, ncdirect_cursor_up,
ncdirect_cursor_yx, ncdirect_cursor_yx,
ncdirect_detected_terminal,
ncdirect_dim_x, ncdirect_dim_x,
ncdirect_dim_y, ncdirect_dim_y,
ncdirect_double_box, ncdirect_double_box,
@ -717,11 +718,11 @@ pub use ffi::{
ncvisual_from_file, ncvisual_from_file,
ncvisual_from_plane, ncvisual_from_plane,
ncvisual_from_rgba, ncvisual_from_rgba,
ncvisual_inflate,
ncvisual_media_defblitter, ncvisual_media_defblitter,
ncvisual_polyfill_yx, ncvisual_polyfill_yx,
ncvisual_render, ncvisual_render,
ncvisual_resize, ncvisual_resize,
ncvisual_resize_noninterpolative,
ncvisual_rotate, ncvisual_rotate,
ncvisual_set_yx, ncvisual_set_yx,
ncvisual_simple_streamer, ncvisual_simple_streamer,
@ -768,6 +769,7 @@ pub use ffi::{
notcurses_cursor_yx, notcurses_cursor_yx,
notcurses_debug, notcurses_debug,
notcurses_debug_caps, notcurses_debug_caps,
notcurses_detected_terminal,
notcurses_drop_planes, notcurses_drop_planes,
notcurses_getc, notcurses_getc,
notcurses_init, notcurses_init,

@ -13,7 +13,7 @@
//W nccell_duplicate //W nccell_duplicate
//W nccell_release //W nccell_release
// //
// functions manually reimplemented: 43 // functions manually reimplemented: 46
// ------------------------------------------ // ------------------------------------------
// (X) wont: 2 // (X) wont: 2
// (+) done: 38 // (+) done: 38
@ -61,6 +61,9 @@
//W+ nccell_wide_left_p //W+ nccell_wide_left_p
//W+ nccell_wide_right_p //W+ nccell_wide_right_p
//W+ nccellcmp //W+ nccellcmp
// nccells_ascii_box
// nccells_heavy_box
// nccells_light_box
//W+ nccells_load_box //W+ nccells_load_box
#[cfg(test)] #[cfg(test)]

@ -444,6 +444,13 @@ impl NcDirect {
let x = unsafe { crate::ncdirect_dim_x(self) as NcDim }; let x = unsafe { crate::ncdirect_dim_x(self) as NcDim };
(y, x) (y, x)
} }
/// Returns the name of the detected terminal.
///
/// *C style function: [ncdirect_detected_terminal()][crate::ncdirect_detected_terminal].*
pub fn detected_terminal(&self) -> String {
rstring![crate::ncdirect_detected_terminal(self)].to_string()
}
} }
/// ## NcDirect methods: I/O /// ## NcDirect methods: I/O

@ -1,15 +1,15 @@
//! `NcDirect` //! `NcDirect`
// total: 50 // total: 53
// --------------------------------------------------- // ---------------------------------------------------
// (X) 1 : wont do // (X) 1 : wont do
// (~) 3 : TODO / WIP
// //
// (f) 45 : unsafe ffi function exported by bindgen // (f) 45 : unsafe ffi function exported by bindgen
// (w) 0 : safely wrapped ffi function // (w) 0 : safely wrapped ffi function
// (r) 4 : static function manually reimplemented // (r) 4 : static function manually reimplemented
// //
// (m) 45 : method implemented // (m) 45 : method implemented
// (~) 1 : work in progress
// //
// (t) 0 : unit test done for the function // (t) 0 : unit test done for the function
// (T) 0 : unit test done also for the method // (T) 0 : unit test done also for the method
@ -22,7 +22,7 @@
// fm ncdirect_canutf8 // fm ncdirect_canutf8
// fm ncdirect_check_pixel_support // fm ncdirect_check_pixel_support
// fm ncdirect_clear // fm ncdirect_clear
// f~ ncdirect_core_init //~f ncdirect_core_init
// fm ncdirect_cursor_disable // fm ncdirect_cursor_disable
// fm ncdirect_cursor_down // fm ncdirect_cursor_down
// fm ncdirect_cursor_enable // fm ncdirect_cursor_enable
@ -33,6 +33,7 @@
// fm ncdirect_cursor_right // fm ncdirect_cursor_right
// fm ncdirect_cursor_up // fm ncdirect_cursor_up
// fm ncdirect_cursor_yx // fm ncdirect_cursor_yx
// ncdirect_detected_terminal
// fm ncdirect_dim_x // fm ncdirect_dim_x
// fm ncdirect_dim_y // fm ncdirect_dim_y
// fm ncdirect_double_box // fm ncdirect_double_box
@ -41,9 +42,11 @@
// fm ncdirect_fg_rgb // fm ncdirect_fg_rgb
// fm ncdirect_flush // fm ncdirect_flush
// fm ncdirect_getc // fm ncdirect_getc
//~r ncdirect_heavy_box,
// fm ncdirect_hline_interp // fm ncdirect_hline_interp
// fm ncdirect_init // fm ncdirect_init
// fm ncdirect_inputready_fd // fm ncdirect_inputready_fd
//~r ncdirect_light_box,
// fm ncplane_on_styles // fm ncplane_on_styles
// fm ncplane_off_styles // fm ncplane_off_styles
// fm ncdirect_palette_size // fm ncdirect_palette_size

@ -311,6 +311,13 @@ impl Notcurses {
} }
} }
/// Returns the name of the detected terminal.
///
/// *C style function: [notcurses_detected_terminal()][crate::notcurses_detected_terminal].*
pub fn detected_terminal(&self) -> String {
rstring![crate::notcurses_detected_terminal(self)].to_string()
}
/// Destroys all [NcPlane]s other than the stdplane. /// Destroys all [NcPlane]s other than the stdplane.
/// ///
/// *C style function: [notcurses_drop_planes()][crate::notcurses_drop_planes].* /// *C style function: [notcurses_drop_planes()][crate::notcurses_drop_planes].*

@ -1,15 +1,15 @@
//! `Notcurses` //! `Notcurses`
// total: 52 // total: 53
// --------------------------------------------------- // ---------------------------------------------------
// (X) 1 : wont do // (X) 1 : wont do
// (…) 4 : TODO / WIP
// //
// (f) 45 : unsafe ffi function exported by bindgen // (f) 45 : unsafe ffi function exported by bindgen
// (w) 0 : safely wrapped ffi function // (w) 0 : safely wrapped ffi function
// (r) 6 : static function manually reimplemented // (r) 6 : static function manually reimplemented
// //
// (m) 38 : method implemented // (m) 38 : method implemented
// (~) 3 : work in progress
// //
// (t) 13 : unit test done for the function // (t) 13 : unit test done for the function
// (T) 0 : unit test done also for the method // (T) 0 : unit test done also for the method
@ -31,6 +31,7 @@
// f notcurses_cursor_yx // f notcurses_cursor_yx
// fmt notcurses_debug // fmt notcurses_debug
// fm notcurses_debug_caps // fm notcurses_debug_caps
//~f notcurses_detected_terminal
// fmt notcurses_drop_planes // fmt notcurses_drop_planes
// fm notcurses_getc // fm notcurses_getc
// fmt notcurses_init // fmt notcurses_init

@ -263,14 +263,6 @@ impl NcVisual {
} }
} }
/// Inflates each pixel in the image to 'scale'x'scale' pixels.
///
/// The original color is retained.
pub fn inflate(&mut self, scale: u32) -> NcResult<NcIntResult> {
let res = unsafe { crate::ncvisual_inflate(self, scale as i32) };
error![res, &format!["NcVisual.inflate({})", scale], res]
}
/// Gets the size and ratio of NcVisual pixels to output cells along the /// Gets the size and ratio of NcVisual pixels to output cells along the
/// `y→to_y` and `x→to_x` axes. /// `y→to_y` and `x→to_x` axes.
/// ///
@ -352,18 +344,35 @@ impl NcVisual {
] ]
} }
/// Resizes the visual to `rows` X `columns` pixels. /// Resizes the visual to `cols` X `rows` pixels.
/// ///
/// This is a lossy transformation, unless the size is unchanged. /// This is a lossy transformation, unless the size is unchanged.
/// ///
/// *C style function: [ncvisual_resize()][crate::ncvisual_resize].* /// *C style function: [ncvisual_resize()][crate::ncvisual_resize].*
pub fn resize(&mut self, rows: NcDim, cols: NcDim) -> NcResult<()> { pub fn resize(&mut self, cols: NcDim, rows: NcDim) -> NcResult<()> {
error![ error![
unsafe { crate::ncvisual_resize(self, rows as i32, cols as i32) }, unsafe { crate::ncvisual_resize(self, rows as i32, cols as i32) },
&format!["NcVisual.resize({}, {})", rows, cols] &format!["NcVisual.resize({}, {})", rows, cols]
] ]
} }
/// Resizes the visual to in the image to `rows` X `cols` pixels, without
/// interpolating the color values.
///
/// The original color is retained.
///
/// *C style function:
/// [ncvisual_resize_noninterpolative()][crate::ncvisual_resize_noninterpolative].*
pub fn resize_noninterpolative(&mut self, cols: NcDim, rows: NcDim) -> NcResult<NcIntResult> {
let res =
unsafe { crate::ncvisual_resize_noninterpolative(self, rows as i32, cols as i32) };
error![
res,
&format!["NcVisual.resize_noninterpolative({}, {})", cols, rows],
res
]
}
/// Rotates the visual `rads` radians. /// Rotates the visual `rads` radians.
/// ///
/// Only M_PI/2 and -M_PI/2 are supported at the moment, /// Only M_PI/2 and -M_PI/2 are supported at the moment,

Loading…
Cancel
Save