Expand description

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 tessellate_shapes to generate Mesh:es that you can then paint using some graphics API of your choice (e.g. OpenGL).

Feature flags

Modules

AHash is a hashing algorithm is intended to be a high performance, (hardware specific), keyed hash function. This can be seen as a DOS resistant alternative to FxHash, or a fast equivalent to SipHash. It provides a high speed hash algorithm, but where the result is not predictable without knowing a Key. This allows it to be used in a HashMap without allowing for the possibility that an malicious user can induce a collision.
Color conversions and types.
Opinionated 2D math library for building GUIs.
Helper module that wraps some Mutex types with different implementations.
Collect statistics about what is being painted.
Converts graphics primitives into textured triangles.
Everything related to text, fonts, text layout, cursors etc.

Macros

An assert that is only active when epaint is compiled with the extra_asserts feature or with the extra_debug_asserts feature in debug builds.

Structs

How to paint a circle.
A Mesh or PaintCallback within a clip rectangle.
A Shape within a clip rectangle.
This format is used for space-efficient color representation (32 bits).
A 2D RGBA color image in RAM.
How to select a sized font.
A single-channel image designed for the font texture.
The collection of fonts used by epaint.
Text that has been layed out, ready for painting.
A change to an image.
Textured triangles in two dimensions.
A version of Mesh that uses 16-bit indices.
If you want to paint some 3D shapes inside an egui region, you can use this.
Information passed along with PaintCallback (Shape::Callback).
Collected allocation statistics for shapes and meshes.
A path which can be stroked and/or filled (if closed).
A position on screen.
A rectangular region of space.
How to paint a rectangle.
0-1 linear space RGBA color with premultiplied alpha.
How rounded the corners of things should be
The color and fuzziness of a fuzzy shape. Can be used for a rectangular shadow with a soft penumbra.
Describes the width and color of a line.
Tessellation quality options
Converts Shapes into triangles (Mesh).
How to paint some text on screen.
Contains font data in an atlas, where each character occupied a small rectangle.
Used to paint images.
Low-level manager for allocating textures.
A vector has a direction and length. A Vec2 is often used to represent a size.
The 2D vertex type.

Enums

Font of unknown size.
An image stored in RAM.
A rendering primitive - either a Mesh or a PaintCallback.
A paint primitive such as a circle or a piece of text. Coordinates are all screen space points (not physical pixels).
What texture to use in a Mesh mesh.

Constants

The UV coordinate of a white region of the texture mesh. The default egui texture has the top-left corner pixel fully white. You need need use a clamping texture sampler for this to work (so it doesn’t do bilinear blending with bottom right corner).

Functions

pos2(x, y) == Pos2::new(x, y)
Turns Shape:s into sets of triangles.
vec2(x, y) == Vec2::new(x, y)