Skip to main content

Context

Struct Context 

Source
pub struct Context<R: Renderer> { /* private fields */ }

Implementations§

Source§

impl<R: Renderer> Context<R>

Source

pub fn create(renderer: R) -> Result<Context<R>>

Source

pub fn begin_frame<E: Into<Extent>>( &mut self, window_extent: E, device_pixel_ratio: f32, ) -> Result<()>

Source

pub fn cancel_frame(&mut self) -> Result<()>

Source

pub fn end_frame(&mut self) -> Result<()>

Source

pub fn save(&mut self)

Source

pub fn restore(&mut self)

Source

pub fn reset(&mut self)

Source

pub fn shape_antialias(&mut self, enabled: bool)

Source

pub fn stroke_width(&mut self, width: f32)

Source

pub fn miter_limit(&mut self, limit: f32)

Source

pub fn line_cap(&mut self, cap: LineCap)

Source

pub fn line_join(&mut self, join: LineJoin)

Source

pub fn global_alpha(&mut self, alpha: f32)

Source

pub fn transform(&mut self, xform: Transform)

Source

pub fn reset_transform(&mut self)

Source

pub fn translate(&mut self, tx: f32, ty: f32)

Source

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

Source

pub fn skew_x(&mut self, angle: f32)

Source

pub fn skew_y(&mut self, angle: f32)

Source

pub fn scale(&mut self, sx: f32, sy: f32)

Source

pub fn current_transform(&mut self) -> Transform

Source

pub fn stroke_paint<T: Into<Paint>>(&mut self, paint: T)

Source

pub fn fill_paint<T: Into<Paint>>(&mut self, paint: T)

Source

pub fn create_image<D: AsRef<[u8]>>( &mut self, flags: ImageFlags, data: D, ) -> Result<ImageId>

Source

pub fn create_image_from_file<P: AsRef<Path>>( &mut self, flags: ImageFlags, path: P, ) -> Result<ImageId>

Source

pub fn update_image(&mut self, img: ImageId, data: &[u8]) -> Result<()>

Source

pub fn image_size(&self, img: ImageId) -> Result<(usize, usize)>

Source

pub fn delete_image(&mut self, img: ImageId) -> Result<()>

Source

pub fn scissor<T: Into<Rect>>(&mut self, rect: T)

Source

pub fn intersect_scissor<T: Into<Rect>>(&mut self, rect: T)

Source

pub fn reset_scissor(&mut self)

Source

pub fn global_composite_operation(&mut self, op: CompositeOperation)

Source

pub fn begin_path(&mut self)

Source

pub fn move_to<P: Into<Point>>(&mut self, pt: P)

Source

pub fn line_to<P: Into<Point>>(&mut self, pt: P)

Source

pub fn bezier_to<P: Into<Point>>(&mut self, cp1: P, cp2: P, pt: P)

Source

pub fn quad_to<P: Into<Point>>(&mut self, cp: P, pt: P)

Source

pub fn arc_to<P: Into<Point>>(&mut self, pt1: P, pt2: P, radius: f32)

Source

pub fn close_path(&mut self)

Source

pub fn path_solidity(&mut self, dir: Solidity)

Source

pub fn arc<P: Into<Point>>( &mut self, cp: P, radius: f32, a0: f32, a1: f32, dir: Solidity, )

Source

pub fn rect<T: Into<Rect>>(&mut self, rect: T)

Source

pub fn rounded_rect<T: Into<Rect>>(&mut self, rect: T, radius: f32)

Source

pub fn rounded_rect_varying<T: Into<Rect>>( &mut self, rect: T, lt: f32, rt: f32, rb: f32, lb: f32, )

Source

pub fn ellipse<P: Into<Point>>( &mut self, center: P, radius_x: f32, radius_y: f32, )

Source

pub fn circle<P: Into<Point>>(&mut self, center: P, radius: f32)

Source

pub fn fill(&mut self) -> Result<()>

Source

pub fn stroke(&mut self) -> Result<()>

Source

pub fn create_font_from_file<N: Into<String>, P: AsRef<Path>>( &mut self, name: N, path: P, ) -> Result<FontId>

Source

pub fn create_font<N: Into<String>, D: Into<Vec<u8>>>( &mut self, name: N, data: D, ) -> Result<FontId>

Source

pub fn find_font<N: AsRef<str>>(&self, name: N) -> Option<FontId>

Source

pub fn add_fallback_fontid(&mut self, base: FontId, fallback: FontId)

Source

pub fn add_fallback_font<N1: AsRef<str>, N2: AsRef<str>>( &mut self, base: N1, fallback: N2, )

Source

pub fn font_size(&mut self, size: f32)

Source

pub fn text_letter_spacing(&mut self, spacing: f32)

Source

pub fn text_line_height(&mut self, line_height: f32)

Source

pub fn text_align(&mut self, align: Align)

Source

pub fn fontid(&mut self, id: FontId)

Source

pub fn font<N: AsRef<str>>(&mut self, name: N)

Source

pub fn text<S: AsRef<str>, P: Into<Point>>( &mut self, pt: P, text: S, ) -> Result<()>

Source

pub fn text_metrics(&self) -> TextMetrics

Source

pub fn text_size<S: AsRef<str>>(&self, text: S) -> Extent

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>

§

impl<R> !Sync for Context<R>

§

impl<R> Unpin for Context<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for Context<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for Context<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> SetParameter for T

Source§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result
where T: Parameter<Self>,

Sets value as a parameter of self.
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.