Skip to main content

PixelsRenderer

Struct PixelsRenderer 

Source
pub struct PixelsRenderer { /* private fields */ }

Implementations§

Source§

impl PixelsRenderer

Source

pub fn new() -> Self

Source

pub fn with_fonts(fonts: &[&'static [u8]]) -> Self

A renderer that draws text in fonts. With none that parses, it uses the embedded default font when the embedded-default-font feature is on, and draws no text otherwise.

Source

pub fn draw(&self, frame: &mut [u8], width: u32, height: u32)

Source

pub fn draw_scaled(&self, frame: &mut [u8], width: u32, height: u32, scale: f32)

Rasterizes logical scene coordinates at scale device pixels per point. Hit regions stay in logical coordinates. Invalid scales use 1.0.

Source

pub fn update_picture( &self, picture: &mut Picture, width: u32, height: u32, scale: f32, changed: &mut Vec<PixelRect>, )

Moves picture to the current scene, drawn width by height device pixels at scale device pixels per point, and puts into changed the areas whose pixels differ from the picture it held: the whole frame the first time and after a change of size or scale. Invalid scales use 1.0.

Source

pub fn draw_picture_area( &self, picture: &Picture, area: PixelRect, pixels: &mut [u8], )

Draws area of picture into pixels as straight-alpha RGBA8 rows of area.width pixels, area.height of them. Draws nothing before the first Self::update_picture or when pixels is shorter than the area.

Source§

impl PixelsRenderer

Source

pub fn compose_sprites( &self, frame: &mut SpriteFrame, width: u32, height: u32, scale: f32, )

The scene at scale device pixels per point as sprites for a GPU compositor, into frame, which keeps its textures from the frames before. Invalid scales use 1.0.

Trait Implementations§

Source§

impl Default for PixelsRenderer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Renderer for PixelsRenderer

Source§

type Scene = Scene

Source§

type Error = PixelsRendererError

Source§

fn attach_app_context_services(&mut self, app_context: &AppContext)

Installs renderer-provided app services into the target AppContext. Read more
Source§

fn apply_installed_fonts(&mut self, app_context: &AppContext)

Takes in the fonts installed since the renderer last looked (see installed_fonts::install_font_file). A renderer that installed the app’s text measurer installs one with the new faces, so text lays out again with them. Read more
Source§

fn scene(&self) -> &Self::Scene

Source§

fn scene_mut(&mut self) -> &mut Self::Scene

Source§

fn rebuild_scene( &mut self, layout_tree: &LayoutTree, _viewport: Size, ) -> Result<(), Self::Error>

Source§

fn rebuild_scene_from_applier( &mut self, applier: &mut MemoryApplier, root: NodeId, _viewport: Size, ) -> Result<(), Self::Error>

Rebuilds the scene by traversing the LayoutNode tree directly via Applier. Read more
Source§

fn update_scene_from_applier( &mut self, applier: &mut MemoryApplier, root: NodeId, _viewport: Size, updates: SceneUpdates<'_>, ) -> Result<(), Self::Error>

Source§

fn update_visual_scene_from_applier( &mut self, applier: &mut MemoryApplier, root: NodeId, _viewport: Size, updates: SceneUpdates<'_>, ) -> Result<(), Self::Error>

Source§

fn set_root_scale(&mut self, _scale: f32)

Sets how many device pixels the renderer draws for one logical unit. Read more
Source§

fn draw_dev_overlay(&mut self, _text: &str, _viewport: Size)

Draw a development overlay (e.g., FPS counter) on top of the scene. Read more
Source§

fn set_inspector_overlay(&mut self, _graph: Option<RenderGraph>)

Replaces the developer inspector graph outside the application scene. Read more
Source§

fn needs_frame_warmup(&self) -> bool

Returns whether renderer-side cache materialization needs a visible follow-up frame.
Source§

fn awaits_pipelines(&self) -> bool

Returns whether the last frame drew a placeholder for an effect whose pipelines are still compiling, so its picture is not final yet; the renderer asks for the frame that replaces it once they land.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.