|
|
@ -7,8 +7,8 @@ use core::{
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
|
cstring, error, error_ref, error_ref_mut, rstring, NcAlign, NcAlphaBits, NcBlitter, NcBoxMask,
|
|
|
|
cstring, error, error_ref, error_ref_mut, rstring, NcAlign, NcAlphaBits, NcBlitter, NcBoxMask,
|
|
|
|
NcCell, NcChannel, NcChannelPair, NcColor, NcDim, NcEgc, NcError, NcFadeCb, NcOffset,
|
|
|
|
NcCell, NcChannel, NcChannelPair, NcColor, NcDim, NcEgc, NcError, NcFadeCb, NcOffset,
|
|
|
|
NcPaletteIndex, NcPixelGeometry, NcPlane, NcPlaneOptions, NcResizeCb, NcResult, NcRgb,
|
|
|
|
NcPaletteIndex, NcPixelGeometry, NcPlane, NcPlaneOptions, NcResizeCb, NcResult, NcRgb, NcStyle,
|
|
|
|
NcStyleMask, NcTime, Notcurses, NCRESULT_ERR,
|
|
|
|
NcTime, Notcurses, NCRESULT_ERR,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// # NcPlaneOptions Constructors
|
|
|
|
/// # NcPlaneOptions Constructors
|
|
|
@ -455,7 +455,7 @@ impl NcPlane {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/// ## NcPlane methods: `NcStyleMask` & `PaletteIndex`
|
|
|
|
/// ## NcPlane methods: `NcStyle` & `PaletteIndex`
|
|
|
|
impl NcPlane {
|
|
|
|
impl NcPlane {
|
|
|
|
/// Sets the given style throughout the specified region, keeping content
|
|
|
|
/// Sets the given style throughout the specified region, keeping content
|
|
|
|
/// and channels unchanged.
|
|
|
|
/// and channels unchanged.
|
|
|
@ -463,12 +463,7 @@ impl NcPlane {
|
|
|
|
/// Returns the number of cells set.
|
|
|
|
/// Returns the number of cells set.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// *C style function: [ncplane_format()][crate::ncplane_format].*
|
|
|
|
/// *C style function: [ncplane_format()][crate::ncplane_format].*
|
|
|
|
pub fn format(
|
|
|
|
pub fn format(&mut self, y_stop: NcDim, x_stop: NcDim, stylemask: NcStyle) -> NcResult<NcDim> {
|
|
|
|
&mut self,
|
|
|
|
|
|
|
|
y_stop: NcDim,
|
|
|
|
|
|
|
|
x_stop: NcDim,
|
|
|
|
|
|
|
|
stylemask: NcStyleMask,
|
|
|
|
|
|
|
|
) -> NcResult<NcDim> {
|
|
|
|
|
|
|
|
let res =
|
|
|
|
let res =
|
|
|
|
unsafe { crate::ncplane_format(self, y_stop as i32, x_stop as i32, stylemask as u32) };
|
|
|
|
unsafe { crate::ncplane_format(self, y_stop as i32, x_stop as i32, stylemask as u32) };
|
|
|
|
error![
|
|
|
|
error![
|
|
|
@ -481,14 +476,14 @@ impl NcPlane {
|
|
|
|
/// Returns the current styling for this NcPlane.
|
|
|
|
/// Returns the current styling for this NcPlane.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// *C style function: [ncplane_styles()][crate::ncplane_styles].*
|
|
|
|
/// *C style function: [ncplane_styles()][crate::ncplane_styles].*
|
|
|
|
pub fn styles(&self) -> NcStyleMask {
|
|
|
|
pub fn styles(&self) -> NcStyle {
|
|
|
|
unsafe { crate::ncplane_styles(self) }
|
|
|
|
unsafe { crate::ncplane_styles(self) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Removes the specified styles from this NcPlane's existing spec.
|
|
|
|
/// Removes the specified styles from this NcPlane's existing spec.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// *C style function: [ncplane_off_styles()][crate::ncplane_off_styles].*
|
|
|
|
/// *C style function: [ncplane_off_styles()][crate::ncplane_off_styles].*
|
|
|
|
pub fn off_styles(&mut self, stylemask: NcStyleMask) {
|
|
|
|
pub fn off_styles(&mut self, stylemask: NcStyle) {
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
|
crate::ncplane_off_styles(self, stylemask as u32);
|
|
|
|
crate::ncplane_off_styles(self, stylemask as u32);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -497,7 +492,7 @@ impl NcPlane {
|
|
|
|
/// Adds the specified styles to this NcPlane's existing spec.
|
|
|
|
/// Adds the specified styles to this NcPlane's existing spec.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// *C style function: [ncplane_on_styles()][crate::ncplane_on_styles].*
|
|
|
|
/// *C style function: [ncplane_on_styles()][crate::ncplane_on_styles].*
|
|
|
|
pub fn on_styles(&mut self, stylemask: NcStyleMask) {
|
|
|
|
pub fn on_styles(&mut self, stylemask: NcStyle) {
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
|
crate::ncplane_on_styles(self, stylemask as u32);
|
|
|
|
crate::ncplane_on_styles(self, stylemask as u32);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -506,7 +501,7 @@ impl NcPlane {
|
|
|
|
/// Sets just the specified styles for this NcPlane.
|
|
|
|
/// Sets just the specified styles for this NcPlane.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// *C style function: [ncplane_set_styles()][crate::ncplane_set_styles].*
|
|
|
|
/// *C style function: [ncplane_set_styles()][crate::ncplane_set_styles].*
|
|
|
|
pub fn set_styles(&mut self, stylemask: NcStyleMask) {
|
|
|
|
pub fn set_styles(&mut self, stylemask: NcStyle) {
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
|
crate::ncplane_set_styles(self, stylemask as u32);
|
|
|
|
crate::ncplane_set_styles(self, stylemask as u32);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -541,14 +536,14 @@ impl NcPlane {
|
|
|
|
/// ## NcPlane methods: `NcCell` & `NcEgc`
|
|
|
|
/// ## NcPlane methods: `NcCell` & `NcEgc`
|
|
|
|
impl NcPlane {
|
|
|
|
impl NcPlane {
|
|
|
|
/// Retrieves the current contents of the [NcCell] under the cursor,
|
|
|
|
/// Retrieves the current contents of the [NcCell] under the cursor,
|
|
|
|
/// returning the [NcEgc] and writing out the [NcStyleMask] and the [NcChannelPair].
|
|
|
|
/// returning the [NcEgc] and writing out the [NcStyle] and the [NcChannelPair].
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// This NcEgc must be freed by the caller.
|
|
|
|
/// This NcEgc must be freed by the caller.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// *C style function: [ncplane_at_cursor()][crate::ncplane_at_cursor].*
|
|
|
|
/// *C style function: [ncplane_at_cursor()][crate::ncplane_at_cursor].*
|
|
|
|
pub fn at_cursor(
|
|
|
|
pub fn at_cursor(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
stylemask: &mut NcStyleMask,
|
|
|
|
stylemask: &mut NcStyle,
|
|
|
|
channels: &mut NcChannelPair,
|
|
|
|
channels: &mut NcChannelPair,
|
|
|
|
) -> NcResult<NcEgc> {
|
|
|
|
) -> NcResult<NcEgc> {
|
|
|
|
let egc = unsafe { crate::ncplane_at_cursor(self, stylemask, channels) };
|
|
|
|
let egc = unsafe { crate::ncplane_at_cursor(self, stylemask, channels) };
|
|
|
@ -579,7 +574,7 @@ impl NcPlane {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Retrieves the current contents of the specified [NcCell], returning the
|
|
|
|
/// Retrieves the current contents of the specified [NcCell], returning the
|
|
|
|
/// [NcEgc] and writing out the [NcStyleMask] and the [NcChannelPair].
|
|
|
|
/// [NcEgc] and writing out the [NcStyle] and the [NcChannelPair].
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// This NcEgc must be freed by the caller.
|
|
|
|
/// This NcEgc must be freed by the caller.
|
|
|
|
///
|
|
|
|
///
|
|
|
@ -588,7 +583,7 @@ impl NcPlane {
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
y: NcDim,
|
|
|
|
y: NcDim,
|
|
|
|
x: NcDim,
|
|
|
|
x: NcDim,
|
|
|
|
stylemask: &mut NcStyleMask,
|
|
|
|
stylemask: &mut NcStyle,
|
|
|
|
channels: &mut NcChannelPair,
|
|
|
|
channels: &mut NcChannelPair,
|
|
|
|
) -> NcResult<NcEgc> {
|
|
|
|
) -> NcResult<NcEgc> {
|
|
|
|
let egc = unsafe { crate::ncplane_at_yx(self, y as i32, x as i32, stylemask, channels) };
|
|
|
|
let egc = unsafe { crate::ncplane_at_yx(self, y as i32, x as i32, stylemask, channels) };
|
|
|
@ -652,7 +647,7 @@ impl NcPlane {
|
|
|
|
pub fn set_base(
|
|
|
|
pub fn set_base(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
egc: &str,
|
|
|
|
egc: &str,
|
|
|
|
stylemask: NcStyleMask,
|
|
|
|
stylemask: NcStyle,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
) -> NcResult<u32> {
|
|
|
|
) -> NcResult<u32> {
|
|
|
|
let res =
|
|
|
|
let res =
|
|
|
@ -1761,7 +1756,7 @@ impl NcPlane {
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn double_box(
|
|
|
|
pub fn double_box(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
stylemask: NcStyleMask,
|
|
|
|
stylemask: NcStyle,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
y_stop: NcDim,
|
|
|
|
y_stop: NcDim,
|
|
|
|
x_stop: NcDim,
|
|
|
|
x_stop: NcDim,
|
|
|
@ -1778,7 +1773,7 @@ impl NcPlane {
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn double_box_sized(
|
|
|
|
pub fn double_box_sized(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
stylemask: NcStyleMask,
|
|
|
|
stylemask: NcStyle,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
y_len: NcDim,
|
|
|
|
y_len: NcDim,
|
|
|
|
x_len: NcDim,
|
|
|
|
x_len: NcDim,
|
|
|
@ -1815,7 +1810,7 @@ impl NcPlane {
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn perimeter_double(
|
|
|
|
pub fn perimeter_double(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
stylemask: NcStyleMask,
|
|
|
|
stylemask: NcStyle,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
boxmask: NcBoxMask,
|
|
|
|
boxmask: NcBoxMask,
|
|
|
|
) -> NcResult<()> {
|
|
|
|
) -> NcResult<()> {
|
|
|
@ -1831,7 +1826,7 @@ impl NcPlane {
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn perimeter_rounded(
|
|
|
|
pub fn perimeter_rounded(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
stylemask: NcStyleMask,
|
|
|
|
stylemask: NcStyle,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
channels: NcChannelPair,
|
|
|
|
boxmask: NcBoxMask,
|
|
|
|
boxmask: NcBoxMask,
|
|
|
|
) -> NcResult<()> {
|
|
|
|
) -> NcResult<()> {
|
|
|
@ -1933,7 +1928,7 @@ impl NcPlane {
|
|
|
|
pub fn gradient(
|
|
|
|
pub fn gradient(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
egc: &NcEgc,
|
|
|
|
egc: &NcEgc,
|
|
|
|
stylemask: NcStyleMask,
|
|
|
|
stylemask: NcStyle,
|
|
|
|
ul: NcChannelPair,
|
|
|
|
ul: NcChannelPair,
|
|
|
|
ur: NcChannelPair,
|
|
|
|
ur: NcChannelPair,
|
|
|
|
ll: NcChannelPair,
|
|
|
|
ll: NcChannelPair,
|
|
|
@ -1973,7 +1968,7 @@ impl NcPlane {
|
|
|
|
pub fn gradient_sized(
|
|
|
|
pub fn gradient_sized(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
egc: &NcEgc,
|
|
|
|
egc: &NcEgc,
|
|
|
|
stylemask: NcStyleMask,
|
|
|
|
stylemask: NcStyle,
|
|
|
|
ul: NcChannel,
|
|
|
|
ul: NcChannel,
|
|
|
|
ur: NcChannel,
|
|
|
|
ur: NcChannel,
|
|
|
|
ll: NcChannel,
|
|
|
|
ll: NcChannel,
|
|
|
|