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
- AHash is a high performance keyed hash function.
- color
- Color conversions and types.
- emath
- Opinionated 2D math library for building GUIs.
- image
- mutex
- Helper module that wraps some Mutex types with different implementations.
- shape_
transform - stats
- Collect statistics about what is being painted.
- tessellator
- Converts graphics primitives into textured triangles.
- text
- Everything related to text, fonts, text layout, cursors etc.
- textures
- util
Macros§
- epaint_
assert - An assert that is only active when
epaint
is compiled with theextra_asserts
feature or with theextra_debug_asserts
feature in debug builds.
Structs§
- Circle
Shape - How to paint a circle.
- Clipped
Primitive - A
Mesh
orPaintCallback
within a clip rectangle. - Clipped
Shape - A
Shape
within a clip rectangle. - Color32
- This format is used for space-efficient color representation (32 bits).
- Color
Image - A 2D RGBA color image in RAM.
- Cubic
Bezier Shape - A cubic Bézier Curve.
- FontId
- How to select a sized font.
- Font
Image - A single-channel image designed for the font texture.
- Fonts
- The collection of fonts used by
epaint
. - Galley
- Text that has been layed out, ready for painting.
- Image
Delta - A change to an image.
- Mesh
- Textured triangles in two dimensions.
- Mesh16
- A version of
Mesh
that uses 16-bit indices. - Paint
Callback - If you want to paint some 3D shapes inside an egui region, you can use this.
- Paint
Callback Info - Information passed along with
PaintCallback
(Shape::Callback
). - Paint
Stats - Collected allocation statistics for shapes and meshes.
- Path
Shape - A path which can be stroked and/or filled (if closed).
- Pos2
- A position on screen.
- Quadratic
Bezier Shape - A quadratic Bézier Curve.
- Rect
- A rectangular region of space.
- Rect
Shape - How to paint a rectangle.
- Rgba
- 0-1 linear space
RGBA
color with premultiplied alpha. - Rounding
- How rounded the corners of things should be
- Shadow
- The color and fuzziness of a fuzzy shape. Can be used for a rectangular shadow with a soft penumbra.
- Stroke
- Describes the width and color of a line.
- Tessellation
Options - Tessellation quality options
- Tessellator
- Converts
Shape
s into triangles (Mesh
). - Text
Shape - How to paint some text on screen.
- Texture
Atlas - Contains font data in an atlas, where each character occupied a small rectangle.
- Texture
Handle - Used to paint images.
- Texture
Manager - Low-level manager for allocating textures.
- Vec2
- A vector has a direction and length.
A
Vec2
is often used to represent a size. - Vertex
- The 2D vertex type.
Enums§
- Font
Family - Font of unknown size.
- Image
Data - An image stored in RAM.
- Primitive
- A rendering primitive - either a
Mesh
or aPaintCallback
. - Shape
- A paint primitive such as a circle or a piece of text. Coordinates are all screen space points (not physical pixels).
- Texture
Id - What texture to use in a
Mesh
mesh.
Constants§
- WHITE_
UV - 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
pos2(x, y) == Pos2::new(x, y)
- tessellate_
shapes - Turns
Shape
:s into sets of triangles. - vec2
vec2(x, y) == Vec2::new(x, y)