Enum libnotcurses_sys::NcBlitter
source · #[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
Degradation
There is a mechanism of graceful degradation, that works as follows:
- without braille support,
Braille
decays toSextant
. - without bitmap support,
Pixel
decays toSextant
. - without sextant support,
Sextant
decays toQuadrant
. - without quadrant support,
Quadrant
decays toHalf
. - the only viable blitters in ASCII are
Ascii
andPixel
.
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
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
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().