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
impl BitmapEvent
Sourcepub fn decompress(self) -> RdpResult<Vec<u8>>
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§
impl Freeze for BitmapEvent
impl RefUnwindSafe for BitmapEvent
impl Send for BitmapEvent
impl Sync for BitmapEvent
impl Unpin for BitmapEvent
impl UnwindSafe for BitmapEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more