pub struct NcVisualOptionsBuilder<'ncplane> { /* private fields */ }
Expand description

Builder object for NcVisualOptions.

Can be constructed by calling NcVisualOptions::builder().

Implementations§

source§

impl<'ncplane> NcVisualOptionsBuilder<'ncplane>

§Constructors

source

pub fn new() -> Self

New default NcVisualOptionsBuilder.

source

pub fn from_options(o: &NcVisualOptions) -> Self

New builder from pre-existing options.

source§

impl<'ncplane> NcVisualOptionsBuilder<'ncplane>

§Methods (chainable)

source

pub fn plane(self, plane: &'ncplane mut NcPlane) -> Self

Sets the NcPlane where the blitting will be done.

This NcPlane could also be considered the parent of a new plane where the blitting will occur by utilizing the child method.

When 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).

Default: None (no plane).

See also: parent, child, no_plane.

source

pub fn child(self, child: bool) -> Self

If true, a plane must also be provided, which will be the parent of a new child NcPlane into which the blitting will be done.

If false, the blitting will occur in the provided plane, if any, or in a newly created NcPlane otherwise.

Default: false (no child plaane).

Effect: Sets the CHILDPLANE flag.

See also: plane, parent.

source

pub fn parent(self, plane: &'ncplane mut NcPlane) -> Self

Sets the NcPlane that will be the parent of a new NcPlane where the blitting will be done.

This is the same as calling both plane and child.

See also: plane, child.

source

pub fn no_plane(self) -> Self

Unsets the NcPlane.

Effect: unsets the plane & the CHILDPLANE flag.

Default: None (no plane).

source

pub fn scale(self, scale: impl Into<NcScale>) -> Self

Sets the NcScale.

Default: NcScale::NOSCALE.

source

pub fn y(self, y: i32) -> Self

Sets the vertical placement.

Default: 0.

Effect: Sets the y coordinate, and unsets the VerAligned flag.

source

pub fn x(self, x: i32) -> Self

Sets the horizontal placement.

Default: 0.

Effect: Sets the x coordinate, and unsets the HorAligned flag.

source

pub fn yx(self, y: i32, x: i32) -> Self

Sets the vertical & horizontal placement.

Default: (0, 0).

Effect: Sets the y & x coordinates and unsets the VerAligned & HorAligned flags.

source

pub fn valign(self, valign: impl Into<NcAlign>) -> Self

Sets the vertical alignment.

Default: NcAlign::Top.

Effect: Sets the y alignment and the VerAligned flag.

source

pub fn halign(self, halign: impl Into<NcAlign>) -> Self

Sets the horizontal alignment.

Default: NcAlign::Left.

Effect: Sets the x alignment and the HorAligned flag.

source

pub fn align( self, valign: impl Into<NcAlign>, halign: impl Into<NcAlign> ) -> Self

Sets the vertical & horizontal alignments.

Default: (NcAlign::Top, NcAlign::Left).

Effect: Sets the y & x alignments and the VerAligned and HorAligned flags.

source

pub fn blitter(self, blitter: impl Into<NcBlitter>) -> Self

Choose the NcBlitter.

Default: NcBlitter::Default.

source

pub fn pixel(self) -> Self

Choose NcBlitter::Pixel for the blitter.

source

pub fn transcolor(self, color: Option<impl Into<NcRgba>>) -> Self

Choose the color to be considered transparent, or None.

Default: none.

Efect: (Un)Sets the transparent color, and the AddAlpha flag.

source

pub fn blend(self, blend: bool) -> Self

Choose whether to use NcAlpha::Blend with the NcVisual, so that the foreground or background colors can be a composite between a color and the corresponding colors underneath it.

Default: false (blends not).

Effect: Sets the Blend flag.

source

pub fn degrade(self, degrade: bool) -> Self

Choose between gracefully degrading the blitter, or fail if the choosen NcBlitter is not supported by the terminal.

Default: true (degrades).

Effect: Sets the NoDegrade flag.

See also: the rules of degradation.

source

pub fn interpolate(self, interpolate: bool) -> Self

Sets the NoInterpolate flag.

Default: true (interpolates).

source

pub fn region(self, beg_y: u32, beg_x: u32, len_y: u32, len_x: u32) -> Self

Sets the region to be rendered.

(start_y, start_x, len_y, len_x)

source

pub fn cell_offset(self, y: u32, x: u32) -> Self

Sets the pixel offset within the NcCell.

source

pub fn build(self) -> NcVisualOptions

Finishes the building and returns NcVisualOptions.

Trait Implementations§

source§

impl<'ncplane> Debug for NcVisualOptionsBuilder<'ncplane>

source§

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

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

impl<'ncplane> Default for NcVisualOptionsBuilder<'ncplane>

source§

fn default() -> NcVisualOptionsBuilder<'ncplane>

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

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'ncplane> RefUnwindSafe for NcVisualOptionsBuilder<'ncplane>

§

impl<'ncplane> Send for NcVisualOptionsBuilder<'ncplane>

§

impl<'ncplane> Sync for NcVisualOptionsBuilder<'ncplane>

§

impl<'ncplane> Unpin for NcVisualOptionsBuilder<'ncplane>

§

impl<'ncplane> !UnwindSafe for NcVisualOptionsBuilder<'ncplane>

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

§

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.