RectFrame

Struct RectFrame 

Source
pub struct RectFrame {
    pub color: FillColor,
    pub image: Option<ImageHandle>,
    pub top_left: FramePoint2d,
    pub bottom_right: FramePoint2d,
    pub corner_radius: Corners<f32>,
}
Expand description

A rectangular frame

Can optionally be tinted, textured, and have rounded corners

Fields§

§color: FillColor

Background color of the frame\

If the container has a background texture, it will be multiplied by this color

§image: Option<ImageHandle>

Background texture of the frame

Can be used in conjunction with the background color
In this case, the texture will be shaded by the color

Please note that if the background color is NOT set (or set to transparent), the texture will NOT be visible
This is because the texture is multiplied by the color, and if the color is transparent, the texture will be too\

§top_left: FramePoint2d

Top left corner of the rectangle

§bottom_right: FramePoint2d

Bottom right corner of the rectangle

§corner_radius: Corners<f32>

Corner radius of the frame

Implementations§

Source§

impl RectFrame

Source

pub fn color(color: impl Into<FillColor>) -> Self

Create a new RectFrame with the given color

Source

pub fn image(image: ImageHandle) -> Self

Create a new RectFrame with the given image\

Color will be set to WHITE to ensure the image is visible

Source

pub fn color_image(color: impl Into<FillColor>, image: ImageHandle) -> Self

Create a new RectFrame with the given color and image

Source

pub fn with_corner_radius(self, radius: impl Into<Corners<f32>>) -> Self

Set the corner radius of the RectFrame

Source

pub fn with_inset(self, inset: f32) -> Self

Inset the rectangle by the given amount in pixels

Trait Implementations§

Source§

impl Clone for RectFrame

Source§

fn clone(&self) -> RectFrame

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for RectFrame

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Frame for RectFrame

Source§

fn draw(&self, draw: &mut UiDrawCommandList, rect: Rect)

Draw the frame at the given rect’s position and size
Source§

fn covers_opaque(&self) -> bool

Check if the frame is guaranteed to be fully opaque and fully cover the parent frame regardless of it’s size Read more
Source§

impl From<FillColor> for RectFrame

Source§

fn from(color: FillColor) -> Self

Converts to this type from the input type.
Source§

impl From<ImageHandle> for RectFrame

Source§

fn from(image: ImageHandle) -> Self

Converts to this type from the input type.
Source§

impl Copy for RectFrame

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> FrameStackExt for T
where T: Frame + 'static,

Source§

fn stack(self, other: impl Frame + 'static) -> FrameStack

Stack another frame on top of this one
Source§

fn stack_below(self, other: impl Frame + 'static) -> FrameStack

Stack another frame below this one
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V