Crate graphics [] [src]

A library for 2D graphics that works with multiple back-ends.

Reexports

pub use rectangle::Rectangle;
pub use line::Line;
pub use ellipse::Ellipse;
pub use circle_arc::CircleArc;
pub use image::Image;
pub use polygon::Polygon;
pub use text::Text;
pub use context::Context;

Modules

character

A text character

circle_arc

Draw an arc

color

Helper methods for colors

context

Transformation context

deform

Least square deforming of a 2D grid.

draw_state
ellipse

Draw ellipse

grid

A flat grid with square cells.

image

Draw an image

line

Draw Line

math

Various methods for computing with vectors.

modular_index

Helper functions for computing modular index safely.

polygon

Draw polygon

radians

Reexport radians helper trait from vecmath

rectangle

Draw rectangle

text

Draw text

triangulation

Methods for converting shapes into triangles.

types

Contains type aliases used in this library

Structs

DrawState

An assembly of states that affect regular draw calls

Viewport

Stores viewport information.

Statics

BACK_END_MAX_VERTEX_COUNT

Any triangulation method called on the back-end never exceeds this number of vertices. This can be used to initialize buffers that fit the chunk size.

Traits

Colored

Implemented by contexts that contains color.

Graphics

Implemented by all graphics back-ends.

ImageSize

Implemented by all images to be used with generic algorithms.

Rectangled

Should be implemented by contexts that have rectangle information.

SourceRectangled

Should be implemented by contexts that have source rectangle information.

Transformed

Implemented by contexts that can transform.

Functions

circle_arc

Draws arc

clear

Clears the screen.

clip_draw_state

Returns a default draw state that does additive blending and no culling.

default_draw_state

Returns a default draw state that does additive blending and no culling.

ellipse

Draws ellipse.

image

Draws image.

inside_draw_state

Returns a default draw state that does additive blending and no culling.

line

Draws line.

outside_draw_state

Returns a default draw state that does additive blending and no culling.

polygon

Draws polygon.

rectangle

Draws rectangle.

text

Draws text.