pub struct DeviceControlString { /* private fields */ }
Expand description
Device Control String
The format for the device control string is as follows.
DCS | P1 | ; | P2; | P3; | q | s..s | ST |
---|---|---|---|---|---|---|---|
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
impl DeviceControlString
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new DeviceControlString.
Sourcepub const fn ratio(&self) -> PixelAspectRatio
pub const fn ratio(&self) -> PixelAspectRatio
Gets the PixelAspectRatio selector.
Sourcepub fn set_ratio(&mut self, ratio: PixelAspectRatio)
pub fn set_ratio(&mut self, ratio: PixelAspectRatio)
Sets the PixelAspectRatio selector.
Sourcepub fn with_ratio(self, ratio: PixelAspectRatio) -> Self
pub fn with_ratio(self, ratio: PixelAspectRatio) -> Self
Builder function that sets the PixelAspectRatio selector.
Sourcepub const fn background_color(&self) -> DcsBackground
pub const fn background_color(&self) -> DcsBackground
Gets the DcsBackground selector.
Sourcepub fn set_background_color(&mut self, background_color: DcsBackground)
pub fn set_background_color(&mut self, background_color: DcsBackground)
Sets the DcsBackground selector.
Sourcepub fn with_background_color(self, background_color: DcsBackground) -> Self
pub fn with_background_color(self, background_color: DcsBackground) -> Self
Builder function that sets the DcsBackground selector.
Sourcepub fn set_raster(&mut self, raster: Raster)
pub fn set_raster(&mut self, raster: Raster)
Sets the Raster attributes.
Sourcepub fn with_raster(self, raster: Raster) -> Self
pub fn with_raster(self, raster: Raster) -> Self
Builder function that sets the Raster attributes.
Sourcepub fn set_color_map(&mut self, color_map: ColorMap)
pub fn set_color_map(&mut self, color_map: ColorMap)
Sets the ColorMap.
Sourcepub fn with_color_map(self, color_map: ColorMap) -> Self
pub fn with_color_map(self, color_map: ColorMap) -> Self
Builder function that sets the ColorMap.
Sourcepub fn sixel_data(&self) -> &[SixelItem]
pub fn sixel_data(&self) -> &[SixelItem]
Gets the SixelItem list.
Sourcepub fn set_sixel_data<S: Into<Vec<SixelItem>>>(&mut self, sixel_data: S)
pub fn set_sixel_data<S: Into<Vec<SixelItem>>>(&mut self, sixel_data: S)
Sets the SixelItem list.
Sourcepub fn with_sixel_data<S: Into<Vec<SixelItem>>>(self, sixel_data: S) -> Self
pub fn with_sixel_data<S: Into<Vec<SixelItem>>>(self, sixel_data: S) -> Self
Builder function that sets the SixelItem list.
Sourcepub fn from_rgb(
pixels: &mut [u8],
width: usize,
height: usize,
diffuse_method: MethodForDiffuse,
) -> Result<Self>
pub fn from_rgb( pixels: &mut [u8], width: usize, height: usize, diffuse_method: MethodForDiffuse, ) -> Result<Self>
Converts RGB pixel data into DeviceControlString.