[rust] update capabilities, support new functions.

- add new Notcurses methods: `canhalfblock()` and `canquadrant()`.
- add doc links to NCBLIT_* flags from the capabilities methods.
- update the full-capabilites example to include `canhalfblock`, `canquadrant`,
  `canchangecolor` and `canfade` functions.
- rustfmt
pull/1586/head
joseLuís 3 years ago
parent 97d8c91a1a
commit 9e2add4e46

@ -10,19 +10,27 @@ fn main() -> NcResult<()> {
"Can display UTF-8: {0}
Can display braille characters: {1}
Can display sextant characters: {2}
Can open images: {3}
Can open videos: {4}
Supports Pixels: {5:?}
Supports True Color: {6}
Palette size: {7:?}
Can display quadrant characters: {3}
Can display half block characters: {4}
Can open images: {5}
Can open videos: {6}
Supports Pixels: {7:?}
Supports True Color: {8}
Supports fading: {9}
Supports changing the palette: {10}
Palette size: {11:?}
",
nc.canutf8(),
nc.canbraille(),
nc.cansextant(),
nc.canquadrant(),
nc.canhalfblock(),
nc.canopen_images(),
nc.canopen_videos(),
nc.check_pixel_support(),
nc.cantruecolor(),
nc.canfade(),
nc.canchangecolor(),
nc.palette_size(),
);

@ -711,8 +711,10 @@ pub use ffi::{
notcurses_canbraille,
notcurses_canchangecolor,
notcurses_canfade,
notcurses_canhalfblock,
notcurses_canopen_images,
notcurses_canopen_videos,
notcurses_canquadrant,
notcurses_cansextant,
notcurses_cantruecolor,
notcurses_canutf8,

@ -61,7 +61,7 @@
// X channels_set_fg_rgb8_clipped // not needed
#[allow(unused_imports)] // for the doc comments
use crate::{NcRgba};
use crate::NcRgba;
#[cfg(test)]
mod test;

@ -162,6 +162,8 @@ impl Notcurses {
/// Returns true if we can reliably use Unicode Braille.
///
/// See also [NCBLIT_BRAILLE][crate::NCBLIT_BRAILLE].
///
/// *C style function: [notcurses_canbraille()][crate::notcurses_canbraille].*
pub fn canbraille(&self) -> bool {
unsafe { crate::notcurses_canbraille(self) }
@ -185,6 +187,15 @@ impl Notcurses {
unsafe { crate::notcurses_canfade(self) }
}
/// Returns true if we can reliably use Unicode half blocks.
///
/// See also [NCBLIT_2x1][crate::NCBLIT_2x1].
///
/// *C style function: [notcurses_canhalfblock()][crate::notcurses_canhalfblock].*
pub fn canhalfblock(&self) -> bool {
unsafe { crate::notcurses_canhalfblock(self) }
}
/// Returns true if loading images is possible.
///
/// This requires being built against FFmpeg/OIIO.
@ -203,8 +214,19 @@ impl Notcurses {
unsafe { crate::notcurses_canopen_videos(self) }
}
/// Returns true if we can reliably use Unicode quadrant blocks.
///
/// See also [NCBLIT_2x2][crate::NCBLIT_2x2].
///
/// *C style function: [notcurses_canquadrant()][crate::notcurses_canquadrant].*
pub fn canquadrant(&self) -> bool {
unsafe { crate::notcurses_canquadrant(self) }
}
/// Returns true if we can reliably use Unicode 13 sextants.
///
/// See also [NCBLIT_3x2][crate::NCBLIT_3x2].
///
/// *C style function: [notcurses_cansextant()][crate::notcurses_cansextant].*
pub fn cansextant(&self) -> bool {
unsafe { crate::notcurses_cansextant(self) }
@ -231,7 +253,8 @@ impl Notcurses {
///
/// Returns `false` for no support, or `true` if pixel output is supported.
///
/// This function must successfully return before NCBLIT_PIXEL is available.
/// This function must successfully return before
/// [NCBLIT_PIXEL][crate::NCBLIT_PIXEL] is available.
///
/// Must not be called concurrently with either input or rasterization.
///

@ -142,7 +142,7 @@ pub const NCVISUAL_OPTION_HORALIGNED: u32 = crate::bindings::ffi::NCVISUAL_OPTIO
/// - without sextant support, NCBLIT_3x2 decays to NCBLIT_2x2
/// - without quadrant support, NCBLIT_2x2 decays to NCBLIT_2x1
/// - the only viable blitters in ASCII are NCBLIT_1x1 and NCBLIT_PIXEL
///
///
/// If you don't want this behaviour you have to use [NCVISUAL_OPTION_NODEGRADE]
///
pub type NcBlitter = crate::bindings::ffi::ncblitter_e;

Loading…
Cancel
Save