Documentation ¶
Overview ¶
Package giocanvas is a 2D canvas API built on gio
Index ¶
- func ColorLookup(s string) color.RGBA
- func EndTransform(stack op.StackOp)
- func MapRange(value, low1, high1, low2, high2 float64) float64
- type Canvas
- func (c *Canvas) AbsArc(x, y, radius float32, start, end float64, fillcolor color.RGBA)
- func (c *Canvas) AbsCenterImage(name string, x, y float32, w, h int, scale float32)
- func (c *Canvas) AbsCenterRect(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) AbsCircle(x, y, radius float32, fillcolor color.RGBA)
- func (c *Canvas) AbsCubicBezier(x, y, cx1, cy1, cx2, cy2, ex, ey, size float32, fillcolor color.RGBA)
- func (c *Canvas) AbsEllipse(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) AbsGrid(width, height, size, interval float32, fillcolor color.RGBA)
- func (c *Canvas) AbsHLine(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) AbsImg(im image.Image, x, y float32, w, h int, scale float32)
- func (c *Canvas) AbsLine(x0, y0, x1, y1, size float32, fillcolor color.RGBA)
- func (c *Canvas) AbsPolygon(x, y []float32, fillcolor color.RGBA)
- func (c *Canvas) AbsQuadBezier(x, y, cx, cy, ex, ey, size float32, fillcolor color.RGBA)
- func (c *Canvas) AbsRect(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) AbsRotate(x, y, angle float32) op.StackOp
- func (c *Canvas) AbsScale(x, y, factor float32) op.StackOp
- func (c *Canvas) AbsShear(x, y, ax, ay float32) op.StackOp
- func (c *Canvas) AbsText(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) AbsTextEnd(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) AbsTextMid(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) AbsTextWrap(x, y, size, width float32, s string, fillcolor color.RGBA)
- func (c *Canvas) AbsTranslate(x, y float32) op.StackOp
- func (c *Canvas) AbsVLine(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) Arc(x, y, r float32, a1, a2 float64, fillcolor color.RGBA)
- func (c *Canvas) ArcLine(x, y, r float32, a1, a2 float64, size float32, fillcolor color.RGBA)
- func (c *Canvas) Background(fillcolor color.RGBA)
- func (c *Canvas) CText(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) CenterImage(name string, x, y float32, w, h int, scale float32)
- func (c *Canvas) CenterRect(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) Circle(x, y, r float32, fillcolor color.RGBA)
- func (c *Canvas) Coord(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) CornerRect(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) CubeCurve(x, y, cx1, cy1, cx2, cy2, ex, ey float32, fillcolor color.RGBA)
- func (c *Canvas) Curve(x, y, cx, cy, ex, ey float32, fillcolor color.RGBA)
- func (c *Canvas) EText(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) Ellipse(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) Grid(x, y, w, h, size, interval float32, linecolor color.RGBA)
- func (c *Canvas) HLine(x, y, linewidth, size float32, linecolor color.RGBA)
- func (c *Canvas) Image(name string, x, y float32, w, h int, scale float32)
- func (c *Canvas) Img(im image.Image, x, y float32, w, h int, scale float32)
- func (c *Canvas) Line(x0, y0, x1, y1, size float32, strokecolor color.RGBA)
- func (c *Canvas) Polar(cx, cy, r, theta float32) (float32, float32)
- func (c *Canvas) PolarDegrees(cx, cy, r, theta float32) (float32, float32)
- func (c *Canvas) Polygon(x, y []float32, fillcolor color.RGBA)
- func (c *Canvas) QuadCurve(x, y, cx, cy, ex, ey float32, fillcolor color.RGBA)
- func (c *Canvas) Rect(x, y, w, h float32, fillcolor color.RGBA)
- func (c *Canvas) Rotate(x, y, angle float32) op.StackOp
- func (c *Canvas) Scale(x, y, factor float32) op.StackOp
- func (c *Canvas) Shear(x, y, ax, ay float32) op.StackOp
- func (c *Canvas) Square(x, y, w float32, fillcolor color.RGBA)
- func (c *Canvas) Text(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) TextEnd(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) TextMid(x, y, size float32, s string, fillcolor color.RGBA)
- func (c *Canvas) TextWrap(x, y, size, width float32, s string, fillcolor color.RGBA)
- func (c *Canvas) Translate(x, y float32) op.StackOp
- func (c *Canvas) VLine(x, y, lineheight, size float32, linecolor color.RGBA)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorLookup ¶
ColorLookup returns a color.RGBA corresponding to the named color or "rgb(r)", "rgb(r,b)", "rgb(r,g,b), "rgb(r,g,b,a)" string. On error, return black.
Types ¶
type Canvas ¶
Canvas defines the Gio canvas
func NewCanvas ¶
func NewCanvas(width, height float32, e system.FrameEvent) *Canvas
NewCanvas initializes a Canvas
func (*Canvas) AbsArc ¶
AbsArc makes circulr arc centered at (x, y), through angles start and end; the angles are measured in radians and increase clockwise N.B: derived from the clipLoader function in widget/material/loader.go
func (*Canvas) AbsCenterImage ¶
AbsCenterImage places a named image centered at (x, y) using the specified dimensions (w, h), and hen scaled
func (*Canvas) AbsCenterRect ¶
AbsCenterRect makes a filled rectangle centered at (x, y), with dimensions (w,h)
func (*Canvas) AbsCubicBezier ¶
func (c *Canvas) AbsCubicBezier(x, y, cx1, cy1, cx2, cy2, ex, ey, size float32, fillcolor color.RGBA)
AbsCubicBezier makes a cubic bezier curve
func (*Canvas) AbsEllipse ¶
AbsEllipse makes a ellipse centered at (x, y) radii (w, h)
func (*Canvas) AbsHLine ¶
AbsHLine makes a horizontal line starting at (x, y), with dimensions (w, h)
func (*Canvas) AbsImg ¶
AbsImg places a image.Image centered at (x, y) using the specified dimensions (w, h), and then scaled
func (*Canvas) AbsPolygon ¶
AbsPolygon makes a closed, filled polygon with vertices in x and y
func (*Canvas) AbsQuadBezier ¶
AbsQuadBezier makes a quadratic curve starting at (x, y), control point at (cx, cy), end point (ex, ey)
func (*Canvas) AbsRect ¶
AbsRect makes a filled Rectangle; left corner at (x, y), with dimensions (w,h)
func (*Canvas) AbsTextEnd ¶
AbsTextEnd places text aligned to the end
func (*Canvas) AbsTextMid ¶
AbsTextMid places text centered at (x,y)
func (*Canvas) AbsTextWrap ¶
AbsTextWrap places and wraps text at (x, y), wrapped at width
func (*Canvas) AbsTranslate ¶
AbsTranslate moves current location by (x,y)
func (*Canvas) Arc ¶
Arc makes a filled arc, using percentage-based measures center is (x, y) the arc begins at angle a1, and ends at a2, with radius r. The arc is filled with the specified color.
func (*Canvas) ArcLine ¶
ArcLine makes a stroked arc, using percentage-based measures center is (x, y), the arc begins at angle a1, and ends at a2, with radius r. The arc is stroked with the specified stroke size and color
func (*Canvas) Background ¶
Background makes a filled rectangle covering the whole canvas
func (*Canvas) CenterImage ¶
CenterImage places a scaled image centered at (x,y), using percentage coordinates and scales
func (*Canvas) CenterRect ¶
CenterRect makes a rectangle using percentage-based measures with center at (x,y), sized at (w,h)
func (*Canvas) Circle ¶
Circle makes a filled circle, using percentage-based measures center is (x,y), radius r
func (*Canvas) Coord ¶
Coord shows the specified coordinate, using percentage-based coordinates the (x, y) label is above the point, with a label below
func (*Canvas) CornerRect ¶
CornerRect makes a rectangle using percentage-based measures upper left corner at (x,y), with sized at (w,h)
func (*Canvas) CubeCurve ¶
CubeCurve makes a cubic Bezier curve, using percentage-based measures starting at (x, y), control points at (cx1, cy1), (cx2, cy2), end point (ex, ey)
func (*Canvas) Curve ¶
Curve makes a quadric Bezier curve, using percentage-based measures starting at (x, y), control point at (cx, cy), end point (ex, ey)
func (*Canvas) Ellipse ¶
Ellipse makes a filled circle, using percentage-based measures center is (x,y), radii (w, h)
func (*Canvas) HLine ¶
HLine makes a horizontal line starting at (x, y), with dimensions (w, h) the line begin at (x,y) and extends to the left by linewidth
func (*Canvas) Image ¶
Image places a scaled image centered at (x,y), reading from a named file, using percetage coordinates and scales
func (*Canvas) Img ¶
Img places a scaled image centered at (x, y), data from image.Image using percentage coordinates and scales
func (*Canvas) Line ¶
Line makes a stroked line using percentage-based measures from (x0, y0) to (x1, y1), stroke width size
func (*Canvas) Polar ¶
Polar returns the Cartesian coordinates (x, y) from polar coordinates with compensation for canvas aspect ratio center at (cx, cy), radius r, and angle theta (radians)
func (*Canvas) PolarDegrees ¶
PolarDegrees returns the Cartesian coordinates (x, y) from polar coordinates with compensation for canvas aspect ratio center at (cx, cy), radius r, and angle theta (degrees)
func (*Canvas) Polygon ¶
Polygon makes a filled polygon using percentage-based measures vertices in x and y,
func (*Canvas) QuadCurve ¶
QuadCurve makes a quadric Bezier curve, using percentage-based measures starting at (x, y), control point at (cx, cy), end point (ex, ey)
func (*Canvas) Rect ¶
Rect makes a rectangle using percentage-based measures upper left corner at (x,y), with size at (w,h)
func (*Canvas) Shear ¶
Shear the object centered at (x,y) using x-angle and y-angle (radians) using percentage-based measures
func (*Canvas) Square ¶
Square makes a square shape, using percentage based measures centered at (x, y), sides are w. Accounts for screen aspect
func (*Canvas) Text ¶
Text places text using percentage-based measures left at x, baseline at y, at the specified size and color
func (*Canvas) TextEnd ¶
TextEnd places text using percentage-based measures x is the end of the string, baseline at y, using specified size and color
func (*Canvas) TextMid ¶
TextMid places text using percentage-based measures text is centered at x, baseline y, using specied size and color
func (*Canvas) TextWrap ¶
TextWrap places and wraps text using percentage-based measures text begins at (x,y), baseline y, and wraps at width, using specied size and color
Directories ¶
Path | Synopsis |
---|---|
confetti -- random shapes
|
confetti -- random shapes |
Package chart makes charts using the gio canvas
|
Package chart makes charts using the gio canvas |
gchart
gchart -- command line chart using giocanvas chart package
|
gchart -- command line chart using giocanvas chart package |
concentric circles
|
concentric circles |
confetti -- random shapes
|
confetti -- random shapes |
eclipse illustrates the eclipse
|
eclipse illustrates the eclipse |
flowers demonstrated transforms with "flowers"
|
flowers demonstrated transforms with "flowers" |
hello is the giocanvas hello, world
|
hello is the giocanvas hello, world |
lines tests line drawing
|
lines tests line drawing |
mondrian makes Composition II with Red Blue and Yellow by Piet Mondrian
|
mondrian makes Composition II with Red Blue and Yellow by Piet Mondrian |
play demos the giocanvas API
|
play demos the giocanvas API |
rl makes random lines
|
rl makes random lines |
tile makes a tiling visual
|
tile makes a tiling visual |
transform tests affine transforms
|
transform tests affine transforms |