Struct gfx_glyph::DrawBuilder
source · pub struct DrawBuilder<'a, F, R: Resources, GF: Factory<R>, H, DV> { /* private fields */ }
Expand description
Short-lived builder for drawing glyphs, constructed from GlyphBrush::use_queue
.
Example
glyph_brush
.use_queue()
.depth_target(&gfx_depth)
.draw(&mut gfx_encoder, &gfx_color)?;
Implementations§
source§impl<'a, F, R, GF, H, DV> DrawBuilder<'a, F, R, GF, H, DV>where
F: Font,
R: Resources,
GF: Factory<R>,
H: BuildHasher,
impl<'a, F, R, GF, H, DV> DrawBuilder<'a, F, R, GF, H, DV>where F: Font, R: Resources, GF: Factory<R>, H: BuildHasher,
sourcepub fn transform<M: Into<[[f32; 4]; 4]>>(self, transform: M) -> Self
pub fn transform<M: Into<[[f32; 4]; 4]>>(self, transform: M) -> Self
Use a custom position transform (e.g. a projection) replacing the default_transform
.
Example
let projection = gfx_glyph::default_transform(&gfx_color);
glyph_brush.use_queue().transform(projection)
sourcepub fn depth_target<D>(self, depth: &'a D) -> DrawBuilder<'a, F, R, GF, H, D>
pub fn depth_target<D>(self, depth: &'a D) -> DrawBuilder<'a, F, R, GF, H, D>
Set a depth buffer target to perform depth testing against.
Example
glyph_brush.use_queue().depth_target(&gfx_depth)
Raw usage
Can also be used with gfx raw depth views if necessary. The Format
must also be provided.
glyph_brush
.use_queue()
.depth_target(&(raw_depth_view, format::Depth::get_format()))
source§impl<'a, F, R, GF, H, DV> DrawBuilder<'a, F, R, GF, H, DV>where
F: Font + Sync,
R: Resources,
GF: Factory<R>,
H: BuildHasher,
DV: RawAndFormat<Raw = RawDepthStencilView<R>>,
impl<'a, F, R, GF, H, DV> DrawBuilder<'a, F, R, GF, H, DV>where F: Font + Sync, R: Resources, GF: Factory<R>, H: BuildHasher, DV: RawAndFormat<Raw = RawDepthStencilView<R>>,
sourcepub fn draw<C, CV>(
self,
encoder: &mut Encoder<R, C>,
target: &CV
) -> Result<(), String>where
C: CommandBuffer<R>,
CV: RawAndFormat<Raw = RawRenderTargetView<R>>,
pub fn draw<C, CV>( self, encoder: &mut Encoder<R, C>, target: &CV ) -> Result<(), String>where C: CommandBuffer<R>, CV: RawAndFormat<Raw = RawRenderTargetView<R>>,
Draws all queued sections onto a render target.
See queue
.
Trims the cache, see caching behaviour.
Example
glyph_brush.use_queue().draw(&mut gfx_encoder, &gfx_color)?;
Raw usage
Can also be used with gfx raw render views if necessary. The Format
must also be provided.
glyph_brush.use_queue().draw(
&mut gfx_encoder,
&(raw_render_view, format::Srgba8::get_format()),
)?;