pub struct DrawOption { /* private fields */ }Expand description
Unified options for drawing images and text.
Controls the position, rotation, and scale of drawn items.
Implementations§
Source§impl DrawOption
impl DrawOption
Sourcepub fn new(position: [Pt; 2], rotation: f32, scale: [f32; 2]) -> Self
pub fn new(position: [Pt; 2], rotation: f32, scale: [f32; 2]) -> Self
Creates a new DrawOption with position, rotation, and scale.
pub fn position(&self) -> [Pt; 2]
Sourcepub fn with_position(self, position: [Pt; 2]) -> Self
pub fn with_position(self, position: [Pt; 2]) -> Self
Sets the drawing position relative to the current target’s top-left corner.
pub fn set_position(&mut self, x: Pt, y: Pt)
pub fn rotation(&self) -> f32
Sourcepub fn with_rotation(self, rotation: f32) -> Self
pub fn with_rotation(self, rotation: f32) -> Self
Sets the rotation in radians.
pub fn scale(&self) -> [f32; 2]
Sourcepub fn with_scale(self, scale: [f32; 2]) -> Self
pub fn with_scale(self, scale: [f32; 2]) -> Self
Sets the scale multiplier (e.g., [2.0, 2.0] for double size).
pub fn opacity(&self) -> f32
Sourcepub fn with_opacity(self, opacity: f32) -> Self
pub fn with_opacity(self, opacity: f32) -> Self
Sets the opacity (alpha multiplier), from 0.0 to 1.0.
Trait Implementations§
Source§impl Clone for DrawOption
impl Clone for DrawOption
Source§fn clone(&self) -> DrawOption
fn clone(&self) -> DrawOption
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 DrawOption
impl Debug for DrawOption
Source§impl Default for DrawOption
impl Default for DrawOption
Source§impl PartialEq for DrawOption
impl PartialEq for DrawOption
impl Copy for DrawOption
impl StructuralPartialEq for DrawOption
Auto Trait Implementations§
impl Freeze for DrawOption
impl RefUnwindSafe for DrawOption
impl Send for DrawOption
impl Sync for DrawOption
impl Unpin for DrawOption
impl UnsafeUnpin for DrawOption
impl UnwindSafe for DrawOption
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> 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.