VncPixelFormat
struct · ferroui-headless-vnc · v0.5.0
struct VncPixelFormat
Describes the low-level arrangement of a framebuffer pixel.
Members
RGB32newrgb32bits_per_pixelbytes_per_pixelbit_depthred_bitsred_shiftgreen_bitsred_maxblue_maxgreen_maxgreen_shiftblue_bitsblue_shiftis_little_endianis_palettizedcopycopy_from_framebuffer
RGB32
const RGB32: VncPixelFormat
A VncPixelFormat with 8 bits of red, green and blue channels: 32
bits a pixel, little-endian, red shifted by 16, green by 8, blue by
0 (in memory: blue, green, red, unused).
new
fn new(bits_per_pixel: i32, bit_depth: i32, red_bits: i32, red_shift: i32, green_bits: i32, green_shift: i32, blue_bits: i32, blue_shift: i32, is_little_endian: bool, is_palettized: bool) -> Self
Initializes a new instance of the VncPixelFormat class.
bits_per_pixel is the number of bits used to store a pixel
(currently 8, 16, or 32); bit_depth the bit depth of the pixel
(currently 6 or 24); the bits and shifts of each colour say how many
bits represent it and how many bits left its value is shifted.
Panics
When a value is out of its range (ArgumentOutOfRangeException).
rgb32
fn rgb32() -> VncPixelFormat
Gets a VncPixelFormat with 8 bits of red, green and blue
channels.
bits_per_pixel
fn bits_per_pixel(self: &Self) -> i32
Gets the number of bits used to store a pixel.
bytes_per_pixel
fn bytes_per_pixel(self: &Self) -> i32
Gets the number of bytes used to store a pixel.
bit_depth
fn bit_depth(self: &Self) -> i32
Gets the bit depth of the pixel.
red_bits
fn red_bits(self: &Self) -> i32
Gets the number of bits used to represent red.
red_shift
fn red_shift(self: &Self) -> i32
Gets the number of bits left the red value is shifted.
green_bits
fn green_bits(self: &Self) -> i32
Gets the number of bits used to represent green.
red_max
fn red_max(self: &Self) -> u16
Gets the maximum value of the red color.
blue_max
fn blue_max(self: &Self) -> u16
Gets the maximum value of the blue color.
green_max
fn green_max(self: &Self) -> u16
Gets the maximum value of the green color.
green_shift
fn green_shift(self: &Self) -> i32
Gets the number of bits left the green value is shifted.
blue_bits
fn blue_bits(self: &Self) -> i32
Gets the number of bits used to represent blue.
blue_shift
fn blue_shift(self: &Self) -> i32
Gets the number of bits left the blue value is shifted.
is_little_endian
fn is_little_endian(self: &Self) -> bool
Gets a value indicating whether the pixel is little-endian.
is_palettized
fn is_palettized(self: &Self) -> bool
Gets a value indicating whether the framebuffer stores palette indices (true) or colors (false).
copy
fn copy(source: &[u8], source_width: i32, source_stride: i32, source_format: &VncPixelFormat, source_rectangle: VncRectangle, target: &mut [u8], target_width: i32, target_stride: i32, target_format: &VncPixelFormat, target_x: i32, target_y: i32)
Copies pixels between two byte arrays. A format conversion is performed if necessary (between formats of true colour; a target of another format is left as it is).
Be sure to lock the framebuffer first to avoid tearing, if the connection is active.
source holds the source image (source_width pixels wide,
source_stride bytes between one Y coordinate and the next, in
source_format); source_rectangle is the rectangle of it to copy.
target holds the target image in the same terms; target_x and
target_y are where in it the upper-left pixel goes.
copy_from_framebuffer
fn copy_from_framebuffer(source: &VncFramebuffer, source_rectangle: VncRectangle, target: &mut [u8], stride: i32, target_x: i32, target_y: i32)
Copies a region of the framebuffer into a bitmap of the default
format (RGB32) whose rows are stride bytes apart;
target_x and target_y are where the upper-left pixel goes.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringResourceKeyObjectPropertyValueAnyValueClassDefaultsSameCloneCopyDebugDefaultPartialEqEqHashDisplayErasedDestructorIntoEither
Availability
Extracted for x86_64-unknown-linux-gnu, aarch64-apple-darwin. Cargo features are listed in the crate index.