Struct ncvisual_options

Source
#[repr(C)]
pub struct ncvisual_options {
Show 13 fields pub n: *mut ncplane, pub scaling: ncscale_e, pub y: c_int, pub x: c_int, pub begy: c_uint, pub begx: c_uint, pub leny: c_uint, pub lenx: c_uint, pub blitter: ncblitter_e, pub flags: u64, pub transcolor: u32, pub pxoffy: c_uint, pub pxoffx: c_uint,
}

Fields§

§n: *mut ncplane

if no ncplane is provided, one will be created using the exact size necessary to render the source with perfect fidelity (this might be smaller or larger than the rendering area). if NCVISUAL_OPTION_CHILDPLANE is provided, this must be non-NULL, and will be interpreted as the parent.

§scaling: ncscale_e

the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE in this case). otherwise, the source is stretched/scaled relative to the provided ncplane.

§y: c_int

if an ncplane is provided, y and x specify where the visual will be rendered on that plane. otherwise, they specify where the created ncplane will be placed relative to the standard plane’s origin. x is an ncalign_e value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if NCVISUAL_OPTION_VERALIGNED is provided.

§x: c_int

if an ncplane is provided, y and x specify where the visual will be rendered on that plane. otherwise, they specify where the created ncplane will be placed relative to the standard plane’s origin. x is an ncalign_e value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if NCVISUAL_OPTION_VERALIGNED is provided.

§begy: c_uint

origin of rendered region in pixels

§begx: c_uint

origin of rendered region in pixels

§leny: c_uint

size of rendered region in pixels

§lenx: c_uint

size of rendered region in pixels

§blitter: ncblitter_e

glyph set to use (maps input to output cells)

§flags: u64

bitmask over NCVISUAL_OPTION_*

§transcolor: u32

treat this color as transparent under NCVISUAL_OPTION_ADDALPHA

§pxoffy: c_uint

pixel offsets within the cell. if NCBLIT_PIXEL is used, the bitmap will be drawn offset from the upper-left cell’s origin by these amounts. it is an error if either number exceeds the cell-pixel geometry in its dimension. if NCBLIT_PIXEL is not used, these fields are ignored. this functionality can be used for smooth bitmap movement.

§pxoffx: c_uint

pixel offsets within the cell. if NCBLIT_PIXEL is used, the bitmap will be drawn offset from the upper-left cell’s origin by these amounts. it is an error if either number exceeds the cell-pixel geometry in its dimension. if NCBLIT_PIXEL is not used, these fields are ignored. this functionality can be used for smooth bitmap movement.

Implementations§

Source§

impl<'ncplane> ncvisual_options

§Constructors

Source

pub fn builder() -> NcVisualOptionsBuilder<'ncplane>

Returns a builder object for NcVisualOptions.

Source

pub fn new( plane: Option<&mut NcPlane>, scale: impl Into<NcScale>, y: i32, x: i32, section_yx_lenyx: Option<(u32, u32, u32, u32)>, cell_offset_yx: Option<(u32, u32)>, blitter: impl Into<NcBlitter>, flags: impl Into<NcVisualFlag>, transcolor: impl Into<NcRgba>, ) -> Self

New NcVisualOptions.

§Arguments
  • plane - an optional mutable pointer to an NcPlane.

  • scale - An NcScale indicating how the source will be stretched/scaled relative to the NcPlane.

  • y - if an NcPlane is provided in plane then this specifies where the NcVisual will be on that plane in the y axis.

    Otherwise it specifies where the created NcPlane will be placed in the y axis, relative to the standard plane’s origin.

    If VerAligned is set, this will be interpreted as an NcAlign value.

  • x - if an NcPlane is provided in plane then this specifies where the NcVisual will be on that plane, in the x axis.

    Otherwise it specifies where the created NcPlane will be placed, in the y axis, relative to the standard plane’s origin.

    If HorAligned is set, this will be interpreted as an NcAlign value.

  • section_yx_lenyx - The size of the rendered section.

    None renders the entire visual, otherwise the provided tuple (y, x, len_y, len_x) sets [yx] as the origin of the section and len_[yx] as the its length on each respective dimension.

  • cell_offset_yx - Pixel offsets within the cell.

    If NcBlitter::Pixel is used the bitmap will be drawn offset from the upper-left cell’s origin by these amounts, otherwise this will be ignored.

    It is an error if either number exceeds the cell-pixel geometry in any dimension (see NcVisualGeometry.cdim_yx).

  • blitter - NcBlitter glyph set to use for blitting.

  • flags - NcVisualFlag.

  • transcolor - treats this color as transparent when the AddAlpha flag is active

§Notes

If the Childplane flag is used then the plane is interpreted as the parent NcPlane of the new plane created for this NcVisual.

Source§

impl ncvisual_options

§Methods

Source

pub fn does_plane(&self) -> bool

Returns true if it does have an associated NcPlane.

Source

pub fn does_child_plane(&self) -> bool

Returns true if it has the ChildPlane flag set.

Source

pub fn does_alpha(&self) -> bool

Returns true if it has the AddAlpha flag set.

Source

pub fn does_blend(&self) -> bool

Returns true if it has the Blend flag set.

Source

pub fn does_degrade(&self) -> bool

Returns false if it has the NoDegrade flag set.

Source

pub fn does_interpolate(&self) -> bool

Returns false if it has the NoInterpolate flag set.

Source

pub fn is_veraligned(&self) -> bool

Returns true if it has the VerAligned flag set.

Source

pub fn is_horaligned(&self) -> bool

Returns true if it has the HorAligned flag set.

Trait Implementations§

Source§

impl Debug for ncvisual_options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ncvisual_options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> From<ncvisual_options> for NcVisualOptionsBuilder<'a>

Source§

fn from(options: NcVisualOptions) -> NcVisualOptionsBuilder<'a>

Converts to this type from the input type.
Source§

impl Hash for ncvisual_options

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ncvisual_options

Source§

fn cmp(&self, other: &ncvisual_options) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ncvisual_options

Source§

fn eq(&self, other: &ncvisual_options) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ncvisual_options

Source§

fn partial_cmp(&self, other: &ncvisual_options) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for ncvisual_options

Source§

impl StructuralPartialEq for ncvisual_options

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.