Struct Raster

Source
#[repr(C)]
pub struct Raster { /* private fields */ }
Expand description

Raster attributes

The " (2/2) character is the set raster attributes command.

This command selects the raster attributes for the sixel data string that follows it.

You must use the command before any sixel data string.

The " command overrides any raster attributes set by the macro parameter described above.

You use the following format for the " command:

Pan;Pad;Ph;Pv
2/2**3/11******

where:

Pan and Pad define the pixel aspect ratio for the following sixel data string. Pan is the numerator, and Pad is the denominator.

Pan
--- = pixel aspect ratio
Pad

The pixel aspect ratio defines the shape of the pixels the terminal uses to draw the sixel image.

Pan defines the vertical shape of the pixel. Pad defines the horizontal shape of the pixel. For example, to define a pixel that is twice as high as it is wide, you use a value of 2 for Pan and 1 for Pad.

If you use the set raster attributes command (“) in a sixel data string, you must specify a pixel aspect ratio. You can only use integer values for Pan and Pad. The VT300 rounds the pixel aspect ratio to the nearest integer.

Ph and Pv define the horizontal and vertical size of the image (in pixels), respectively.

Ph and Pv do not limit the size of the image defined by the sixel data. However, Ph and Pv let you omit background sixel data from the image definition and still have a color background. They also provide a concise way for the application or terminal to encode the size of an image.

NOTE: The VT300 uses Ph and Pv to erase the background when P2 is set to 0 or 2.

Implementations§

Source§

impl Raster

Source

pub const fn new() -> Self

Creates a new Raster.

Source

pub const fn create(pan: usize, pad: usize, h: usize, v: usize) -> Self

Creates a new Raster with the provided parameters.

Source

pub const fn pan(&self) -> usize

Gets the pan numerator for the pixel aspect ratio.

Source

pub fn set_pan(&mut self, val: usize)

Sets the pan numerator for the pixel aspect ratio.

Source

pub fn with_pan(self, val: usize) -> Self

Builder function that sets the pan numerator for the pixel aspect ratio.

Source

pub const fn pad(&self) -> usize

Gets the pad denominator for the pixel aspect ratio.

Source

pub fn set_pad(&mut self, val: usize)

Sets the pad denominator for the pixel aspect ratio.

Source

pub fn with_pad(self, val: usize) -> Self

Builder function that sets the pad denominator for the pixel aspect ratio.

Source

pub const fn h(&self) -> usize

Gets the horizontal size of the image.

Source

pub fn set_h(&mut self, val: usize)

Sets the horizontal size of the image.

Source

pub fn with_h(self, val: usize) -> Self

Builder function that sets the horizontal size of the image.

Source

pub const fn v(&self) -> usize

Gets the vertical size of the image.

Source

pub fn set_v(&mut self, val: usize)

Sets the vertical size of the image.

Source

pub fn with_v(self, val: usize) -> Self

Builder function that sets the vertical size of the image.

Trait Implementations§

Source§

impl Clone for Raster

Source§

fn clone(&self) -> Raster

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 Raster

Source§

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

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

impl Default for Raster

Source§

fn default() -> Raster

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

impl Display for Raster

Source§

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

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

impl PartialEq for Raster

Source§

fn eq(&self, other: &Raster) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Raster

Source§

impl StructuralPartialEq for Raster

Auto Trait Implementations§

§

impl Freeze for Raster

§

impl RefUnwindSafe for Raster

§

impl Send for Raster

§

impl Sync for Raster

§

impl Unpin for Raster

§

impl UnwindSafe for Raster

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

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

Source§

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.