Trait surf_n_term::image::ImageHandler
source · pub trait ImageHandler: Send + Sync {
// Required methods
fn kind(&self) -> ImageHandlerKind;
fn draw(
&mut self,
out: &mut dyn Write,
img: &Image,
pos: Position
) -> Result<(), Error>;
fn erase(
&mut self,
out: &mut dyn Write,
img: &Image,
pos: Option<Position>
) -> Result<(), Error>;
fn handle(
&mut self,
out: &mut dyn Write,
event: &TerminalEvent
) -> Result<bool, Error>;
}
Expand description
Image rendering/handling interface
Required Methods§
sourcefn kind(&self) -> ImageHandlerKind
fn kind(&self) -> ImageHandlerKind
Name
sourcefn draw(
&mut self,
out: &mut dyn Write,
img: &Image,
pos: Position
) -> Result<(), Error>
fn draw( &mut self, out: &mut dyn Write, img: &Image, pos: Position ) -> Result<(), Error>
Draw image
Send an appropriate terminal escape sequence so the image would be rendered.
sourcefn erase(
&mut self,
out: &mut dyn Write,
img: &Image,
pos: Option<Position>
) -> Result<(), Error>
fn erase( &mut self, out: &mut dyn Write, img: &Image, pos: Option<Position> ) -> Result<(), Error>
Erase image at specified position
This is needed when erasing characters is not actually removing image from the terminal. For example kitty needs to send separate escape sequence to actually erase image. If position is not specified all matching images are deleted.
Trait Implementations§
source§impl ImageHandler for Box<dyn ImageHandler>
impl ImageHandler for Box<dyn ImageHandler>
source§fn kind(&self) -> ImageHandlerKind
fn kind(&self) -> ImageHandlerKind
Name
source§fn draw(
&mut self,
out: &mut dyn Write,
img: &Image,
pos: Position
) -> Result<(), Error>
fn draw( &mut self, out: &mut dyn Write, img: &Image, pos: Position ) -> Result<(), Error>
Draw image Read more