# ILockedFramebuffer

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/platform/trait-ilockedframebuffer/

**trait** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
trait ILockedFramebuffer
```

A locked framebuffer: a block of pixel memory that can be read and
written until it is disposed, at which point its content is presented or
committed.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L7)

## Members

- [`address`](#function-address)
- [`with_data`](#function-with_data)
- [`size`](#function-size)
- [`row_bytes`](#function-row_bytes)
- [`dpi`](#function-dpi)
- [`format`](#function-format)
- [`alpha_format`](#function-alpha_format)
- [`dispose`](#function-dispose)

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

### address

```rust
fn address(self: &Self) -> *mut u8
```

The address of the first pixel.

The memory is `row_bytes() * size().height` bytes long and stays valid
until `dispose` is called.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L12)

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

### with_data

```rust
fn with_data(self: &Self, access: &mut dyn FnMut(&mut [u8]) -> ())
```

Gives `access` the pixel memory as a slice of
`row_bytes() * size().height` bytes.

This is the safe counterpart of `address`. The
framebuffer must not be accessed again from within `access`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L19)

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

### size

```rust
fn size(self: &Self) -> PixelSize
```

The framebuffer size in device pixels.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L22)

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

### row_bytes

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

The number of bytes per row.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L25)

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

### dpi

```rust
fn dpi(self: &Self) -> Vector
```

The DPI of the underlying screen.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L28)

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

### format

```rust
fn format(self: &Self) -> PixelFormat
```

The pixel format.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L31)

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

### alpha_format

```rust
fn alpha_format(self: &Self) -> AlphaFormat
```

The alpha format.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L34)

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

### dispose

```rust
fn dispose(self: &Self)
```

Unlocks the framebuffer.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_locked_framebuffer.rs#L37)

## Availability

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