# VncPixelFormat

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

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

```rust
struct VncPixelFormat
```

Describes the low-level arrangement of a framebuffer pixel.

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

## Members

- [`RGB32`](#assoc_const-rgb32)
- [`new`](#function-new)
- [`rgb32`](#function-rgb32)
- [`bits_per_pixel`](#function-bits_per_pixel)
- [`bytes_per_pixel`](#function-bytes_per_pixel)
- [`bit_depth`](#function-bit_depth)
- [`red_bits`](#function-red_bits)
- [`red_shift`](#function-red_shift)
- [`green_bits`](#function-green_bits)
- [`red_max`](#function-red_max)
- [`blue_max`](#function-blue_max)
- [`green_max`](#function-green_max)
- [`green_shift`](#function-green_shift)
- [`blue_bits`](#function-blue_bits)
- [`blue_shift`](#function-blue_shift)
- [`is_little_endian`](#function-is_little_endian)
- [`is_palettized`](#function-is_palettized)
- [`copy`](#function-copy)
- [`copy_from_framebuffer`](#function-copy_from_framebuffer)

<a id="assoc_const-rgb32"></a>

### RGB32

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

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

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

### new

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

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

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

### rgb32

```rust
fn rgb32() -> VncPixelFormat
```

Gets a `VncPixelFormat` with 8 bits of red, green and blue
channels.

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

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

### bits_per_pixel

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

Gets the number of bits used to store a pixel.

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

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

### bytes_per_pixel

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

Gets the number of bytes used to store a pixel.

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

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

### bit_depth

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

Gets the bit depth of the pixel.

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

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

### red_bits

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

Gets the number of bits used to represent red.

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

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

### red_shift

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

Gets the number of bits left the red value is shifted.

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

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

### green_bits

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

Gets the number of bits used to represent green.

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

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

### red_max

```rust
fn red_max(self: &Self) -> u16
```

Gets the maximum value of the red color.

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

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

### blue_max

```rust
fn blue_max(self: &Self) -> u16
```

Gets the maximum value of the blue color.

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

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

### green_max

```rust
fn green_max(self: &Self) -> u16
```

Gets the maximum value of the green color.

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

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

### green_shift

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

Gets the number of bits left the green value is shifted.

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

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

### blue_bits

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

Gets the number of bits used to represent blue.

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

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

### blue_shift

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

Gets the number of bits left the blue value is shifted.

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

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

### is_little_endian

```rust
fn is_little_endian(self: &Self) -> bool
```

Gets a value indicating whether the pixel is little-endian.

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

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

### is_palettized

```rust
fn is_palettized(self: &Self) -> bool
```

Gets a value indicating whether the framebuffer stores palette
indices (true) or colors (false).

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

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

### copy

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

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

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

### copy_from_framebuffer

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

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Same`
- `Clone`
- `Copy`
- `Debug`
- `Default`
- `PartialEq`
- `Eq`
- `Hash`
- `Display`
- `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/).
