Struct vger::Vger

source ·
pub struct Vger {
    pub glyph_cache: GlyphCache,
    /* private fields */
}

Fields§

§glyph_cache: GlyphCache

Implementations§

source§

impl Vger

source

pub fn new(device: &Device, texture_format: TextureFormat) -> Self

Create a new renderer given a device and output pixel format.

source

pub fn begin( &mut self, window_width: f32, window_height: f32, device_px_ratio: f32 )

Begin rendering.

source

pub fn save(&mut self)

Saves rendering state (transform and scissor rect).

source

pub fn restore(&mut self)

Restores rendering state (transform and scissor rect).

source

pub fn encode( &mut self, device: &Device, render_pass: &RenderPassDescriptor<'_, '_>, queue: &Queue )

Encode all rendering to a command buffer.

source

pub fn fill_circle<Pt: Into<LocalPoint>>( &mut self, center: Pt, radius: f32, paint_index: PaintIndex )

Fills a circle.

source

pub fn stroke_arc<Pt: Into<LocalPoint>>( &mut self, center: Pt, radius: f32, width: f32, rotation: f32, aperture: f32, paint_index: PaintIndex )

Strokes an arc.

source

pub fn fill_rect<Rect: Into<LocalRect>>( &mut self, rect: Rect, radius: f32, paint_index: PaintIndex )

Fills a rectangle.

source

pub fn stroke_rect( &mut self, min: LocalPoint, max: LocalPoint, radius: f32, width: f32, paint_index: PaintIndex )

Strokes a rectangle.

source

pub fn stroke_segment<Pt: Into<LocalPoint>>( &mut self, a: Pt, b: Pt, width: f32, paint_index: PaintIndex )

Strokes a line segment.

source

pub fn stroke_bezier<Pt: Into<LocalPoint>>( &mut self, a: Pt, b: Pt, c: Pt, width: f32, paint_index: PaintIndex )

Strokes a quadratic bezier segment.

source

pub fn move_to<Pt: Into<LocalPoint>>(&mut self, p: Pt)

Move the pen to a point (path fills only)

source

pub fn quad_to<Pt: Into<LocalPoint>>(&mut self, b: Pt, c: Pt)

Makes a quadratic curve to a point (path fills only)

source

pub fn fill(&mut self, paint_index: PaintIndex)

Fills a path.

source

pub fn text(&mut self, text: &str, size: u32, color: Color, max_width: Option<f32>)

Renders text.

source

pub fn text_bounds( &mut self, text: &str, size: u32, max_width: Option<f32> ) -> LocalRect

Calculates the bounds for text.

source

pub fn glyph_positions( &mut self, text: &str, size: u32, max_width: Option<f32> ) -> Vec<LocalRect>

Returns local coordinates of glyphs.

source

pub fn line_metrics( &mut self, text: &str, size: u32, max_width: Option<f32> ) -> Vec<LineMetrics>

source

pub fn translate<Vec: Into<LocalVector>>(&mut self, offset: Vec)

Translates the coordinate system.

source

pub fn scale<Vec: Into<LocalVector>>(&mut self, scale: Vec)

Scales the coordinate system.

source

pub fn rotate(&mut self, theta: f32)

Rotates the coordinate system.

source

pub fn current_transform(&self) -> LocalToWorld

Gets the current transform.

source

pub fn scissor(&mut self, rect: LocalRect)

Sets the current scissor rect.

source

pub fn reset_scissor(&mut self)

Resets the current scissor rect.

source

pub fn color_paint(&mut self, color: Color) -> PaintIndex

Solid color paint.

source

pub fn linear_gradient<Pt: Into<LocalPoint>>( &mut self, start: Pt, end: Pt, inner_color: Color, outer_color: Color, glow: f32 ) -> PaintIndex

Linear gradient paint.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Vger

§

impl Send for Vger

§

impl Sync for Vger

§

impl Unpin for Vger

§

impl !UnwindSafe for Vger

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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.

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<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>