Fillclass

A solid color, image or gradient fill. Defaults to no fill.

objectFill
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed struct Sandbox.Fill

Note

Gradients accept 2 to 8 stops ordered by offset in [0, 1]; equal offsets make hard transitions. Colors interpolate in premultiplied sRGB. Vector2 points and absolute lengths use drawing coordinates; percentages and calc expressions resolve from the shape's top-left against its width (X) and height (Y). Gradient points must be finite and distinct; Auto and null are unsupported. Painter.Transform applies after resolution.

Constructors1

Showing 1 constructors

public Fill(Color color)PUBLICCONSTRUCTOR

Creates a solid fill.

ParameterTypeDescription
colorColor

Methods25

Showing 25 methods

public static Sandbox.Fill Image(Sandbox.Texture texture, System.Nullable`1<Color> tint = null, System.Nullable`1<Sandbox.UI.Length> width = null, System.Nullable`1<Sandbox.UI.Length> height = null, System.Nullable`1<Sandbox.UI.Length> offsetX = null, System.Nullable`1<Sandbox.UI.Length> offsetY = null, Sandbox.UI.BackgroundRepeat repeat = 4, Sandbox.Rendering.FilterMode filter = 20)PUBLICSTATIC

ParameterTypeDescription
textureTexture
tint = nullNullable<Color>
width = nullNullable<Length>
height = nullNullable<Length>
offsetX = nullNullable<Length>
offsetY = nullNullable<Length>
repeat = 4BackgroundRepeat
filter = 20FilterMode
Returns:Fill

public static Sandbox.Fill Solid(Color color)PUBLICSTATIC

Creates a solid fill.

ParameterTypeDescription
colorColor
Returns:Fill

public Sandbox.Fill WithAngle(float degrees)PUBLIC

Returns a bounds-based linear or conic gradient with an absolute clockwise angle in degrees from right. Positioned gradients take their direction from their points; radial gradients have no angle.

ParameterTypeDescription
degreesfloat
Returns:Fill

public Sandbox.Fill WithRotation(float degrees)PUBLIC

Rotate an image or gradient tile around its center, in degrees, without rotating the shape.

ParameterTypeDescription
degreesfloat
Returns:Fill

Properties1

Showing 1 properties

public static Sandbox.Fill Sandbox.Fill.None { get; set; }PUBLICSTATICGETSET

No fill. Equivalent to the default value.

Returns:Fill

On this page

Constructorspublic Fill(Color color)Methodspublic static Sandbox.Fill ConicGradient(Color start, Color end, System.Single angle = 0)public static Sandbox.Fill ConicGradient(System.Nullable`1<Sandbox.UI.Length> centerX, System.Nullable`1<Sandbox.UI.Length> centerY, System.Nullable`1<Sandbox.UI.Length> startX, System.Nullable`1<Sandbox.UI.Length> startY, Color startColor, Color endColor)public static Sandbox.Fill ConicGradient(System.Nullable`1<Sandbox.UI.Length> centerX, System.Nullable`1<Sandbox.UI.Length> centerY, System.Nullable`1<Sandbox.UI.Length> startX, System.Nullable`1<Sandbox.UI.Length> startY, System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops)public static Sandbox.Fill ConicGradient(System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops, System.Single angle = 0)public static Sandbox.Fill.GradientBuilder ConicGradient(System.Single angle = 0)public static Sandbox.Fill ConicGradient(Vector2 center, Vector2 start, Color startColor, Color endColor)public static Sandbox.Fill ConicGradient(Vector2 center, Vector2 start, System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops)public static Sandbox.Fill Image(Sandbox.Texture texture, System.Nullable`1<Color> tint = null, System.Nullable`1<Sandbox.UI.Length> width = null, System.Nullable`1<Sandbox.UI.Length> height = null, System.Nullable`1<Sandbox.UI.Length> offsetX = null, System.Nullable`1<Sandbox.UI.Length> offsetY = null, Sandbox.UI.BackgroundRepeat repeat = 4, Sandbox.Rendering.FilterMode filter = 20)public static Sandbox.Fill LinearGradient(Color start, Color end, System.Single angle = 0)public static Sandbox.Fill LinearGradient(System.Nullable`1<Sandbox.UI.Length> startX, System.Nullable`1<Sandbox.UI.Length> startY, System.Nullable`1<Sandbox.UI.Length> endX, System.Nullable`1<Sandbox.UI.Length> endY, Color startColor, Color endColor)public static Sandbox.Fill LinearGradient(System.Nullable`1<Sandbox.UI.Length> startX, System.Nullable`1<Sandbox.UI.Length> startY, System.Nullable`1<Sandbox.UI.Length> endX, System.Nullable`1<Sandbox.UI.Length> endY, System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops)public static Sandbox.Fill LinearGradient(System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops, System.Single angle = 0)public static Sandbox.Fill.GradientBuilder LinearGradient(System.Single angle = 0)public static Sandbox.Fill LinearGradient(Vector2 start, Vector2 end, Color startColor, Color endColor)public static Sandbox.Fill LinearGradient(Vector2 start, Vector2 end, System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops)public static Sandbox.Fill.GradientBuilder RadialGradient()public static Sandbox.Fill RadialGradient(Color center, Color edge)public static Sandbox.Fill RadialGradient(System.Nullable`1<Sandbox.UI.Length> centerX, System.Nullable`1<Sandbox.UI.Length> centerY, System.Nullable`1<Sandbox.UI.Length> edgeX, System.Nullable`1<Sandbox.UI.Length> edgeY, Color start, Color end)public static Sandbox.Fill RadialGradient(System.Nullable`1<Sandbox.UI.Length> centerX, System.Nullable`1<Sandbox.UI.Length> centerY, System.Nullable`1<Sandbox.UI.Length> edgeX, System.Nullable`1<Sandbox.UI.Length> edgeY, System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops)public static Sandbox.Fill RadialGradient(System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops)public static Sandbox.Fill RadialGradient(Vector2 center, Vector2 edge, Color start, Color end)public static Sandbox.Fill RadialGradient(Vector2 center, Vector2 edge, System.ReadOnlySpan`1<Sandbox.Fill.GradientStop> stops)public static Sandbox.Fill Solid(Color color)public Sandbox.Fill WithAngle(System.Single degrees)public Sandbox.Fill WithRotation(System.Single degrees)Propertiespublic static Sandbox.Fill Sandbox.Fill.None { get; set; }Metadata