pub struct RectShape {
pub rect: Rect,
pub rounding: Rounding,
pub fill: Color32,
pub stroke: Stroke,
pub blur_width: f32,
pub fill_texture_id: TextureId,
pub uv: Rect,
}
Expand description
How to paint a rectangle.
Fields§
§rect: Rect
§rounding: Rounding
How rounded the corners are. Use Rounding::ZERO
for no rounding.
fill: Color32
How to fill the rectangle.
stroke: Stroke
The thickness and color of the outline.
blur_width: f32
If larger than zero, the edges of the rectangle (for both fill and stroke) will be blurred.
This can be used to produce shadows and glow effects.
The blur is currently implemented using a simple linear blur in sRGBA gamma space.
fill_texture_id: TextureId
If the rect should be filled with a texture, which one?
The texture is multiplied with Self::fill
.
uv: Rect
What UV coordinates to use for the texture?
To display a texture, set Self::fill_texture_id
,
and set this to Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0))
.
Use Rect::ZERO
to turn off texturing.
Implementations§
§impl RectShape
impl RectShape
pub fn new( rect: Rect, rounding: impl Into<Rounding>, fill_color: impl Into<Color32>, stroke: impl Into<Stroke> ) -> RectShape
pub fn filled( rect: Rect, rounding: impl Into<Rounding>, fill_color: impl Into<Color32> ) -> RectShape
pub fn stroke( rect: Rect, rounding: impl Into<Rounding>, stroke: impl Into<Stroke> ) -> RectShape
pub fn with_blur_width(self, blur_width: f32) -> RectShape
pub fn with_blur_width(self, blur_width: f32) -> RectShape
If larger than zero, the edges of the rectangle (for both fill and stroke) will be blurred.
This can be used to produce shadows and glow effects.
The blur is currently implemented using a simple linear blur in sRGBA
gamma space.
pub fn visual_bounding_rect(&self) -> Rect
pub fn visual_bounding_rect(&self) -> Rect
The visual bounding rectangle (includes stroke width)
Trait Implementations§
§impl<'de> Deserialize<'de> for RectShape
impl<'de> Deserialize<'de> for RectShape
§fn deserialize<__D>(
__deserializer: __D
) -> Result<RectShape, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<RectShape, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for RectShape
impl Serialize for RectShape
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for RectShape
impl StructuralPartialEq for RectShape
Auto Trait Implementations§
impl Freeze for RectShape
impl RefUnwindSafe for RectShape
impl Send for RectShape
impl Sync for RectShape
impl Unpin for RectShape
impl UnwindSafe for RectShape
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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> ⓘ
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> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request