Struct BitmapEvent

Source
pub struct BitmapEvent {
    pub dest_left: u16,
    pub dest_top: u16,
    pub dest_right: u16,
    pub dest_bottom: u16,
    pub width: u16,
    pub height: u16,
    pub bpp: u16,
    pub is_compress: bool,
    pub data: Vec<u8>,
}
Expand description

A bitmap event is used to notify client that it received an old school bitmap data

If bitmap is compress you can use the decompress function to handle it

Fields§

§dest_left: u16

Pixel position from left of the left top angle

§dest_top: u16

Pixel position from top of the left top angle

§dest_right: u16

Pixel position from Right of the left top angle

§dest_bottom: u16

Pixel position from Bottom of the left top angle

§width: u16

width of the bitmap buffer once decompress This can be larger than dest_right minus dest_left

§height: u16

height of the bitmap buffer once decompress This can be larger than dest_bottom minus dest_top

§bpp: u16

Bits Per Pixel

§is_compress: bool

true if bitmap buffer is compressed using RLE

§data: Vec<u8>

Bitmap data

Implementations§

Source§

impl BitmapEvent

Source

pub fn decompress(self) -> RdpResult<Vec<u8>>

Decompress a bitmap which has been encoded by the RLE algorithm

§Example
use std::net::{SocketAddr, TcpStream};
use rdp::core::client::Connector;
use rdp::core::event::RdpEvent;
let addr = "127.0.0.1:3389".parse::<SocketAddr>().unwrap();
let tcp = TcpStream::connect(&addr).unwrap();
let mut connector = Connector::new()
    .screen(800, 600)
    .credentials("domain".to_string(), "username".to_string(), "password".to_string());
let mut client = connector.connect(tcp).unwrap();
client.read(|rdp_event| {
    match rdp_event {
        RdpEvent::Bitmap(bitmap) => {
            let data = if bitmap.is_compress {
                bitmap.decompress().unwrap()
            }
            else {
                bitmap.data
            };
        }
         _ => println!("Unhandled event")
    }
}).unwrap()

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V