Struct DeviceControlString

Source
pub struct DeviceControlString { /* private fields */ }
Expand description

Device Control String

The format for the device control string is as follows.

DCSP1;P2;P3;qs..sST
9/0**3/11****7/1***9/12

where:

  • DCS is a C1 control character that introduces the sixel data sequence. You can also express DCS as the 7-bit escape sequence ESC P for a 7-bit environment.
  • P1 is the macro parameter. This parameter indicates the pixel aspect ratio used by the application or terminal. The pixel aspect ratio defines the shape of the pixel dots the terminal uses to draw images. For example, a pixel that is twice as high as it is wide has as aspect ratio of 2:1. The following list shows the values you can use for P1.
  • ; is a semicolon (3/11). This character separates numeric parameters in a DCS string.
  • P2 selects how the terminal draws the background color. You can use one of three values.
  • P3 is the horizontal grid size parameter. The horizontal grid size is the horizontal distance between two pixel dots. The VT300 ignores this parameter because the horizontal grid size is fixed at 0.0195 cm (0.0075 in).
  • q indicates that this device control string is a sixel command.
  • s…s is the sixel-encoded data string. The sixel data characters are characters in the range of ? (hex 3F) to ~ (hex 7E). Each sixel data character represents six vertical pixels of data. Each sixel data character represents a binary value equal to the character code value minus hex 3F.
  • ST is the string terminator. ST is a C1 control character. You can also express ST as the 7-bit escape sequence ESC \ for a 7-bit environment (DcsMode::SevenBit).

s..s sixel encoding is typically preceded by color map definitions. This is useful for using the BasicColor selector sequence in the sixel data.

See ColorIntroducer for more details.

Implementations§

Source§

impl DeviceControlString

Source

pub const fn new() -> Self

Creates a new DeviceControlString.

Source

pub const fn mode(&self) -> DcsMode

Gets the DcsMode selector.

Source

pub fn set_mode(&mut self, mode: DcsMode)

Sets the DcsMode selector.

Source

pub fn with_mode(self, mode: DcsMode) -> Self

Builder function that sets the DcsMode selector.

Source

pub const fn ratio(&self) -> PixelAspectRatio

Gets the PixelAspectRatio selector.

Source

pub fn set_ratio(&mut self, ratio: PixelAspectRatio)

Sets the PixelAspectRatio selector.

Source

pub fn with_ratio(self, ratio: PixelAspectRatio) -> Self

Builder function that sets the PixelAspectRatio selector.

Source

pub const fn background_color(&self) -> DcsBackground

Gets the DcsBackground selector.

Source

pub fn set_background_color(&mut self, background_color: DcsBackground)

Sets the DcsBackground selector.

Source

pub fn with_background_color(self, background_color: DcsBackground) -> Self

Builder function that sets the DcsBackground selector.

Source

pub const fn raster(&self) -> Raster

Gets the Raster attributes.

Source

pub fn set_raster(&mut self, raster: Raster)

Sets the Raster attributes.

Source

pub fn with_raster(self, raster: Raster) -> Self

Builder function that sets the Raster attributes.

Source

pub const fn color_map(&self) -> &ColorMap

Gets the ColorMap.

Source

pub fn set_color_map(&mut self, color_map: ColorMap)

Sets the ColorMap.

Source

pub fn with_color_map(self, color_map: ColorMap) -> Self

Builder function that sets the ColorMap.

Source

pub fn sixel_data(&self) -> &[SixelItem]

Gets the SixelItem list.

Source

pub fn set_sixel_data<S: Into<Vec<SixelItem>>>(&mut self, sixel_data: S)

Sets the SixelItem list.

Source

pub fn with_sixel_data<S: Into<Vec<SixelItem>>>(self, sixel_data: S) -> Self

Builder function that sets the SixelItem list.

Source

pub fn from_rgb( pixels: &mut [u8], width: usize, height: usize, diffuse_method: MethodForDiffuse, ) -> Result<Self>

Converts RGB pixel data into DeviceControlString.

Trait Implementations§

Source§

impl Display for DeviceControlString

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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