pub struct PixelsRenderer { /* private fields */ }Expand description
A renderer that draws the scene into a caller-owned RGBA pixel buffer on the CPU.
Implementations§
Source§impl PixelsRenderer
impl PixelsRenderer
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a renderer that draws text in the embedded default font when the
embedded-default-font feature is on, and draws no text otherwise.
Sourcepub fn with_fonts(fonts: &[&'static [u8]]) -> Self
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.
Sourcepub fn draw(&self, frame: &mut [u8], width: u32, height: u32)
pub fn draw(&self, frame: &mut [u8], width: u32, height: u32)
Draws the scene into frame, an RGBA8 buffer of width by height pixels, at one device
pixel per logical pixel.
Sourcepub fn draw_scaled(&self, frame: &mut [u8], width: u32, height: u32, scale: f32)
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.
Sourcepub fn update_picture(
&self,
picture: &mut Picture,
width: u32,
height: u32,
scale: f32,
changed: &mut Vec<PixelRect>,
)
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.
Sourcepub fn draw_picture_area(
&self,
picture: &Picture,
area: PixelRect,
pixels: &mut [u8],
)
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
impl PixelsRenderer
Sourcepub fn compose_sprites(
&self,
frame: &mut SpriteFrame,
width: u32,
height: u32,
scale: f32,
)
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
impl Default for PixelsRenderer
Source§impl Renderer for PixelsRenderer
impl Renderer for PixelsRenderer
Source§type Scene = Scene
type Scene = Scene
Source§fn attach_app_context_services(&mut self, app_context: &AppContext)
fn attach_app_context_services(&mut self, app_context: &AppContext)
Source§fn apply_installed_fonts(&mut self, app_context: &AppContext)
fn apply_installed_fonts(&mut self, app_context: &AppContext)
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 moreSource§fn rebuild_scene(
&mut self,
layout_tree: &LayoutTree,
_viewport: Size,
) -> Result<(), Self::Error>
fn rebuild_scene( &mut self, layout_tree: &LayoutTree, _viewport: Size, ) -> Result<(), Self::Error>
layout_tree for a viewport of the given size.Source§fn rebuild_scene_from_applier(
&mut self,
applier: &mut MemoryApplier,
root: NodeId,
_viewport: Size,
) -> Result<(), Self::Error>
fn rebuild_scene_from_applier( &mut self, applier: &mut MemoryApplier, root: NodeId, _viewport: Size, ) -> Result<(), Self::Error>
Source§fn update_scene_from_applier(
&mut self,
applier: &mut MemoryApplier,
root: NodeId,
_viewport: Size,
updates: SceneUpdates<'_>,
) -> Result<(), Self::Error>
fn update_scene_from_applier( &mut self, applier: &mut MemoryApplier, root: NodeId, _viewport: Size, updates: SceneUpdates<'_>, ) -> Result<(), Self::Error>
updates and refreshes the hit targets. The default
implementation rebuilds the whole scene.Source§fn update_visual_scene_from_applier(
&mut self,
applier: &mut MemoryApplier,
root: NodeId,
_viewport: Size,
updates: SceneUpdates<'_>,
) -> Result<(), Self::Error>
fn update_visual_scene_from_applier( &mut self, applier: &mut MemoryApplier, root: NodeId, _viewport: Size, updates: SceneUpdates<'_>, ) -> Result<(), Self::Error>
update_scene_from_applier.