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).
§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§
- Color conversions and types.
- Opinionated 2D math library for building GUIs.
- Helper module that adds extra checks when the
deadlock_detection
feature is turned on. - Collect statistics about what is being painted.
- Converts graphics primitives into textured triangles.
- Everything related to text, fonts, text layout, cursors etc.
Structs§
- How to paint a circle.
- A
Mesh
orPaintCallback
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.
- A cubic Bézier Curve.
- How to paint an ellipse.
- 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 laid out, ready for painting.
- Hue, saturation, value, alpha. All in the range [0, 1]. No premultiplied alpha.
- Like Hsva but with the
v
value (brightness) being gamma corrected so that it is somewhat perceptually even. - A change to an image.
- A value for all four sides of a rectangle, often used to express padding or spacing.
- 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).
- Describes the width and color of paths. The color can either be solid or provided by a callback. For more information, see
ColorMode
- A position on screen.
- A quadratic Bézier Curve.
- 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.
- Describes the width and color of a line.
- Tessellation quality options
- 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§
- How paths will be colored.
- Font of unknown size.
- An image stored in RAM.
- A rendering primitive - either a
Mesh
or aPaintCallback
. - 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§
- Was epaint compiled with the
rayon
feature? - The UV coordinate of a white region of the texture mesh.
Functions§
pos2(x, y) == Pos2::new(x, y)
- tessellate_shapesDeprecated
vec2(x, y) == Vec2::new(x, y)