pub struct Vger {
pub glyph_cache: GlyphCache,
/* private fields */
}
Fields
glyph_cache: GlyphCache
Implementations
sourceimpl Vger
impl Vger
sourcepub fn new(device: &Device, texture_format: TextureFormat) -> Self
pub fn new(device: &Device, texture_format: TextureFormat) -> Self
Create a new renderer given a device and output pixel format.
sourcepub fn begin(
&mut self,
window_width: f32,
window_height: f32,
device_px_ratio: f32
)
pub fn begin(
&mut self,
window_width: f32,
window_height: f32,
device_px_ratio: f32
)
Begin rendering.
sourcepub fn encode(
&mut self,
device: &Device,
render_pass: &RenderPassDescriptor<'_, '_>,
queue: &Queue
)
pub fn encode(
&mut self,
device: &Device,
render_pass: &RenderPassDescriptor<'_, '_>,
queue: &Queue
)
Encode all rendering to a command buffer.
sourcepub fn fill_circle<Pt: Into<LocalPoint>>(
&mut self,
center: Pt,
radius: f32,
paint_index: PaintIndex
)
pub fn fill_circle<Pt: Into<LocalPoint>>(
&mut self,
center: Pt,
radius: f32,
paint_index: PaintIndex
)
Fills a circle.
sourcepub fn stroke_arc<Pt: Into<LocalPoint>>(
&mut self,
center: Pt,
radius: f32,
width: f32,
rotation: f32,
aperture: f32,
paint_index: PaintIndex
)
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.
sourcepub fn fill_rect<Rect: Into<LocalRect>>(
&mut self,
rect: Rect,
radius: f32,
paint_index: PaintIndex
)
pub fn fill_rect<Rect: Into<LocalRect>>(
&mut self,
rect: Rect,
radius: f32,
paint_index: PaintIndex
)
Fills a rectangle.
sourcepub fn stroke_rect(
&mut self,
min: LocalPoint,
max: LocalPoint,
radius: f32,
width: f32,
paint_index: PaintIndex
)
pub fn stroke_rect(
&mut self,
min: LocalPoint,
max: LocalPoint,
radius: f32,
width: f32,
paint_index: PaintIndex
)
Strokes a rectangle.
sourcepub fn stroke_segment<Pt: Into<LocalPoint>>(
&mut self,
a: Pt,
b: Pt,
width: f32,
paint_index: PaintIndex
)
pub fn stroke_segment<Pt: Into<LocalPoint>>(
&mut self,
a: Pt,
b: Pt,
width: f32,
paint_index: PaintIndex
)
Strokes a line segment.
sourcepub fn stroke_bezier<Pt: Into<LocalPoint>>(
&mut self,
a: Pt,
b: Pt,
c: Pt,
width: f32,
paint_index: PaintIndex
)
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.
sourcepub fn move_to<Pt: Into<LocalPoint>>(&mut self, p: Pt)
pub fn move_to<Pt: Into<LocalPoint>>(&mut self, p: Pt)
Move the pen to a point (path fills only)
sourcepub fn quad_to<Pt: Into<LocalPoint>>(&mut self, b: Pt, c: Pt)
pub fn quad_to<Pt: Into<LocalPoint>>(&mut self, b: Pt, c: Pt)
Makes a quadratic curve to a point (path fills only)
sourcepub fn fill(&mut self, paint_index: PaintIndex)
pub fn fill(&mut self, paint_index: PaintIndex)
Fills a path.
sourcepub fn text(&mut self, text: &str, size: u32, color: Color, max_width: Option<f32>)
pub fn text(&mut self, text: &str, size: u32, color: Color, max_width: Option<f32>)
Renders text.
sourcepub fn text_bounds(
&mut self,
text: &str,
size: u32,
max_width: Option<f32>
) -> LocalRect
pub fn text_bounds(
&mut self,
text: &str,
size: u32,
max_width: Option<f32>
) -> LocalRect
Calculates the bounds for text.
sourcepub fn glyph_positions(
&mut self,
text: &str,
size: u32,
max_width: Option<f32>
) -> Vec<LocalRect>
pub fn glyph_positions(
&mut self,
text: &str,
size: u32,
max_width: Option<f32>
) -> Vec<LocalRect>
Returns local coordinates of glyphs.
pub fn line_metrics(
&mut self,
text: &str,
size: u32,
max_width: Option<f32>
) -> Vec<LineMetrics>
sourcepub fn translate<Vec: Into<LocalVector>>(&mut self, offset: Vec)
pub fn translate<Vec: Into<LocalVector>>(&mut self, offset: Vec)
Translates the coordinate system.
sourcepub fn scale<Vec: Into<LocalVector>>(&mut self, scale: Vec)
pub fn scale<Vec: Into<LocalVector>>(&mut self, scale: Vec)
Scales the coordinate system.
sourcepub fn current_transform(&self) -> LocalToWorld
pub fn current_transform(&self) -> LocalToWorld
Gets the current transform.
sourcepub fn reset_scissor(&mut self)
pub fn reset_scissor(&mut self)
Resets the current scissor rect.
sourcepub fn color_paint(&mut self, color: Color) -> PaintIndex
pub fn color_paint(&mut self, color: Color) -> PaintIndex
Solid color paint.
sourcepub fn linear_gradient<Pt: Into<LocalPoint>>(
&mut self,
start: Pt,
end: Pt,
inner_color: Color,
outer_color: Color,
glow: f32
) -> PaintIndex
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more