Struct luminance_glyph::GlyphBrush
source · pub struct GlyphBrush<B, F = FontArc, H = DefaultSectionHasher>where
B: GlyphBrushBackend,{ /* private fields */ }
Expand description
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
.
Implementations§
source§impl<B, F: Font, H: BuildHasher> GlyphBrush<B, F, H>where
B: GlyphBrushBackend,
impl<B, F: Font, H: BuildHasher> GlyphBrush<B, F, H>where
B: GlyphBrushBackend,
sourcepub fn queue<'a, S>(&mut self, section: S)where
S: Into<Cow<'a, Section<'a>>>,
pub fn queue<'a, S>(&mut self, section: S)where
S: Into<Cow<'a, 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.
Benefits from caching, see caching behaviour.
sourcepub fn queue_custom_layout<'a, S, G>(&mut self, section: S, custom_layout: &G)where
G: GlyphPositioner,
S: Into<Cow<'a, Section<'a>>>,
pub fn queue_custom_layout<'a, S, G>(&mut self, section: S, custom_layout: &G)where
G: GlyphPositioner,
S: Into<Cow<'a, 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.
Used to provide custom GlyphPositioner
logic, if using built-in
Layout
simply use
queue
Benefits from caching, see caching behaviour.
sourcepub fn queue_pre_positioned(
&mut self,
glyphs: Vec<SectionGlyph>,
extra: Vec<Extra>,
bounds: Rect
)
pub fn queue_pre_positioned(
&mut self,
glyphs: Vec<SectionGlyph>,
extra: Vec<Extra>,
bounds: Rect
)
Queues pre-positioned glyphs to be processed by the next call of
draw_queued
. Can be
called multiple times.
sourcepub fn keep_cached_custom_layout<'a, S, G>(
&mut self,
section: S,
custom_layout: &G
)where
S: Into<Cow<'a, Section<'a>>>,
G: GlyphPositioner,
pub fn keep_cached_custom_layout<'a, S, G>(
&mut self,
section: S,
custom_layout: &G
)where
S: Into<Cow<'a, Section<'a>>>,
G: GlyphPositioner,
Retains the section in the cache as if it had been used in the last draw-frame.
Should not be necessary unless using multiple draws per frame with distinct transforms, see caching behaviour.
sourcepub fn keep_cached<'a, S>(&mut self, section: S)where
S: Into<Cow<'a, Section<'a>>>,
pub fn keep_cached<'a, S>(&mut self, section: S)where
S: Into<Cow<'a, Section<'a>>>,
Retains the section in the cache as if it had been used in the last draw-frame.
Should not be necessary unless using multiple draws per frame with distinct transforms, see caching behaviour.
source§impl<B, F: Font + Sync, H: BuildHasher> GlyphBrush<B, F, H>where
B: GlyphBrushBackend,
impl<B, F: Font + Sync, H: BuildHasher> GlyphBrush<B, F, H>where
B: GlyphBrushBackend,
sourcepub fn draw_queued<'a>(
&mut self,
pipeline: &mut LuminancePipeline<'a, B>,
shading_gate: &mut ShadingGate<'a, B>,
target_width: u32,
target_height: u32
) -> Result<(), PipelineError>
pub fn draw_queued<'a>(
&mut self,
pipeline: &mut LuminancePipeline<'a, B>,
shading_gate: &mut ShadingGate<'a, B>,
target_width: u32,
target_height: u32
) -> Result<(), PipelineError>
Draws all queued sections onto a render target.
See queue
.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
sourcepub fn draw_queued_with_transform<'a>(
&mut self,
pipeline: &mut LuminancePipeline<'a, B>,
shading_gate: &mut ShadingGate<'a, B>,
transform: [f32; 16]
) -> Result<(), PipelineError>
pub fn draw_queued_with_transform<'a>(
&mut self,
pipeline: &mut LuminancePipeline<'a, B>,
shading_gate: &mut ShadingGate<'a, B>,
transform: [f32; 16]
) -> Result<(), PipelineError>
Draws all queued sections onto a render target, applying a position
transform (e.g. a projection).
See queue
.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
sourcepub fn draw_queued_with_transform_and_scissoring<'a>(
&mut self,
pipeline: &mut LuminancePipeline<'a, B>,
shading_gate: &mut ShadingGate<'a, B>,
transform: [f32; 16],
region: Region
) -> Result<(), PipelineError>
pub fn draw_queued_with_transform_and_scissoring<'a>(
&mut self,
pipeline: &mut LuminancePipeline<'a, B>,
shading_gate: &mut ShadingGate<'a, B>,
transform: [f32; 16],
region: Region
) -> Result<(), PipelineError>
Draws all queued sections onto a render target, applying a position
transform (e.g. a projection) and a scissoring region.
See queue
.
Trims the cache, see caching behaviour.
Panics
Panics if the provided target
has a texture format that does not match
the render_format
provided on creation of the GlyphBrush
.
pub fn process_queued<C>(&mut self, context: &mut C)where
C: GraphicsContext<Backend = B>,
pub fn process_queued_with_vertex_constructor<C>(
&mut self,
context: &mut C,
into_vertex: impl Fn(GlyphVertex<'_>) -> Instance
)where
C: GraphicsContext<Backend = B>,
Trait Implementations§
source§impl<B, F, H> Debug for GlyphBrush<B, F, H>where
B: GlyphBrushBackend,
impl<B, F, H> Debug for GlyphBrush<B, F, H>where
B: GlyphBrushBackend,
source§impl<B, F: Font, H: BuildHasher> GlyphCruncher<F, Extra> for GlyphBrush<B, F, H>where
B: GlyphBrushBackend,
impl<B, F: Font, H: BuildHasher> GlyphCruncher<F, Extra> for GlyphBrush<B, F, H>where
B: GlyphBrushBackend,
source§fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b>where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a>>>,
fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b>where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a>>>,
PositionedGlyph
s of the given section with a custom layout. Read more