# VncFramebuffer

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-headless-vnc/remote_viewing/vnc/struct-vncframebuffer/

**struct** · [`ferroui-headless-vnc`](/docs/0.5.0/api/ferroui-headless-vnc/) · v0.5.0

```rust
struct VncFramebuffer
```

Stores pixel data for a VNC session.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L12)

## Members

- [`new`](#function-new)
- [`name`](#function-name)
- [`width`](#function-width)
- [`height`](#function-height)
- [`stride`](#function-stride)
- [`pixel_format`](#function-pixel_format)
- [`get_buffer`](#function-get_buffer)
- [`set_pixel`](#function-set_pixel)
- [`set_pixel_bytes`](#function-set_pixel_bytes)

<a id="function-new"></a>

### new

```rust
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`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L32)

<a id="function-name"></a>

### name

```rust
fn name(self: &Self) -> &str
```

Gets the framebuffer name. Many VNC clients set their title bar to
this name.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L63)

<a id="function-width"></a>

### width

```rust
fn width(self: &Self) -> i32
```

Gets the framebuffer width.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L68)

<a id="function-height"></a>

### height

```rust
fn height(self: &Self) -> i32
```

Gets the framebuffer height.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L73)

<a id="function-stride"></a>

### stride

```rust
fn stride(self: &Self) -> i32
```

Gets the framebuffer stride. This is the number of bytes between one
Y coordinate and the next.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L79)

<a id="function-pixel_format"></a>

### pixel_format

```rust
fn pixel_format(self: &Self) -> &VncPixelFormat
```

Gets the framebuffer pixel format.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L84)

<a id="function-get_buffer"></a>

### get_buffer

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L91)

<a id="function-set_pixel"></a>

### set_pixel

```rust
fn set_pixel(self: &Self, x: i32, y: i32, color: i32)
```

Sets the RGB `color` of a single pixel.
## Panics
As `set_pixel_bytes`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L99)

<a id="function-set_pixel_bytes"></a>

### set_pixel_bytes

```rust
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`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/vnc/vnc_framebuffer.rs#L110)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Same`
- [`IVncFramebufferSource`](/docs/0.5.0/api/ferroui-headless-vnc/remote_viewing/vnc/trait-ivncframebuffersource/)
- `Debug`
- `ErasedDestructor`
- `IntoEither`

## Availability

Extracted for `x86_64-unknown-linux-gnu`, `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
