Struct gfx_glyph::GlyphBrush
[−]
[src]
pub struct GlyphBrush<'a, R: Resources, F: Factory<R>> { /* fields omitted */ }
Object allowing glyph drawing, containing cache state. Manages glyph positioning cacheing, glyph draw caching & efficient GPU texture cache updating and re-sizing on demand.
Build using a GlyphBrushBuilder
.
Example
extern crate gfx_glyph; use gfx_glyph::{Section, Layout}; let section = Section { text: "Hello gfx_glyph", ..Section::default() }; glyph_brush.queue(section, &Layout::default()); glyph_brush.queue(some_other_section, &Layout::default()); glyph_brush.draw_queued(&mut gfx_encoder, &gfx_target).unwrap();
Methods
impl<'font, R: Resources, F: Factory<R>> GlyphBrush<'font, R, F>
[src]
fn pixel_bounding_box<'a, S, L>(&mut self, section: S, layout: &L) -> Rect<i32> where
L: GlyphPositioner + Hash,
S: Into<Section<'a>>,
L: GlyphPositioner + Hash,
S: Into<Section<'a>>,
Returns the pixel bounding box for the input section & layout. The box is a conservative whole number pixel rectangle that can contain the section.
fn queue<'a, S, L>(&mut self, section: S, layout: &L) where
L: GlyphPositioner,
S: Into<Section<'a>>,
L: GlyphPositioner,
S: Into<Section<'a>>,
Queues a section/layout to be drawn by the next call of
draw_queued
. Can be called multiple times
to queue multiple sections for drawing.
See Layout
for available built-in glyph positioning layouts.
fn draw_queued<C, T>(
&mut self,
encoder: &mut Encoder<R, C>,
target: &RenderTargetView<R, T>
) -> Result<(), String> where
C: CommandBuffer<R>,
T: RenderFormat,
&mut self,
encoder: &mut Encoder<R, C>,
target: &RenderTargetView<R, T>
) -> Result<(), String> where
C: CommandBuffer<R>,
T: RenderFormat,
Draws all queued sections onto a render target, applying a position transform (e.g.
a projection).
See queue
.
fn draw_queued_with_transform<C, T>(
&mut self,
transform: [[f32; 4]; 4],
encoder: &mut Encoder<R, C>,
target: &RenderTargetView<R, T>
) -> Result<(), String> where
C: CommandBuffer<R>,
T: RenderFormat,
&mut self,
transform: [[f32; 4]; 4],
encoder: &mut Encoder<R, C>,
target: &RenderTargetView<R, T>
) -> Result<(), String> where
C: CommandBuffer<R>,
T: RenderFormat,
Draws all queued sections onto a render target, applying a position transform (e.g.
a projection).
See queue
.