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
.
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.
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).
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
.
maxpixel_yx: Option<(u32, u32)>
The largest bitmap geometry that the terminal is willing to accept.
It is only defined when using NcBlitter::Pixel
.
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
impl NcVisualGeometry
Sourcepub fn blitter_name(&self) -> String
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
impl NcVisualGeometry
pub fn pixy(&self) -> u32
pub fn pixx(&self) -> u32
pub fn cdimy(&self) -> u32
pub fn cdimx(&self) -> u32
pub fn rpixy(&self) -> u32
pub fn rpixx(&self) -> u32
pub fn rcelly(&self) -> u32
pub fn rcellx(&self) -> u32
pub fn scaley(&self) -> u32
pub fn scalex(&self) -> u32
pub fn maxpixely(&self) -> u32
pub fn maxpixelx(&self) -> u32
pub fn begy(&self) -> u32
pub fn begx(&self) -> u32
pub fn leny(&self) -> u32
pub fn lenx(&self) -> u32
Trait Implementations§
Source§impl Clone for NcVisualGeometry
impl Clone for NcVisualGeometry
Source§fn clone(&self) -> NcVisualGeometry
fn clone(&self) -> NcVisualGeometry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for NcVisualGeometry
impl Debug for NcVisualGeometry
Source§impl Default for NcVisualGeometry
impl Default for NcVisualGeometry
Source§fn default() -> NcVisualGeometry
fn default() -> NcVisualGeometry
Source§impl From<ncvgeom> for NcVisualGeometry
impl From<ncvgeom> for NcVisualGeometry
Source§fn from(vg: NcVGeom) -> Self
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