Skip to main content
Version: 1.0.0-preview.37

Velaptor.Graphics.RectShape

Velaptor

Velaptor.Graphics

RectShape Struct

Represents a rectangular shape with various attributes.

public struct RectShape :
System.IEquatable<Velaptor.Graphics.RectShape>

Implements System.IEquatable<RectShape>

Constructors

RectShape() Constructor

Initializes a new instance of the RectShape struct.

public RectShape();

Properties

BorderThickness

Gets or sets the thickness of the rectangle's border.

public float BorderThickness { get; set; }

Property Value

System.Single

Remarks

Ignored if the IsSolid property is set to true.

The value of a corner will never be larger than the smallest half Width or half Height.

Bottom

Gets or sets the location of the bottom of the rectangle on the Y axis.

public float Bottom { get; set; }

Property Value

System.Single

Remarks

Will automatically update the Position of the rectangle.

Color

Gets or sets the color of the rectangle.

public System.Drawing.Color Color { get; set; }

Property Value

System.Drawing.Color

Remarks

Ignored if the GradientType is set to any value other than None.

CornerRadius

Gets or sets the radius of each corner of the rectangle.

public Velaptor.Graphics.CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius

Remarks

The value of a corner will never be larger than the smallest half Width or half Height.

GradientStart

Gets or sets the starting color of the gradient.

public System.Drawing.Color GradientStart { get; set; }

Property Value

System.Drawing.Color

Remarks

This property is ignored if the GradientType is set to a value of None.

GradientStop

Gets or sets the ending color of the gradient.

public System.Drawing.Color GradientStop { get; set; }

Property Value

System.Drawing.Color

Remarks

This property is ignored if the GradientType is set to a value of None.

GradientType

Gets or sets the type of color gradient that will be applied to the rectangle.

public Velaptor.Graphics.ColorGradient GradientType { get; set; }

Property Value

ColorGradient

Remarks

A value of None will use the Color
property and render the rectangle with a solid color.

A value of Horizontal will ignore the Color
property and use the GradientStartGradientStop properties.
This will render the rectangle with GradientStart color on the left side and gradually
render it to the right side as the GradientStop color.

A value of Vertical will ignore the Color
property and use the GradientStart and GradientStop properties.
This will render the rectangle with GradientStart color on the top and gradually
render it to the bottom as the GradientStop color.

HalfHeight

Gets the half height of the rectangle.

public float HalfHeight { get; }

Property Value

System.Single

HalfWidth

Gets the half width of the rectangle.

public float HalfWidth { get; }

Property Value

System.Single

Height

Gets or sets the height of the rectangle.

public float Height { get; set; }

Property Value

System.Single

Remarks

The height is restricted to a minimum value of one.

IsSolid

Gets or sets a value indicating whether the rectangle is solid.

public bool IsSolid { get; set; }

Property Value

System.Boolean

Left

Gets or sets the location of the left side of the rectangle on the X axis.

public float Left { get; set; }

Property Value

System.Single

Remarks

Will automatically update the Position of the rectangle.

Position

Gets or sets the position of the rectangle.

public System.Numerics.Vector2 Position { get; set; }

Property Value

System.Numerics.Vector2

Remarks

This position is the center of the rectangle.

Gets or sets the location of the right side of the rectangle on the X axis.

public float Right { get; set; }

Property Value

System.Single

Remarks

Will automatically update the Position of the rectangle.

Top

Gets or sets the location of the top of the rectangle on the Y axis.

public float Top { get; set; }

Property Value

System.Single

Remarks

Will automatically update the Position of the rectangle.

Width

Gets or sets the width of the rectangle.

public float Width { get; set; }

Property Value

System.Single

Remarks

The width is restricted to a minimum value of one.

Methods

Contains(Vector2)

Returns a value indicating whether the given System.Numerics.Vector2 is contained within the rectangle shape.

public bool Contains(System.Numerics.Vector2 vector);

Parameters

vector System.Numerics.Vector2

The possibly contained System.Numerics.Vector2.

Returns

System.Boolean
true if the vector is contained.

Remarks

The Left or Right or Top or Bottom are inclusive.

Empty()

Empties the struct.

public void Empty();

IsEmpty()

Returns a value indicating whether the RectShape struct is empty.

public bool IsEmpty();

Returns

System.Boolean
True if empty.