s&box docs

public static abstract sealed class Editor.Paint

Broader workflow and conceptual references connected to this API.

Methods

Showing 47 methods

public static void ClearBrush()

public static void ClearPen()

public static void DrawArc(Vector2 center, Vector2 radius, float angle, float angleSize)

Draws an arc (line). Angles are clockwise, 0 is north.

Parameters

  • center: The center of the circle
  • radius: The radius of the circle
  • angle: The center of the arc, in degrees
  • angleSize: The size of the arc, in degrees

public static Sandbox.Rect DrawIcon(Sandbox.Rect rect, string iconName, float pixelHeight, Sandbox.TextFlag alignment = 132)

Parameters

  • alignment: Default: 132

public static void DrawPie(Vector2 center, Vector2 radius, float angle, float angleSize)

Draws a pie. Angles are clockwise, 0 is north.

Parameters

  • center: The center of the circle
  • radius: The radius of the circle
  • angle: The center of the pie, in degrees
  • angleSize: The size of the pie, in degrees

public static void DrawPoints(System.Collections.Generic.IEnumerable`1<Vector2> points)

public static Sandbox.Rect DrawTextBox(Sandbox.Rect position, string text, Color textColor, Sandbox.UI.Margin padding, float borderRadius, Sandbox.TextFlag flag)

public static string GetElidedText(string text, float width, Editor.ElideMode mode = 1, Sandbox.TextFlag flags = 132)

Adds required ellipses to a string if it doesn't fit within the width

Parameters

  • mode: Default: 1
  • flags: Default: 132

public static void Rect(Sandbox.UI.Styles styles, Sandbox.Rect rect)

Draw a rectangle using the background of a style

public static void ResetTransform()

public static void Scale(float x, float y)

public static void SetDefaultFont(float size = 8, int weight = 400, bool italic = False, bool sizeInPixels = False)

Parameters

  • size: Default: 8
  • weight: Default: 400
  • italic: Default: False
  • sizeInPixels: Default: False

public static void SetFlags(bool selected, bool mouseOver, bool pressed, bool focused, bool enabled)

public static void SetHeadingFont(float size = 15, int weight = 400, bool italic = False, bool sizeInPixels = False)

Parameters

  • size: Default: 15
  • weight: Default: 400
  • italic: Default: False
  • sizeInPixels: Default: False

public static void SetPen(Color color, float size = 0, Editor.PenStyle style = 1)

Parameters

  • size: Default: 0
  • style: Default: 1

public static System.IDisposable ToPixmap(Editor.Pixmap pixmap)

public static void Translate(Vector2 tx)

Properties

Showing 13 properties

public static bool Editor.Paint.Antialiasing { get; set; }

public static bool Editor.Paint.BilinearFiltering { get; set; }

public static bool Editor.Paint.HasEnabled { get; set; }

public static bool Editor.Paint.HasFocus { get; set; }

public static bool Editor.Paint.HasMouseOver { get; set; }

public static bool Editor.Paint.HasPressed { get; set; }

public static bool Editor.Paint.HasSelected { get; set; }

public static Sandbox.Rect Editor.Paint.LocalRect { get; set; }

public static Color Editor.Paint.Pen { get; set; }

public static float Editor.Paint.PenSize { get; set; }

public static bool Editor.Paint.TextAntialiasing { get; set; }

Metadata

FieldValue
NamespaceEditor
Typeclass
AssemblySandbox.Tools
Doc IDT:Editor.Paint

On this page

Methodspublic static System.Void ClearBrush()public static System.Void ClearPen()public static System.Void Draw(Sandbox.Rect r, Editor.Pixmap pixmap, System.Single alpha = 1, System.Single borderRadius = 0)public static System.Void Draw(Sandbox.Rect r, System.String image, System.Single alpha = 1, System.Single borderRadius = 0)public static System.Void DrawArc(Vector2 center, Vector2 radius, System.Single angle, System.Single angleSize)public static System.Void DrawArrow(Vector2 p1, Vector2 p2, System.Single width)public static System.Void DrawCircle(Sandbox.Rect rect)public static System.Void DrawCircle(Vector2 position, Vector2 scale)public static Sandbox.Rect DrawIcon(Sandbox.Rect rect, System.String iconName, System.Single pixelHeight, Sandbox.TextFlag alignment = 132)public static System.Void DrawLine(System.Collections.Generic.IEnumerable`1<Vector2> points)public static System.Void DrawLine(Vector2 from, Vector2 to)public static System.Void DrawPie(Vector2 center, Vector2 radius, System.Single angle, System.Single angleSize)public static System.Void DrawPoints(System.Collections.Generic.IEnumerable`1<Vector2> points)public static System.Void DrawPolygon(System.Collections.Generic.IEnumerable`1<Vector2> points)public static System.Void DrawPolygon(Vector2[] points)public static System.Void DrawRect(Sandbox.Rect rect, System.Single borderRadius)public static System.Void DrawRect(Sandbox.Rect rect)public static System.Void DrawSquare(Vector2 position, Vector2 scale)public static Sandbox.Rect DrawText(Sandbox.Rect position, System.String text, Sandbox.TextFlag flags = 132)public static Sandbox.Rect DrawText(Vector2 position, System.String text)public static Sandbox.Rect DrawTextBox(Sandbox.Rect position, System.String text, Color textColor, Sandbox.UI.Margin padding, System.Single borderRadius, Sandbox.TextFlag flag)public static System.String GetElidedText(System.String text, System.Single width, Editor.ElideMode mode = 1, Sandbox.TextFlag flags = 132)public static Editor.Pixmap LoadImage(System.String filename, System.Int32 x, System.Int32 y)public static Editor.Pixmap LoadImage(System.String filename)public static Sandbox.Rect MeasureText(Sandbox.Rect position, System.String text, Sandbox.TextFlag flags = 132)public static Vector2 MeasureText(System.String text)public static System.Void Rect(Sandbox.UI.Styles styles, Sandbox.Rect rect)public static System.Void ResetTransform()public static System.Void Rotate(System.Single scale, Vector2 center)public static System.Void Rotate(System.Single scale)public static System.Void Scale(System.Single x, System.Single y)public static System.Void SetBrush(Color color)public static System.Void SetBrush(Editor.Pixmap pixmap)public static System.Void SetBrush(System.String image)public static System.Void SetBrushAndPen(Color brushColor, Color penColor, System.Single penSize = 1, Editor.PenStyle style = 1)public static System.Void SetBrushAndPen(Color brushColor)public static System.Void SetBrushLinear(Vector2 a_pos, Vector2 b_pos, Color a_color, Color b_color)public static System.Void SetBrushRadial(Vector2 center, System.Single radius, Color a_color, Color b_color)public static System.Void SetBrushRadial(Vector2 center, System.Single radius, System.Single a, Color a_color, System.Single b, Color b_color)public static System.Void SetDefaultFont(System.Single size = 8, System.Int32 weight = 400, System.Boolean italic = False, System.Boolean sizeInPixels = False)public static System.Void SetFlags(System.Boolean selected, System.Boolean mouseOver, System.Boolean pressed, System.Boolean focused, System.Boolean enabled)public static System.Void SetFont(Sandbox.UI.Styles style)public static System.Void SetFont(System.String name, System.Single size = 8, System.Int32 weight = 400, System.Boolean italic = False, System.Boolean sizeInPixels = False)public static System.Void SetHeadingFont(System.Single size = 15, System.Int32 weight = 400, System.Boolean italic = False, System.Boolean sizeInPixels = False)public static System.Void SetPen(Color color, System.Single size = 0, Editor.PenStyle style = 1)public static System.IDisposable ToPixmap(Editor.Pixmap pixmap)public static System.Void Translate(Vector2 tx)Propertiespublic static System.Boolean Editor.Paint.Antialiasing { get; set; }public static System.Boolean Editor.Paint.BilinearFiltering { get; set; }public static System.Boolean Editor.Paint.HasEnabled { get; set; }public static System.Boolean Editor.Paint.HasFocus { get; set; }public static System.Boolean Editor.Paint.HasMouseOver { get; set; }public static System.Boolean Editor.Paint.HasPressed { get; set; }public static System.Boolean Editor.Paint.HasSelected { get; set; }public static Sandbox.Rect Editor.Paint.LocalRect { get; set; }public static Color Editor.Paint.Pen { get; set; }public static System.Single Editor.Paint.PenSize { get; set; }public static Editor.PenStyle Editor.Paint.PenStyle { get; set; }public static Editor.RenderMode Editor.Paint.RenderMode { get; set; }public static System.Boolean Editor.Paint.TextAntialiasing { get; set; }Metadata