VncFramebuffer
struct · ferroui-headless-vnc · v0.5.0
struct VncFramebuffer
Stores pixel data for a VNC session.
Members
new
fn new(name: &str, width: i32, height: i32, pixel_format: VncPixelFormat) -> Arc<VncFramebuffer>
Initializes a new instance of the VncFramebuffer class.
name is the framebuffer name (many VNC clients set their title bar
to it), width and height its size, pixel_format its pixel
format.
Panics
When the width or the height is negative
(ArgumentOutOfRangeException).
name
fn name(self: &Self) -> &str
Gets the framebuffer name. Many VNC clients set their title bar to this name.
width
fn width(self: &Self) -> i32
Gets the framebuffer width.
height
fn height(self: &Self) -> i32
Gets the framebuffer height.
stride
fn stride(self: &Self) -> i32
Gets the framebuffer stride. This is the number of bytes between one Y coordinate and the next.
pixel_format
fn pixel_format(self: &Self) -> &VncPixelFormat
Gets the framebuffer pixel format.
get_buffer
fn get_buffer(self: &Self) -> MutexGuard<'_, Vec<u8>>
Returns the memory underlying this framebuffer, locked: the lock of
SyncRoot of the original, held as long as the guard lives. Hold it
while reading the framebuffer to avoid tearing artifacts.
set_pixel
fn set_pixel(self: &Self, x: i32, y: i32, color: i32)
Sets the RGB color of a single pixel.
Panics
As set_pixel_bytes.
set_pixel_bytes
fn set_pixel_bytes(self: &Self, x: i32, y: i32, color: &[u8])
Sets the color of a single pixel: color is the pixel color as a
byte-encoded integer.
Panics
When the pixel is outside the framebuffer
(ArgumentOutOfRangeException) or the pixel format is not of four
bytes (NotSupportedException).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsSameIVncFramebufferSourceDebugErasedDestructorIntoEither
Availability
Extracted for x86_64-unknown-linux-gnu, aarch64-apple-darwin. Cargo features are listed in the crate index.