pub struct Context<R: RendererDevice> { /* private fields */ }Implementations§
Source§impl<R: RendererDevice> Context<R>
impl<R: RendererDevice> Context<R>
pub fn create(renderer: R) -> Result<Context<R>>
pub fn renderer(&self) -> &R
pub fn renderer_mut(&mut self) -> &mut R
pub fn resize(&mut self, width: u32, height: u32) -> Result<()>
pub fn clear(&mut self, color: Color) -> Result<()>
pub fn begin_frame<E: Into<Extent>>( &mut self, window_extent: E, device_pixel_ratio: f32, ) -> Result<()>
pub fn cancel_frame(&mut self) -> Result<()>
pub fn end_frame(&mut self) -> Result<()>
pub fn save(&mut self)
pub fn restore(&mut self)
pub fn reset(&mut self)
pub fn shape_antialias(&mut self, enabled: bool)
pub fn stroke_width(&mut self, width: f32)
pub fn miter_limit(&mut self, limit: f32)
pub fn line_cap(&mut self, cap: LineCap)
pub fn line_join(&mut self, join: LineJoin)
pub fn global_alpha(&mut self, alpha: f32)
pub fn transform(&mut self, xform: Transform)
pub fn reset_transform(&mut self)
pub fn translate(&mut self, tx: f32, ty: f32)
pub fn rotate(&mut self, angle: f32)
pub fn skew_x(&mut self, angle: f32)
pub fn skew_y(&mut self, angle: f32)
pub fn scale(&mut self, sx: f32, sy: f32)
pub fn current_transform(&mut self) -> Transform
pub fn stroke_paint<T: Into<PaintPattern>>(&mut self, paint: T)
pub fn fill_paint<T: Into<PaintPattern>>(&mut self, paint: T)
pub fn fill_type(&mut self, fill_type: PathFillType)
pub fn scissor<T: Into<Rect>>(&mut self, rect: T)
pub fn intersect_scissor<T: Into<Rect>>(&mut self, rect: T)
pub fn reset_scissor(&mut self)
pub fn global_composite_operation(&mut self, op: CompositeOperation)
Source§impl<R: RenderFrameBufferDevice> Context<R>
impl<R: RenderFrameBufferDevice> Context<R>
Source§impl<R: RendererDevice> Context<R>
impl<R: RendererDevice> Context<R>
pub fn create_font_from_file<N: Into<String>, P: AsRef<Path>>( &mut self, name: N, path: P, ) -> Result<FontId>
pub fn create_font<N: Into<String>, D: Into<Vec<u8>>>( &mut self, name: N, data: D, ) -> Result<FontId>
pub fn find_font<N: AsRef<str>>(&self, name: N) -> Option<FontId>
pub fn add_fallback_fontid(&mut self, base: FontId, fallback: FontId)
pub fn add_fallback_font<N1: AsRef<str>, N2: AsRef<str>>( &mut self, base: N1, fallback: N2, )
pub fn font_size(&mut self, size: f32)
pub fn text_letter_spacing(&mut self, spacing: f32)
pub fn text_line_height(&mut self, line_height: f32)
pub fn text_align(&mut self, align: Align)
pub fn fontid(&mut self, id: FontId)
pub fn font<N: AsRef<str>>(&mut self, name: N)
pub fn text<S: AsRef<str>, P: Into<Point>>( &mut self, pt: P, text: S, ) -> Result<()>
pub fn text_metrics(&self) -> TextMetrics
pub fn text_size<S: AsRef<str>>(&self, text: S) -> Extent
Source§impl<R: RendererDevice> Context<R>
impl<R: RendererDevice> Context<R>
pub fn create_image_init<D: AsRef<[u8]>>( &mut self, flags: ImageFlags, data: D, ) -> Result<ImageId>
pub fn create_image_from_file<P: AsRef<Path>>( &mut self, flags: ImageFlags, path: P, ) -> Result<ImageId>
pub fn create_image( &mut self, width: u32, height: u32, fmt: TextureType, flags: ImageFlags, data: Option<&[u8]>, ) -> Result<ImageId>
Sourcepub fn update_image(
&mut self,
img: ImageId,
data: &[u8],
area: Option<(u32, u32, u32, u32)>,
) -> Result<()>
pub fn update_image( &mut self, img: ImageId, data: &[u8], area: Option<(u32, u32, u32, u32)>, ) -> Result<()>
area: Some(x, y, w, h)
pub fn image_size(&self, img: ImageId) -> Result<(u32, u32)>
pub fn delete_image(&mut self, img: ImageId) -> Result<()>
Source§impl<R: RendererDevice> Context<R>
impl<R: RendererDevice> Context<R>
pub fn fill(&mut self) -> Result<()>
pub fn stroke(&mut self) -> Result<()>
pub fn wirelines(&mut self) -> Result<()>
pub fn update_instances(&mut self, instances: &Instances<R>) -> Result<()>
pub fn draw_path<'a>( &'a mut self, path: &'a Path<R>, paint: &'a Paint, style: DrawPathStyle, instances: Option<(&Instances<R>, Range<u32>)>, ) -> Result<()>
Source§impl<R: RendererDevice> Context<R>
impl<R: RendererDevice> Context<R>
pub fn move_to<P: Into<Point>>(&mut self, pt: P)
pub fn line_to<P: Into<Point>>(&mut self, pt: P)
pub fn bezier_to<P: Into<Point>>(&mut self, cp1: P, cp2: P, pt: P)
pub fn quad_to<P: Into<Point>>(&mut self, cp: P, pt: P)
pub fn arc_to<P: Into<Point>>(&mut self, pt1: P, pt2: P, radius: f32)
pub fn arc<P: Into<Point>>( &mut self, cp: P, radius: f32, a0: f32, a1: f32, dir: PathDir, )
pub fn rect<T: Into<Rect>>(&mut self, rect: T)
pub fn rounded_rect<T: Into<Rect>>(&mut self, rect: T, radius: f32)
pub fn rounded_rect_varying<T: Into<Rect>>( &mut self, rect: T, lt: f32, rt: f32, rb: f32, lb: f32, )
pub fn ellipse<P: Into<Point>>( &mut self, center: P, radius_x: f32, radius_y: f32, )
pub fn circle<P: Into<Point>>(&mut self, center: P, radius: f32)
pub fn path_winding<D: Into<PathDir>>(&mut self, dir: D)
pub fn begin_path(&mut self)
pub fn close_path(&mut self)
Auto Trait Implementations§
impl<R> Freeze for Context<R>where
R: Freeze,
impl<R> RefUnwindSafe for Context<R>where
R: RefUnwindSafe,
impl<R> Send for Context<R>where
R: Send,
impl<R> Sync for Context<R>where
R: Sync,
impl<R> Unpin for Context<R>where
R: Unpin,
impl<R> UnwindSafe for Context<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more