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,

source

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)
source

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>>,

source

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()),
)?;
source§

impl<'a, F, R, GF, H> DrawBuilder<'a, F, R, GF, H, ()>where F: Font + Sync, R: Resources, GF: Factory<R>, H: BuildHasher,

source

pub fn draw<C, CV>( self, encoder: &mut Encoder<R, C>, target: &CV ) -> Result<(), String>where C: CommandBuffer<R>, CV: RawAndFormat<Raw = RawRenderTargetView<R>>,

Auto Trait Implementations§

§

impl<'a, F, R, GF, H, DV> !RefUnwindSafe for DrawBuilder<'a, F, R, GF, H, DV>

§

impl<'a, F, R, GF, H, DV> Send for DrawBuilder<'a, F, R, GF, H, DV>where DV: Sync, F: Send, GF: Send, H: Send,

§

impl<'a, F, R, GF, H, DV> Sync for DrawBuilder<'a, F, R, GF, H, DV>where DV: Sync, F: Sync, GF: Sync, H: Sync,

§

impl<'a, F, R, GF, H, DV> Unpin for DrawBuilder<'a, F, R, GF, H, DV>

§

impl<'a, F, R, GF, H, DV> !UnwindSafe for DrawBuilder<'a, F, R, GF, H, DV>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V