⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

GlCompositor

Struct GlCompositor 

Source
pub struct GlCompositor { /* private fields */ }
Expand description

GPU-style compositor that manages surfaces and composites them to a back buffer.

Implementations§

Source§

impl GlCompositor

Source

pub fn new(viewport_width: u32, viewport_height: u32) -> Self

Create a new compositor with the given viewport dimensions.

Source

pub fn set_clear_color(&mut self, color: u32)

Set the background clear colour.

Source

pub fn width(&self) -> u32

Viewport width.

Source

pub fn height(&self) -> u32

Viewport height.

Source

pub fn surface_count(&self) -> usize

Number of registered surfaces.

Source

pub fn create_surface(&mut self, width: u32, height: u32) -> Option<SurfaceId>

Create a new surface with the given dimensions.

Returns the surface ID, or None if the atlas is full.

Source

pub fn destroy_surface(&mut self, id: SurfaceId) -> bool

Destroy a surface and free its atlas region.

Source

pub fn update_surface(&mut self, id: SurfaceId, pixels: &[u32]) -> bool

Update a surface’s pixel data.

pixels must be exactly width * height ARGB8888 values.

Source

pub fn set_surface_position(&mut self, id: SurfaceId, x: i32, y: i32)

Set a surface’s position.

Source

pub fn set_surface_z_order(&mut self, id: SurfaceId, z: i32)

Set a surface’s z-order.

Source

pub fn set_surface_visible(&mut self, id: SurfaceId, visible: bool)

Set a surface’s visibility.

Source

pub fn set_surface_opacity(&mut self, id: SurfaceId, opacity: u8)

Set a surface’s opacity.

Source

pub fn composite(&mut self)

Composite all visible surfaces to the back buffer.

Surfaces are drawn in z-order (lowest first). The back buffer is cleared before compositing.

Source

pub fn present(&self) -> &[u32]

Return a reference to the composited back buffer.

Source

pub fn get_surface(&self, id: SurfaceId) -> Option<&GlSurface>

Get a surface by ID.

Source

pub fn get_surface_mut(&mut self, id: SurfaceId) -> Option<&mut GlSurface>

Get a mutable reference to a surface by ID.

Trait Implementations§

Source§

impl Debug for GlCompositor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for GlCompositor

§

impl RefUnwindSafe for GlCompositor

§

impl Send for GlCompositor

§

impl Sync for GlCompositor

§

impl Unpin for GlCompositor

§

impl UnwindSafe for GlCompositor

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.