Type Alias libnotcurses_sys::NcVisualOptions
source · pub type NcVisualOptions = ncvisual_options;
Expand description
Options struct for NcVisual
.
It is recommended to construct it via NcVisualOptionsBuilder
by calling NcVisualOptions::builder()
.
§Usage
If a plane is not provided, one will be created, having the exact size
necessary to display the visual (this might be smaller or larger than
the rendering area). if ChildPlane
is provided, this will be
interpreted as the parent.
A subregion of the visual can be rendered using beg_y
, beg_x
, len_y
,
and len_x
.
§Fields
-
scaling
: anNcScale
indicating how the source will be stretched/scaled relative to theNcPlane
. -
y
: if anNcPlane
is provided inn
then this specifies where theNcVisual
will be on that plane.Otherwise it specifies where the created
NcPlane
will be placed relative to the standard plane’s origin.If
VerAligned
is set, this will be interpreted as anNcAlign
value. -
x
: if anNcPlane
is provided inn
then this specifies where theNcVisual
will be on that plane.Otherwise it specifies where the created
NcPlane
will be placed relative to the standard plane’s origin.If
HorAligned
is set, this will be interpreted as anNcAlign
value. -
begy
: origin of rendered section in the y axis. -
begx
: origin of rendered section in the x axis. -
leny
: length of rendered section in the y axis. -
lenx
: length of rendered section in the x axis. -
transcolor
: treats this color as transparent when theAddAlpha
flag is active. -
pxoffy
: pixel offset within the cell in the y axis.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
NcPixelGeometry.cell_y
,NcVisualGeometry.cdim_yx
). -
pxoffx
: pixel offset within the cell in the x axis.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
NcPixelGeometry.cell_x
,NcVisualGeometry.cdim_yx
).
Aliased Type§
struct NcVisualOptions {}
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: u32
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: i32
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: i32
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: u32
origin of rendered region in pixels
begx: u32
origin of rendered region in pixels
leny: u32
size of rendered region in pixels
lenx: u32
size of rendered region in pixels
blitter: u32
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: u32
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: u32
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> NcVisualOptions
impl<'ncplane> NcVisualOptions
§Constructors
sourcepub fn builder() -> NcVisualOptionsBuilder<'ncplane>
pub fn builder() -> NcVisualOptionsBuilder<'ncplane>
Returns a builder object for NcVisualOptions
.
sourcepub 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
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 anNcPlane
. -
scale
- AnNcScale
indicating how the source will be stretched/scaled relative to theNcPlane
. -
y
- if anNcPlane
is provided inplane
then this specifies where theNcVisual
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 anNcAlign
value. -
x
- if anNcPlane
is provided inplane
then this specifies where theNcVisual
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 anNcAlign
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 andlen_[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 theAddAlpha
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 NcVisualOptions
impl NcVisualOptions
§Methods
sourcepub fn does_plane(&self) -> bool
pub fn does_plane(&self) -> bool
Returns true
if it does have an associated NcPlane
.
sourcepub fn does_child_plane(&self) -> bool
pub fn does_child_plane(&self) -> bool
Returns true
if it has the ChildPlane
flag set.
sourcepub fn does_alpha(&self) -> bool
pub fn does_alpha(&self) -> bool
Returns true
if it has the AddAlpha
flag set.
sourcepub fn does_blend(&self) -> bool
pub fn does_blend(&self) -> bool
Returns true
if it has the Blend
flag set.
sourcepub fn does_degrade(&self) -> bool
pub fn does_degrade(&self) -> bool
Returns false
if it has the NoDegrade
flag set.
sourcepub fn does_interpolate(&self) -> bool
pub fn does_interpolate(&self) -> bool
Returns false
if it has the NoInterpolate
flag set.
sourcepub fn is_veraligned(&self) -> bool
pub fn is_veraligned(&self) -> bool
Returns true
if it has the VerAligned
flag set.
sourcepub fn is_horaligned(&self) -> bool
pub fn is_horaligned(&self) -> bool
Returns true
if it has the HorAligned
flag set.