Module elmesque::form
[−]
[src]
Ported from elm-lang's Graphics.Collage
module.
This module is for freeform graphics. You can shift, rotate, scale etc. All sorts of forms including lines, shapes, images and elements.
Collages use the same coordinate system you might see in an algebra or physics problem. The origin (0, 0) is at the center of the collage, not the top left corner as in some other graphics libraries. Furthermore, the y-axis points up, so shifting a form 10 units in the y-axis will move it up screen.
Creating Forms
to_form, filled, textured, gradient, outlined, traced, text, outlined_text
Transforming Forms
shift, shift_x, shift_y, scale, rotate, alpha
Grouping Forms
Grouping forms makes it easier to write modular graphics code. You can create a form that is a composite of many subforms. From there it is easy to transform it as a single unit. group, group_transform
Shapes
rect, oval, square, circle, ngon, polygon
Paths
segment, path
Line Styles
solid, dashed, dotted, LineStyle, LineCap, LineJoin
Structs
Form |
A general, freeform 2D graphics structure. |
LineStyle | |
PointPath |
A path described by a sequence of points. |
Shape |
A shape described by its edges. |
Enums
BasicForm |
The basic variants a Form can consist of. |
FillStyle | |
LineCap | |
LineJoin | |
ShapeStyle |
Whether a shape is outlined or filled. |
Functions
circle |
A circle with a given radius. |
collage |
A collage is a collection of 2D forms. There are no strict positioning relationships between forms, so you are free to do all kinds of 2D graphics. |
dashed |
Create a dashed line style with a given color. Dashing equals |
dotted |
Create a dotted line style with a given color. Dashing equals |
draw_form | |
group |
Flatten many forms into a single |
group_transform |
Flatten many forms into a single |
line |
Create a line with a given line style. |
ngon |
A regular polygon with N sides. The first argument specifies the number of sides and the second
is the radius. So to create a pentagon with radius 30, you would say |
oval |
An oval with a given width and height. |
point_path |
Create a PointPath that follows a sequence of points. |
polygon |
Create an arbitrary polygon by specifying its corners in order. |
rect |
A rectangle with a given width and height. |
segment |
Create a PointPath along a given line segment. |
solid |
Create a solid line style with a given color. |
sprite |
Create a sprite from a sprite sheet. It cuts out a rectangle at a given position. |
square |
A square with a given edge length. |
text |
Create some text. Details like size and color are part of the |
to_form |
Turn any |
traced |
Trace a path with a given line style. |