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: GraphicIdGraphics identifier.
width: usizeWidth, in pixels, of the graphic.
height: usizeHeight, in pixels, of the graphic.
color_type: ColorTypeColor type of the pixels.
pixels: Vec<u8>Pixels data.
is_opaque: boolIndicate 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: InstantGeneration counter for cache invalidation. Incremented when image data changes (re-transmission with same ID).
Implementations§
Source§impl GraphicData
impl GraphicData
Sourcepub fn maybe_transparent(&self) -> bool
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.
Sourcepub fn is_filled(&self, x: usize, y: usize, width: usize, height: usize) -> bool
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.
Sourcepub fn compute_display_dimensions(
&self,
cell_width: usize,
cell_height: usize,
view_width: usize,
view_height: usize,
) -> (usize, usize)
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
impl Clone for GraphicData
Source§fn clone(&self) -> GraphicData
fn clone(&self) -> GraphicData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more