メインコンテンツまでスキップ

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​
Declaration
public struct YauiPrimitive

Properties​

Rect​

The rect in the local space of the element's box.

View Source​
Declaration
public readonly Rect Rect { get; }

Methods​

Rectangle(Rect, Color)​

A filled rectangle, which can have rounded corners and a border.

View Source​
Declaration
public static YauiPrimitive Rectangle(Rect rect, Color color)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
Rectrect
Colorcolor

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​
Declaration
public static YauiPrimitive Image(Rect rect, YauiTexture texture, Rect uv, Color color)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
Rectrect
Yaui.YauiTexturetexture
Rectuv
Colorcolor

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​
Declaration
public static YauiPrimitive DistanceField(Rect rect, YauiTexture texture, Rect uv, Color color)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
Rectrect
Yaui.YauiTexturetexture
Rectuv
Colorcolor

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​
Declaration
public static YauiPrimitive DistanceFieldShadow(Rect rect, YauiTexture texture, Rect uv, Color color, float dilate, float softness)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
Rectrect
Yaui.YauiTexturetexture
Rectuv
Colorcolor
System.Singledilate
System.Singlesoftness

WithCornerRadius(Vector4)​

Rounds the corners (top-left, top-right, bottom-right, bottom-left) of a rectangle or an image.

View Source​
Declaration
public readonly YauiPrimitive WithCornerRadius(Vector4 radii)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
Vector4radii

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​
Declaration
public readonly YauiPrimitive WithBorder(float width, Color color)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
System.Singlewidth
Colorcolor

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​
Declaration
public readonly YauiPrimitive WithRadialFill(Vector2 center, float startAngle, float sweep)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
Vector2center
System.SinglestartAngle
System.Singlesweep

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​
Declaration
public readonly YauiPrimitive WithSkew(float skew)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
System.Singleskew

WithBold()​

Synthesized bold: dilates a distance field glyph.

View Source​
Declaration
public readonly YauiPrimitive WithBold()
Returns​

Yaui.YauiPrimitive

WithRect(Rect)​

Moves the quad (and keeps its UVs), for example to offset a shadow.

View Source​
Declaration
public readonly YauiPrimitive WithRect(Rect rect)
Returns​

Yaui.YauiPrimitive

Parameters​
TypeName
Rectrect