pub struct DrawingContext {
pub transform_stack: TransformStack,
pub style: Resource<Style>,
pub elapsed_time: f32,
/* private fields */
}
Fields§
§transform_stack: TransformStack
§style: Resource<Style>
§elapsed_time: f32
Amount of time (in seconds) that passed from creation of the engine. Keep in mind, that this value is not guaranteed to match real time. A user can change delta time with which the engine “ticks” and this delta time affects elapsed time.
Implementations§
Source§impl DrawingContext
impl DrawingContext
pub fn new(style: Resource<Style>) -> DrawingContext
pub fn clear(&mut self)
pub fn get_vertices(&self) -> &[Vertex]
pub fn get_triangles(&self) -> &[TriangleDefinition]
pub fn get_commands(&self) -> &Vec<Command>
pub fn push_opacity(&mut self, opacity: f32)
pub fn pop_opacity(&mut self)
pub fn triangle_points( &self, triangle: &TriangleDefinition, ) -> Option<(&Vertex, &Vertex, &Vertex)>
pub fn is_command_contains_point( &self, command: &Command, pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, ) -> bool
pub fn commit( &mut self, clip_bounds: Rect<f32>, brush: Brush, texture: CommandTexture, clipping_geometry: Option<ClippingGeometry>, )
pub fn draw_text( &mut self, clip_bounds: Rect<f32>, position: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, formatted_text: &FormattedText, )
Trait Implementations§
Source§impl Clone for DrawingContext
impl Clone for DrawingContext
Source§fn clone(&self) -> DrawingContext
fn clone(&self) -> DrawingContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DrawingContext
impl Debug for DrawingContext
Source§impl Draw for DrawingContext
impl Draw for DrawingContext
fn push_vertex_raw(&mut self, vertex: Vertex)
fn push_triangle(&mut self, a: u32, b: u32, c: u32)
fn last_vertex_index(&self) -> u32
fn push_vertex( &mut self, pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, tex_coord: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, )
fn push_triangle_multicolor( &mut self, vertices: [(Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, Color); 3], )
fn push_triangle_filled( &mut self, vertices: [Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>; 3], )
fn push_line( &mut self, a: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, b: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, thickness: f32, )
fn push_rect(&mut self, rect: &Rect<f32>, thickness: f32)
fn push_rect_vary(&mut self, rect: &Rect<f32>, thickness: Thickness)
fn push_rect_filled( &mut self, rect: &Rect<f32>, tex_coords: Option<&[Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>; 4]>, )
fn push_rect_multicolor(&mut self, rect: &Rect<f32>, colors: [Color; 4])
fn push_circle_filled( &mut self, origin: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, radius: f32, segments: usize, color: Color, )
fn push_circle( &mut self, center: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, radius: f32, subdivisions: usize, thickness: f32, )
fn connect_as_line(&mut self, from: u32, to: u32, closed: bool)
fn push_arc( &mut self, center: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, radius: f32, angles: Range<f32>, subdivisions: usize, thickness: f32, )
fn push_arc_path_with_thickness( &mut self, center: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, radius: f32, angles: Range<f32>, subdivisions: usize, thickness: f32, )
fn push_arc_path( &mut self, center: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, radius: f32, angles: Range<f32>, subdivisions: usize, )
fn push_line_path( &mut self, a: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, b: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, )
fn push_line_path_with_thickness( &mut self, a: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, b: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, thickness: f32, )
fn push_rounded_rect_filled( &mut self, rect: &Rect<f32>, corner_radius: f32, corner_subdivisions: usize, )
fn push_rounded_rect( &mut self, rect: &Rect<f32>, thickness: f32, corner_radius: f32, corner_subdivisions: usize, )
fn push_bezier( &mut self, p0: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, p1: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, p2: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, p3: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, subdivisions: usize, thickness: f32, )
fn push_grid( &mut self, zoom: f32, cell_size: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, grid_bounds: Rect<f32>, )
Auto Trait Implementations§
impl Freeze for DrawingContext
impl !RefUnwindSafe for DrawingContext
impl Send for DrawingContext
impl Sync for DrawingContext
impl Unpin for DrawingContext
impl !UnwindSafe for DrawingContext
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts self reference as a reference to
Any
. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts self reference as a reference to
Any
. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ScriptMessagePayload for T
impl<T> ScriptMessagePayload for T
Source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Returns
self
as &dyn Any
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Returns
self
as &dyn Any
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.