pub struct NcVisualGeometry {
    pub pix_yx: Option<(u32, u32)>,
    pub cdim_yx: Option<(u32, u32)>,
    pub rpix_yx: Option<(u32, u32)>,
    pub rcell_yx: Option<(u32, u32)>,
    pub scale_yx: Option<(u32, u32)>,
    pub maxpixel_yx: Option<(u32, u32)>,
    pub beg_yx: Option<(u32, u32)>,
    pub len_yx: Option<(u32, u32)>,
    pub blitter: NcBlitter,
}
Expand description

Describes all the geometries of an NcVisual.

It includes both inherent geometries and those which are dependent upon a given rendering regime.

Inner values are calculated at the time of the call. A font change, for example, could make all the fields invalid, except for pix_yx.

This type is is returned by the NcVisual.geom method and by the Nc.visual_geom method.

§See also

Fields§

§pix_yx: Option<(u32, u32)>

The true internal pixel geometry of NcVisual data, taken directly from the load, and updated by ncvisual_resize.

Corresponds to the NcVGeom fields (pixy, pixx).

§cdim_yx: Option<(u32, u32)>

Terminal cell geometry at the time of the call. This is the size of a cell in pixels.

This can change with a font change, in which case all field values are invalidated (except for pix_yx).

Corresponds to the NcVGeom fields (cdimy, cdimx), and to the NcPixelGeometry fields (cell_y, cell_x)

§rpix_yx: Option<(u32, u32)>

Rendered pixel geometry, per NcVisualOptions. as handed to the blitter, following any scaling.

Corresponds to the NcVGeom fields (rpixy, rpixx).

§rcell_yx: Option<(u32, u32)>

Rendered cell geometry, per NcVisualOptions.

As written by the blitter, following any padding (there is padding whenever rpix{y, x} is not evenly divided by scale{y, x}, and also sometimes for Sixel).

Corresponds to the NcVGeom fields (rcelly, rcellx).

§scale_yx: Option<(u32, u32)>

The number of input pixels drawn to a single cell.

When using NcBlitter::Pixel, they are equivalent to cdim_yx.

Corresponds to the NcVGeom fields (scaley, scalex).

§maxpixel_yx: Option<(u32, u32)>

The largest bitmap geometry that the terminal is willing to accept.

It is only defined when using NcBlitter::Pixel.

Corresponds to the NcVGeom fields (maxpixely, maxpixelx).

§beg_yx: Option<(u32, u32)>

The upper-left corner of the used section.

Corresponds to the NcVGeom fields (begy, begx), and the NcVisualOptions fields (begy, begx).

§len_yx: Option<(u32, u32)>

The geometry of the used section.

Corresponds to the NcVGeom fields (leny, lenx), and the NcVisualOptions fields (leny, lenx).

§blitter: NcBlitter

The NcBlitter which will be used.

A function of the requested blitter and the blitters actually supported by this environment.

Implementations§

source§

impl NcVisualGeometry

source

pub fn blitter_name(&self) -> String

The name of the blitter which will be used.

A function of the requested blitter and the blitters actually supported by this environment.

source§

impl NcVisualGeometry

§Getter methods for the NcVGeom fields

Each of the following methods return the corresponding NcVGeom field with the same name.

source

pub fn pixy(&self) -> u32

source

pub fn pixx(&self) -> u32

source

pub fn cdimy(&self) -> u32

source

pub fn cdimx(&self) -> u32

source

pub fn rpixy(&self) -> u32

source

pub fn rpixx(&self) -> u32

source

pub fn rcelly(&self) -> u32

source

pub fn rcellx(&self) -> u32

source

pub fn scaley(&self) -> u32

source

pub fn scalex(&self) -> u32

source

pub fn maxpixely(&self) -> u32

source

pub fn maxpixelx(&self) -> u32

source

pub fn begy(&self) -> u32

source

pub fn begx(&self) -> u32

source

pub fn leny(&self) -> u32

source

pub fn lenx(&self) -> u32

Trait Implementations§

source§

impl Clone for NcVisualGeometry

source§

fn clone(&self) -> NcVisualGeometry

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for NcVisualGeometry

source§

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

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

impl Default for NcVisualGeometry

source§

fn default() -> NcVisualGeometry

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

impl From<ncvgeom> for NcVisualGeometry

source§

fn from(vg: NcVGeom) -> Self

Since we don’t know the origin of the NcVGeom struct, when some fields are 0, we can’t really know whether that’s a valid value or not. That should be determined manually by other means.

Specifically len_yx, beg_yx & maxpixel_yx wont be None even if the corresponding NcVGeom fields are 0. But they would be None if the NcVisualGeometry had been created by the

See: https://github.com/dankamongmen/notcurses/pull/2320#issuecomment-962170075

source§

impl PartialEq for NcVisualGeometry

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for NcVisualGeometry

source§

impl Eq for NcVisualGeometry

source§

impl StructuralPartialEq for NcVisualGeometry

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.