#[non_exhaustive]#[repr(u32)]pub enum NcBlitter {
Default = 0,
Ascii = 1,
Half = 2,
Quadrant = 3,
Sextant = 4,
Braille = 5,
Pixel = 6,
_4x1 = 7,
_8x1 = 8,
}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
§Degradation
There is a mechanism of graceful degradation, that works as follows:
- without braille support,
Brailledecays toSextant. - without bitmap support,
Pixeldecays toSextant. - without sextant support,
Sextantdecays toQuadrant. - without quadrant support,
Quadrantdecays toHalf. - the only viable blitters in ASCII are
AsciiandPixel.
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
Default = 0
Ascii = 1
Blitter mode using only spaces, compatible with ASCII (1x1).
Half = 2
Blitter mode using halves + Ascii (2x1).
▄▀
Quadrant = 3
Blitter mode using quadrants + Half (2x2).
▗▐ ▖▀▟▌▙
Sextant = 4
Blitter mode using sextants + Quadrant (3x2).
🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞🬟🬠🬡🬢🬣🬤🬥🬦🬧🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻
Braille = 5
Blitter mode using braille (4x2). ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿
Pixel = 6
Blitter mode using Pixels/Sixels.
_4x1 = 7
NcBlitter mode using: four vertical levels (4x1). █▆▄▂
_8x1 = 8
NcBlitter mode using: eight vertical levels (8x1). █▇▆▅▄▃▂▁
Implementations§
Source§impl NcBlitter
impl NcBlitter
Sourcepub const fn cell_height(&self) -> Option<u8>
pub const fn cell_height(&self) -> Option<u8>
The number of height subdivisions in a cell using the current blitter.
Default & Pixel returns None.
Sourcepub const fn cell_width(&self) -> Option<u8>
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§impl NcBlitter
impl NcBlitter
Sourcepub fn blit_rgba(
data: &[u8],
line_size: usize,
vopts: &NcVisualOptions,
) -> NcResult<usize>
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().
Sourcepub fn blit_bgrx(
data: &[u8],
line_size: usize,
vopts: &NcVisualOptions,
) -> NcResult<usize>
pub fn blit_bgrx( data: &[u8], line_size: usize, vopts: &NcVisualOptions, ) -> NcResult<usize>
Like blit_rgba, but for BGRx.
C style function: ncblit_bgrx().
Sourcepub fn blit_rgb_packed(
data: &[u8],
line_size: usize,
vopts: &NcVisualOptions,
alpha: u8,
) -> NcResult<usize>
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().
Sourcepub fn blit_rgb_loose(
data: &[u8],
line_size: usize,
vopts: &NcVisualOptions,
alpha: u8,
) -> NcResult<usize>
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().