Skip to main content

GraphicData

Struct GraphicData 

Source
pub struct GraphicData {
    pub id: GraphicId,
    pub width: usize,
    pub height: usize,
    pub color_type: ColorType,
    pub pixels: Vec<u8>,
    pub is_opaque: bool,
    pub resize: Option<ResizeCommand>,
    pub display_width: Option<usize>,
    pub display_height: Option<usize>,
    pub transmit_time: Instant,
}
Expand description

Defines a single graphic read from the PTY.

Fields§

§id: GraphicId

Graphics identifier.

§width: usize

Width, in pixels, of the graphic.

§height: usize

Height, in pixels, of the graphic.

§color_type: ColorType

Color type of the pixels.

§pixels: Vec<u8>

Pixels data.

§is_opaque: bool

Indicate if there are no transparent pixels.

§resize: Option<ResizeCommand>

Render graphic in a different size.

§display_width: Option<usize>

Display width in pixels (set when GPU scaling is used instead of CPU resize). If None, display at the original pixel width.

§display_height: Option<usize>

Display height in pixels (set when GPU scaling is used instead of CPU resize). If None, display at the original pixel height.

§transmit_time: Instant

Generation counter for cache invalidation. Incremented when image data changes (re-transmission with same ID).

Implementations§

Source§

impl GraphicData

Source

pub fn maybe_transparent(&self) -> bool

Check if the image may contain transparent pixels. If it returns false, it is guaranteed that there are no transparent pixels.

Source

pub fn is_filled(&self, x: usize, y: usize, width: usize, height: usize) -> bool

Check if all pixels under a region are opaque.

If the region exceeds the boundaries of the image it is considered as not filled.

Source

pub fn compute_display_dimensions( &self, cell_width: usize, cell_height: usize, view_width: usize, view_height: usize, ) -> (usize, usize)

Compute the display dimensions for this graphic without modifying pixels. Returns (display_width, display_height) in pixels. If no resize is needed, returns the original dimensions.

Trait Implementations§

Source§

impl Clone for GraphicData

Source§

fn clone(&self) -> GraphicData

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GraphicData

Source§

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

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

impl Eq for GraphicData

Source§

impl PartialEq for GraphicData

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GraphicData

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