Expand description

The femtovg API is (like NanoVG) loosely modeled on the HTML5 Canvas API.

The coordinate system’s origin is the top-left corner, with positive X rightwards, positive Y downwards.


pub use renderer::RenderTarget;
pub use renderer::Renderer;
pub use ::image as img;
pub use imgref;
pub use rgb;


Module containing renderer implementations.


Main 2D drawing context.

Struct for representing colors.

Determines how a new (“source”) data is displayed against an existing (“destination”) data.

A font handle.

Information about a font.

Image flags (eg. repeat, flip, mipmaps, etc.)

An image handle.

Information about an image.

Struct controlling how graphical shapes are rendered.

A collection of verbs (move_to(), line_to(), bezier_to(), etc.) describing one or more contours.

TextContext provides functionality for text processing in femtovg. You can add fonts using the Self::add_font_file(), Self::add_font_mem() and Self::add_font_dir() functions. For each registered font a FontId is returned.

Result of a shaping run.

2×3 matrix (2 rows, 3 columns) used for 2D linear transformations. It can represent transformations such as translation, rotation, or scaling.


Text horizontal alignment: Left (default), Center, Right.

Text baseline vertical alignment: Top, Middle, Alphabetic (default), Bottom.

Blend factors.

Predefined composite oprations.

Enum with all possible canvas errors that could occur.

The fill rule used when filling paths: EvenOdd, NonZero (default).

ImageFilter allows specifying the type of filter to apply to images with crate::Canvas::filter_image.

Image source

Determines the shape used to draw the end points of lines: Butt (default), Round, Square.

Determines the shape used to join two line segments where they meet. Miter (default), Round, Bevel.

Image format: Rgb8, Rgba8, Gray8.

Used to specify Solid/Hole when adding shapes to a path.