XU XUv0.13.1
中文

#embedded/display

import: #embedded/display

counts: 1 functions, 6 methods, 1 types, 1 constants, 0 method sets

Standard library package `#embedded/display`.

const MAX_DIMENSION

XuAPI
pub const MAX_DIMENSION = 32768

Purpose

Logical coordinates and RGB565 colors are independent of the controller, bus, and wire byte order. Backends receive clipped, synchronous operations.

struct Surface#T

XuAPI
pub struct Surface#T {
    pub backend T
}

Purpose

Typed backend ownership avoids globals, erased context pointers and an escaping borrow of driver state. Only board/driver code uses backend.

Public fields

backend T
field (T)

create

XuAPI
pub fn create#T(width int, height int, backend T, fill fn($&T, &geometry.Rect, int) bool, write fn($&T, &geometry.Span, &[]int) bool) Surface#T

Purpose

Create a new file, directory, or resource.

Parameters

width int
width (int)
height int
height (int)
backend T
backend (T)
fill fn($&T, &geometry.Rect, int) bool
fill (function value; type fn($&T, &geometry.Rect, int) bool)
write fn($&T, &geometry.Span, &[]int) bool
write (function value; type fn($&T, &geometry.Span, &[]int) bool)

Returns

Surface#T — a value of this type

(&Surface#T) width

XuAPI
pub fn (surface &Surface#T) width() int

Purpose

Execute width on &Surface#T.

Parameters

surface &Surface#T
The Surface#T instance used by this call (borrow).

Returns

int — a value of this type

(&Surface#T) height

XuAPI
pub fn (surface &Surface#T) height() int

Purpose

Execute height on &Surface#T.

Parameters

surface &Surface#T
The Surface#T instance used by this call (borrow).

Returns

int — a value of this type

(&Surface#T) valid

XuAPI
pub fn (surface &Surface#T) valid() bool

Purpose

Operation on &Surface#T: whether the value is valid.

Parameters

surface &Surface#T
The Surface#T instance used by this call (borrow).

Returns

bool — true or false

($&Surface#T) fill_rect

XuAPI
pub fn (surface $&Surface#T) fill_rect(x int, y int, width int, height int, color int) bool

Purpose

Operation on $&Surface#T: fill rectangle.

Parameters

surface $&Surface#T
The Surface#T instance used by this call (exclusive borrow).
x int
value (int)
y int
value (int)
width int
width (int)
height int
height (int)
color int
color (int)

Returns

bool — true or false

($&Surface#T) clear

XuAPI
pub fn (surface $&Surface#T) clear(color int) bool

Purpose

Clear all buffered or stored entries and internal state.

Parameters

surface $&Surface#T
The Surface#T instance used by this call (exclusive borrow).
color int
color (int)

Returns

bool — true or false

($&Surface#T) write_rgb565

XuAPI
pub fn (surface $&Surface#T) write_rgb565(x int, y int, pixels &[]int, count int) bool

Purpose

One horizontal row of count logical RGB565 values (one integer per pixel). Buffers may be reused immediately after this call; a backend must not retain their borrow. Clipping adjusts the source offset without copying pixels.

Parameters

surface $&Surface#T
The Surface#T instance used by this call (exclusive borrow).
x int
value (int)
y int
value (int)
pixels &[]int
pixels (read-only borrow; caller keeps the original; type &[]int)
count int
count (int)

Returns

bool — true or false