Crate epaint

Source
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

Re-exports§

Modules§

Structs§

Enums§

  • 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§

  • 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)
  • vec2(x, y) == Vec2::new(x, y)