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 FillAndStroke(env *object.Environment, args ...object.Object) object.Object
- func FillColor(env *object.Environment, args ...object.Object) object.Object
- func FontSize(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 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 Star(env *object.Environment, args ...object.Object) object.Object
- func Stroke(env *object.Environment, args ...object.Object) object.Object
- func StrokeColor(env *object.Environment, args ...object.Object) object.Object
- func StrokeWeight(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 Transform(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 Viewport(env *object.Environment, args ...object.Object) object.Object
- func Width(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.
func FillAndStroke ¶ added in v0.5.0
FillAndStroke first fills the current path and than strokes it
func FillColor ¶ added in v0.5.0
FillColor returns or sets the fill color. fillColor(hexcolor) - sets the fill color to `hexcolor`. fillColor(r, g, b) - sets the fill color to `r,g,b` values. fillColor(r, g, b, a) - sets the fill color to `r,g,b,a` values.
func FontSize ¶ added in v0.5.0
FontSize sets the size of the current font face. `fontSize()` returns the current font height `fontSize(size)` sets the current font height
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 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 Star ¶ added in v0.5.0
Star draws a star shape. star(cx, cy, n, or, ir) cx, cy center of the star, n is the number of spikes, or and ir the outer and inner radius.
func Stroke ¶
Stroke strokes the current path with the current color and line width the path is cleared after this operation.
func StrokeColor ¶ added in v0.5.0
StrokeColor returns or sets the stroke color. strokeColor(hexcolor) - sets the stroke color to `hexcolor`. strokeColor(r, g, b) - sets the stroke color to `r,g,b` values. strokeColor(r, g, b, a) - sets the stroke color to `r,g,b,a` values.
func StrokeWeight ¶ added in v0.5.0
StrokeWeight returns or sets the stroke line thickness. strokeWeight() - returns the current stroke line thickness. strokeWeight(width) - sets the stroke thickness to `width`.
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 Transform ¶ added in v0.5.0
Transform multiplies the specified point by the current matrix, returning a transformed position.
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.
Types ¶
This section is empty.