S or /

SourceModule epaint

A simple 2D graphics library for turning simple 2D shapes and text into textured triangles.

Made for egui.

Create some Shape:s and pass them to Tessellator.tessellate_shapes to generate Mesh:es that you can then paint using some graphics API of your choice (e.g. OpenGL).

Coordinate system§

The left-top corner of the screen is (0.0, 0.0), with X increasing to the right and Y increasing downwards.

epaint uses logical points as its coordinate system. Those related to physical pixels by the pixels_per_point scale factor. For example, a high-dpi screen can have pixels_per_point = 2.0, meaning there are two physical screen pixels for each logical point.

Angles are in radians, and are measured clockwise from the X-axis, which has angle=0.

Feature flags§

Modules§

imageColorImage, FontColorTransferFunction, ImageData, ImageDelta
tessellator

Converts graphics primitives into textured triangles.

text

Everything related to text, fonts, text layout, cursors etc.

texturesTextureFilter, TextureOptions, TextureWrapMode, TexturesDelta

Classes§

Brush

Controls texturing of a egui.RectShape.

CircleShape

How to paint a circle.

ClippedPrimitive

A Mesh or PaintCallback within a clip rectangle.

ClippedShape

A Shape within a clip rectangle.

CornerRadius

How rounded the corners of things should be.

CubicBezierShape

A cubic Bézier Curve.

Direction Enum

A cardinal direction, one of LeftToRight, RightToLeft, TopDown, BottomUp.

EllipseShape

How to paint an ellipse.

Margin

A value for all four sides of a rectangle, often used to express padding or spacing.

MarginF32

A value for all four sides of a rectangle, often used to express padding or spacing.

Mesh

Textured triangles in two dimensions.

Mesh16

A version of Mesh that uses 16-bit indices.

PathShape

A path which can be stroked and/or filled (if closed).

PathStroke

Describes the width and color of paths. The color can either be solid or provided by a callback. For more information, see ColorMode

QuadraticBezierShape

A quadratic Bézier Curve.

RectShape

How to paint a rectangle.

Shadow

The color and fuzziness of a fuzzy shape.

Shape Enum

A paint primitive such as a circle or a piece of text. Coordinates are all screen space points (not physical pixels).

Stroke

Describes the width and color of a line.

StrokeKind Enum

Describes how the stroke of a shape should be painted.

TextShape

How to paint some text on screen.

TextureHandle

Used to paint images.

TextureId Enum

What texture to use in a Mesh mesh.

Functions§

Constants§

Re-exports§