Documentation
¶
Index ¶
- func Arc(env *object.Environment, args ...object.Object) object.Object
- func ArcTo(env *object.Environment, args ...object.Object) object.Object
- func BeginPath(env *object.Environment, args ...object.Object) object.Object
- func Circle(env *object.Environment, args ...object.Object) object.Object
- func Clear(env *object.Environment, args ...object.Object) object.Object
- func ClosePath(env *object.Environment, args ...object.Object) object.Object
- func Dashes(env *object.Environment, args ...object.Object) object.Object
- func Ellipse(env *object.Environment, args ...object.Object) object.Object
- func Fill(env *object.Environment, args ...object.Object) object.Object
- func GetCurrentX(env *object.Environment, args ...object.Object) object.Object
- func GetCurrentY(env *object.Environment, args ...object.Object) object.Object
- func Height(env *object.Environment, args ...object.Object) object.Object
- func Identity(env *object.Environment, args ...object.Object) object.Object
- func ImageAnchored(env *object.Environment, args ...object.Object) object.Object
- func Line(env *object.Environment, args ...object.Object) object.Object
- func LineTo(env *object.Environment, args ...object.Object) object.Object
- func LoadPNG(env *object.Environment, args ...object.Object) object.Object
- func MoveTo(env *object.Environment, args ...object.Object) object.Object
- func PenColor(env *object.Environment, args ...object.Object) object.Object
- func PenSize(env *object.Environment, args ...object.Object) object.Object
- func Point(env *object.Environment, args ...object.Object) object.Object
- func Pop(env *object.Environment, args ...object.Object) object.Object
- func Push(env *object.Environment, args ...object.Object) object.Object
- func Quad(env *object.Environment, args ...object.Object) object.Object
- func QuadraticCurveTo(env *object.Environment, args ...object.Object) object.Object
- func Rect(env *object.Environment, args ...object.Object) object.Object
- func RotateAbout(env *object.Environment, args ...object.Object) object.Object
- func RouteTo(env *object.Environment, args ...object.Object) object.Object
- func ScaleAbout(env *object.Environment, args ...object.Object) object.Object
- func Size(env *object.Environment, args ...object.Object) object.Object
- func Snapshot(env *object.Environment, args ...object.Object) object.Object
- func Stroke(env *object.Environment, args ...object.Object) object.Object
- func Text(env *object.Environment, args ...object.Object) object.Object
- func TextWidth(env *object.Environment, args ...object.Object) object.Object
- func Translate(env *object.Environment, args ...object.Object) object.Object
- func Triangle(env *object.Environment, args ...object.Object) object.Object
- func Width(env *object.Environment, args ...object.Object) object.Object
- func WorldCoords(env *object.Environment, args ...object.Object) object.Object
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Arc ¶
Arc draws a circular arc centered at `x, y` with a radius of `r`. The path starts at `angle1`, ends at `angle2`, and travels in the direction given by anticlockwise.
func ArcTo ¶
ArcTo adds a circular arc to the current sub-path, using the given control points and radius. The arc is automatically connected to the path's latest point with a straight line, if necessary for the specified parameters.
func ClosePath ¶
ClosePath adds a line segment from the current point to the beginning of the current subpath. If there is no current point, this is a no-op.
func Dashes ¶
Dashes sets the current dash pattern to use. Call with zero arguments to disable dashes. The values specify the lengths of each dash, with alternating on and off lengths.
func Ellipse ¶
Ellipse draws an ellipse centered at [x, y] coordinates and with the radii `rx` and `ry`.
func Fill ¶
Fill fills the current path with the current color. Open subpaths are implicity closed. The path is cleared after this operation. If preserve is true the path is preserved after this operation.
func GetCurrentX ¶
GetCurrentX returns the current X position if there is a current point.
func GetCurrentY ¶
GetCurrentY returns the current Y position if there is a current point.
func Identity ¶
Identity resets the current transformation matrix to the identity matrix. This results in no translating, scaling, rotating, or shearing.
func ImageAnchored ¶
ImageAnchored draws the specified image at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the image. Use ax=0.5, ay=0.5 to center the image at the specified point.
func LineTo ¶
LineTo adds a line segment to the current path starting at the current point. If there is no current point, it is equivalent to MoveTo(x, y)
func PenColor ¶
PenColor returns or sets the cursor pen color. pencolor(hexcolor) - sets the pen color to `hexcolor`. pencolor(r, g, b) - sets the pen color to `r,g,b` values - should be between 0 and 1, inclusive. Alpha will be set to 1 (fully opaque). pencolor(r, g, b, a) - sets the pen color to `r,g,b,a` values - should be between 0 and 1, inclusive.
func PenSize ¶
PenSize returns or sets the pen line thickness. pensize() - returns the current pen line thickness. pensize(width) - sets the pen line thickness to `width`.
func Push ¶
Push saves the current state of the context by pushin it onto a stack. These can be nested.
func QuadraticCurveTo ¶
QuadraticCurveTo adds a quadratic Bézier curve to the current sub-path. It requires two points: the first one is a control point and the second one is the end point. The starting point is the latest point in the current path, which can be changed using `moveTo()“ before creating the quadratic Bézier curve.
func Rect ¶
Rect draws a (w x h) rectangle with upper left corner located at (x, y). rect(x, y, w, h, [r]) if radius `r` is specified, the rectangle will have rounded corners.
func RotateAbout ¶
RotateAbout updates the current matrix with a anticlockwise rotation. rotate(angle) - rotation occurs about the origin. rotate(angle, x, y) - rotation occurs about the specified point. Angle is specified in radians.
func RouteTo ¶
RouteTo adds a line segment to the current path starting at the current point. If there is no current point, it is equivalent to MoveTo(x, y)
func ScaleAbout ¶
ScaleAbout updates the current matrix with a scaling factor. scale(sx, sy) - scaling occurs about the origin. scale(sx, sy, x, y) - scaling occurs about the specified point.
func Size ¶
Size sets the image size. `size(d)` creates a squared image where width and height are equals to `d`. `size(w, h) creates an image where width is equals to `w` and height to `h`.
func Snapshot ¶
Snapshot encodes as PNG the image with the current drawings and saves the image on the filesystem. If file name is omitted it will be autogenerated adn the PNG saved in the .g2d file folder.
func Stroke ¶
Stroke strokes the current path with the current color and line width the path is cleared after this operation. If preserve is true the path will be preserved.
func Text ¶
Text draws the specified text at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the text. Use ax=0.5, ay=0.5 to center the text at the specified point.
func TextWidth ¶
TextWidth returns the rendered width of the specified text given the current font face.
func Triangle ¶
Triangle draws a triangle. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point.
func WorldCoords ¶
WorldCoords sets up user-defined coordinate system. This performs a screen reset, all drawings are cleared.
Types ¶
This section is empty.