Drawing
Create persistent drawing objects or submit transient primitives during paint events. Drawing.new lists the properties available for each object kind; font and shader methods handle custom resources.
Functions
DrawFont:GetTextBoundsEstimate the space a text string needs at a requested font size. Use the estimate to reserve space for a label before drawing it. Leave margin for the actual font because this implementation does not measure individual glyphs.
DrawFont.RegisterCreate a custom font handle from font-file bytes. Assign the result to a Text drawing’s Font property to use that font. Use it to give a label a bundled font instead of a built-in font ID. Load the font bytes once, check for nil, and reuse the returned handle for matching labels.
Drawing.clearRemove every active object created by the drawing library. Use this for a complete drawing cleanup; use an object’s Remove method to delete only that object.
Drawing.newCreate a 2D drawing that appears over the game view. Choose a shape, image, or text object, set its properties, and enable Visible to display it. Drawings are separate from Roblox Instances and are removed with Remove or Destroy. Use persistent drawings for labels and shapes that stay visible until their properties change. For shapes recalculated on every frame, DrawingImmediate provides a separate submission API.
DrawingImmediate.CircleDraw an unfilled circle around a screen position. Radius sets its size; thickness controls the outline. Use it for a ring or circular outline without covering its interior.
DrawingImmediate.FilledCircleDraw a solid circle centered at the supplied screen position. Use it for a circular marker or status indicator.
DrawingImmediate.FilledQuadFill a four-sided shape enclosed by vertices a, b, c, and d in order. Use it for a filled four-corner panel or skewed shape. Supply vertices in perimeter order to avoid a self-crossing polygon.
DrawingImmediate.FilledRectangleDraw a filled rectangle using an upper-left position, dimensions, and corner rounding. Use it for a panel background or filled progress indicator.
DrawingImmediate.FilledTriangleFill the triangle enclosed by three screen-space vertices. Use it for a solid arrowhead or triangular decoration.
DrawingImmediate.GetPaintGet the render-step signal used to submit immediate drawing commands each frame. Connect a callback when a drawing should be recomputed every frame. Disconnect that callback to stop submitting its primitives; zIndex does not select a separate layer in Kawaii.
DrawingImmediate.LineDraw a line between two screen positions during the current paint cycle. Use thickness to control its width. Use it for a divider, underline, or connector in a changing overlay.
DrawingImmediate.OutlinedTextDraw text with a separately colored outline. Text and outline have independent opacity values. Use it for a readable label over a background that changes color. A dark outline can separate light text from the image behind it.
DrawingImmediate.QuadDraw a closed four-sided outline through vertices a, b, c, and d in order. Use it for a four-corner border that is not necessarily axis-aligned. Supply vertices around the perimeter so the edges do not cross.
DrawingImmediate.RectangleDraw a rectangle outline from its upper-left position, width, and height. Rounding controls the corners. Use it for the border of a panel or selection box.
DrawingImmediate.TextDraw text at a screen position for the current paint cycle, using a built-in or custom font. Use it for a label whose contents or position are recomputed each frame.
DrawingImmediate.TriangleDraw the outline joining three screen-space vertices, closing the last vertex back to the first. Use it for a triangular outline or a directional indicator with an empty center.
DrawingObject:RemovePermanently remove this drawing from the screen. This cleans up one object while leaving other drawings in place. Use it when the UI element represented by this drawing closes. Hiding with Visible = false keeps the object available; removing it ends its lifetime.
getrenderpropertyRead a drawing property using its name as a string. This is useful when a settings table or other code chooses which property to inspect. The getter returns the current property value and does not change the object. It accepts data-property names, not method names such as Remove.
isrenderobjCheck whether a value is a live drawing object. Use it before accepting an object in code that works with drawings. A removed drawing returns false, even if your script still holds its old handle. This makes it useful for checking object lifetime before an update.
setrenderpropertyChange a drawing property using a string name. It uses the same assignment rules as object[property] = value, so it is useful for applying settings selected at runtime. Use the matching property type when applying a settings table. Read-only values such as TextBounds cannot be assigned through this helper.
Shader:CreateCompile a shader using the source currently stored in its Vertex and Pixel properties. Use it after loading or editing your drawing shader sources. Changing source text alone does not compile it; inspect a raised error to diagnose a compilation failure.