#[repr(u32)]
#[non_exhaustive]
pub enum NcBlitter {
    Default,
    Ascii,
    Half,
    Quadrant,
    Sextant,
    Braille,
    Pixel,
    _4x1,
    _8x1,
}
Expand description

The blitter mode to use for rasterizing an NcVisual.

We never blit full blocks, but instead spaces (more efficient) with the background set to the desired foreground.

Default

NcBlitter::Default

Degradation

There is a mechanism of graceful degradation, that works as follows:

If you don’t want this behaviour you have to set the NcVisualFlag::NoDegrade on NcVisualOptions or call degrade(false) on NcVisualOptionsBuilder.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Default

§

Ascii

Blitter mode using only spaces, compatible with ASCII (1x1).

§

Half

Blitter mode using halves + Ascii (2x1). ▄▀

§

Quadrant

Blitter mode using quadrants + Half (2x2). ▗▐ ▖▀▟▌▙

§

Sextant

Blitter mode using sextants + Quadrant (3x2). 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞🬟🬠🬡🬢🬣🬤🬥🬦🬧🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻

§

Braille

Blitter mode using braille (4x2). ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿

§

Pixel

Blitter mode using Pixels/Sixels.

§

_4x1

NcBlitter mode using: four vertical levels (4x1). █▆▄▂

§

_8x1

NcBlitter mode using: eight vertical levels (8x1). █▇▆▅▄▃▂▁

Implementations§

source§

impl NcBlitter

source

pub const fn cell_height(&self) -> Option<u8>

The number of height subdivisions in a cell using the current blitter.

Default & Pixel returns None.

source

pub const fn cell_width(&self) -> Option<u8>

The number of width subdivisions in a cell using the current blitter.

Default & Pixel returns None.

source

pub const fn cell_size(&self) -> Option<(u8, u8)>

The inner Cell’s dimensions (height, width) using the current blitter.

Default & Pixel returns None.

source§

impl NcBlitter

source

pub fn blit_rgba( data: &[u8], line_size: usize, vopts: &NcVisualOptions ) -> NcResult<usize>

Blits a flat array data of NcRgba values to the NcPlane that must be configured in vopts.

The blit begins at vopts.y and vopts.x relative to the plane.

Each source row ought occupy line_size bytes (this might be greater than vopts.lenx * 4 due to padding or partial blits).

A subregion of the input can be specified with the begy×begx and leny×lenx fields from vopts.

Returns the number of pixels blitted on success.

C style function: ncblit_rgba().

source

pub fn blit_bgrx( data: &[u8], line_size: usize, vopts: &NcVisualOptions ) -> NcResult<usize>

Like blit_rgba, but for BGRx.

C style function: ncblit_bgrx().

source

pub fn blit_rgb_packed( data: &[u8], line_size: usize, vopts: &NcVisualOptions, alpha: u8 ) -> NcResult<usize>

Like blit_rgba, but for RGB.

line_size must be a multiple of 3 for this RGB data.

Supply an alpha value to be applied throughout.

C style function: ncblit_rgb_packed().

source

pub fn blit_rgb_loose( data: &[u8], line_size: usize, vopts: &NcVisualOptions, alpha: u8 ) -> NcResult<usize>

Like blit_rgb_packed, but line_size must be a multiple of 4 for this RGBx data.

Supply an alpha value to be applied throughout.

C style function: ncblit_rgb_loose().

source§

impl NcBlitter

source

pub const _1x1: NcBlitter = NcBlitter::Ascii

source

pub const _2x1: NcBlitter = NcBlitter::Half

source

pub const _2x2: NcBlitter = NcBlitter::Quadrant

source

pub const _3x2: NcBlitter = NcBlitter::Sextant

Trait Implementations§

source§

impl Clone for NcBlitter

source§

fn clone(&self) -> NcBlitter

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 NcBlitter

source§

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

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

impl Default for NcBlitter

source§

fn default() -> Self

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

impl Display for NcBlitter

source§

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

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

impl From<NcBlitter> for NcBlitter_u32

source§

fn from(blitter: NcBlitter) -> Self

Converts to this type from the input type.
source§

impl From<u32> for NcBlitter

source§

fn from(blitter: NcBlitter_u32) -> Self

Converts to this type from the input type.
source§

impl PartialEq<NcBlitter> for NcBlitter

source§

fn eq(&self, other: &NcBlitter) -> 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 NcBlitter

source§

impl Eq for NcBlitter

source§

impl StructuralEq for NcBlitter

source§

impl StructuralPartialEq for NcBlitter

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.