Struct YauiPrimitive
A quad drawn by the uber shader in the draw call of the elements around it: the content of an element that
derives from Yaui.YauiElement (Yaui.YauiElement.SetContent(System.ReadOnlySpan%7bYaui.YauiPrimitive%7d)). Built by the static methods;
the With* methods return a modified copy.
Assembly: Yaui.dll
View Source
public struct YauiPrimitive
Properties
Rect
The rect in the local space of the element's box.
View Source
public readonly Rect Rect { get; }
Methods
Rectangle(Rect, Color)
A filled rectangle, which can have rounded corners and a border.
View Source
public static YauiPrimitive Rectangle(Rect rect, Color color)
Returns
Parameters
| Type | Name |
|---|---|
Rect | rect |
Color | color |
Image(Rect, YauiTexture, Rect, Color)
A texture multiplied by <code class="paramref">color</code>, which can have rounded corners and a border like
Yaui.YauiPrimitive.Rectangle(Rect%2cColor). Primitives with more than 8 textures in a row split the draw call.
View Source
public static YauiPrimitive Image(Rect rect, YauiTexture texture, Rect uv, Color color)
Returns
Parameters
| Type | Name |
|---|---|
Rect | rect |
| Yaui.YauiTexture | texture |
Rect | uv |
Color | color |
DistanceField(Rect, YauiTexture, Rect, Color)
A glyph of a signed distance field atlas registered with Yaui.YauiTexture.AcquireDistanceField(Texture%2cSystem.Single):
the alpha channel is the distance to the outline, 0.5 on it. The quad should cover the distance field
around the glyph that outlines and shadows reach.
View Source
public static YauiPrimitive DistanceField(Rect rect, YauiTexture texture, Rect uv, Color color)
Returns
Parameters
| Type | Name |
|---|---|
Rect | rect |
| Yaui.YauiTexture | texture |
Rect | uv |
Color | color |
DistanceFieldShadow(Rect, YauiTexture, Rect, Color, float, float)
The shadow of a Yaui.YauiPrimitive.DistanceField(Rect%2cYaui.YauiTexture%2cRect%2cColor) glyph: the glyph dilated by <code class="paramref">dilate</code> and
softened over <code class="paramref">softness</code> (canvas units), in one color. Offset its rect to move it; put it
before the glyphs so that it is drawn under them.
View Source
public static YauiPrimitive DistanceFieldShadow(Rect rect, YauiTexture texture, Rect uv, Color color, float dilate, float softness)
Returns
Parameters
| Type | Name |
|---|---|
Rect | rect |
| Yaui.YauiTexture | texture |
Rect | uv |
Color | color |
System.Single | dilate |
System.Single | softness |
WithCornerRadius(Vector4)
Rounds the corners (top-left, top-right, bottom-right, bottom-left) of a rectangle or an image.
View Source
public readonly YauiPrimitive WithCornerRadius(Vector4 radii)
Returns
Parameters
| Type | Name |
|---|---|
Vector4 | radii |
WithBorder(float, Color)
A border inside the shape of a rectangle or an image, or an outline around a distance field glyph (as far as the atlas's spread reaches). Replaces a radial fill.
View Source
public readonly YauiPrimitive WithBorder(float width, Color color)
Returns
Parameters
| Type | Name |
|---|---|
System.Single | width |
Color | color |
WithRadialFill(Vector2, float, float)
Draws only a sector of a rectangle or an image, like the radial fills of Yaui.YauiImage. <code class="paramref">center</code> is in 0..1 of the rect (Y down); angles are in radians, clockwise on screen from the right, and a negative sweep goes counter-clockwise. Replaces a border.
View Source
public readonly YauiPrimitive WithRadialFill(Vector2 center, float startAngle, float sweep)
Returns
Parameters
| Type | Name |
|---|---|
Vector2 | center |
System.Single | startAngle |
System.Single | sweep |
WithSkew(float)
Slants the quad horizontally around the bottom of its rect, like italic glyphs: x moves by <code class="paramref">skew</code> times the height above the bottom.
View Source
public readonly YauiPrimitive WithSkew(float skew)
Returns
Parameters
| Type | Name |
|---|---|
System.Single | skew |
WithBold()
Synthesized bold: dilates a distance field glyph.
View Source
public readonly YauiPrimitive WithBold()
Returns
WithRect(Rect)
Moves the quad (and keeps its UVs), for example to offset a shadow.
View Source
public readonly YauiPrimitive WithRect(Rect rect)
Returns
Parameters
| Type | Name |
|---|---|
Rect | rect |