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§
Source§impl RectShape
impl RectShape
pub fn new( rect: Rect, rounding: impl Into<Rounding>, fill_color: impl Into<Color32>, stroke: impl Into<Stroke>, ) -> Self
pub fn filled( rect: Rect, rounding: impl Into<Rounding>, fill_color: impl Into<Color32>, ) -> Self
pub fn stroke( rect: Rect, rounding: impl Into<Rounding>, stroke: impl Into<Stroke>, ) -> Self
Sourcepub fn with_blur_width(self, blur_width: f32) -> Self
pub fn with_blur_width(self, blur_width: f32) -> Self
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.
Sourcepub fn visual_bounding_rect(&self) -> Rect
pub fn visual_bounding_rect(&self) -> Rect
The visual bounding rectangle (includes stroke width)