Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/tdewolff/canvas
/ functions
Functions
1,447 in github.com/tdewolff/canvas
⨍
Functions
1,447
◇
Types & classes
214
↓ 293 callers
Method
T
T returns the matrix transpose.
util.go:719
↓ 206 callers
Function
Equal
Equal returns true if a and b are equal within an absolute tolerance of Epsilon or within a relative tolerance of Epsilon (relative to the largest of
util.go:24
↓ 183 callers
Function
MustParseSVGPath
MustParseSVGPath parses an SVG path data string and panics if it fails.
path.go:2075
↓ 153 callers
Method
DrawPath
DrawPath draws a path at position (x,y) using the current draw state.
canvas.go:638
↓ 137 callers
Method
Sub
Sub subtracts Q from P.
util.go:265
↓ 128 callers
Method
Add
Add returns a rect that encompasses both the current rect and the given rect.
util.go:451
↓ 122 callers
Method
LineTo
LineTo adds a linear path to (x,y).
path.go:411
↓ 101 callers
Method
Mul
Mul multiplies x and y by f.
util.go:270
↓ 101 callers
Function
cmdLen
cmdLen returns the number of values (float64s) the path command contains.
path.go:79
↓ 85 callers
Method
Dot
Dot returns the dot product between OP and OQ, i.e. zero if perpendicular and |OP|*|OQ| if aligned.
util.go:307
↓ 84 callers
Function
boSP
(a, b Point, clipping bool)
path_intersection_test.go:500
↓ 80 callers
Method
Run
()
cmd/pdftext/main.go:47
↓ 77 callers
Method
Translate
Translate applies a translational transform to the context.
renderers/gonumplot.go:86
↓ 73 callers
Method
Write
Write writes the canvas to an io.Writer using the given writer. See renderers/ for an overview of implementations of canvas.Writer.
canvas.go:877
↓ 68 callers
Method
MoveTo
MoveTo moves the path to (x,y) without connecting the path. It starts a new independent subpath. Multiple subpaths can be useful when negating parts
path.go:401
↓ 61 callers
Function
Box
Box returns a box item (a word) of the given fixed width.
text/linebreak.go:164
↓ 60 callers
Function
Rectangle
Rectangle returns a rectangle of width w and height h.
shapes.go:31
↓ 51 callers
Method
SetFillColor
SetFillColor sets the current fill color.
renderers/gochart.go:82
↓ 51 callers
Method
Translate
Translate translates the path by (x,y). It modifies the path in-place.
path.go:1344
↓ 50 callers
Method
DrawText
DrawText draws text at position (x,y) using the current draw state.
canvas.go:662
↓ 50 callers
Method
SetFillColor
SetFillColor sets the color to be used for filling operations. The default fill color is black.
canvas.go:413
↓ 50 callers
Method
Split
Split splits the path into its independent subpaths. The path is split before each MoveTo command.
path.go:1573
↓ 48 callers
Function
Circle
Circle returns a circle of radius r.
shapes.go:99
↓ 48 callers
Method
Close
Close closes a (sub)path with a LineTo to the start of the path (the most recent MoveTo command). It also signals the path closes as opposed to being
path.go:561
↓ 46 callers
Method
SetStrokeColor
SetStrokeColor sets the current stroke color.
renderers/gochart.go:77
↓ 43 callers
Function
NewTextLine
NewTextLine is a simple text line using a single font face, a string (supporting new lines) and horizontal alignment (Left, Center, Right). The text's
text.go:316
↓ 43 callers
Method
Scale
Scale scales the path by (sx,sy). It modifies the path in-place.
path.go:1349
↓ 41 callers
Method
parseDimension
(v string, parent float64)
svg.go:155
↓ 40 callers
Method
Append
Append appends path q to p and returns the extended path p.
path.go:300
↓ 39 callers
Method
Face
Face gets the font face given by the font size in points and its style. Fill can be any of Paint, color.Color, or canvas.Pattern.
font.go:334
↓ 38 callers
Method
Equals
Equals returns true if p and q are equal within tolerance Epsilon.
path.go:173
↓ 36 callers
Method
Face
Face gets the font face given by the font size in points. Other arguments that can be passed: Paint/Pattern/color.Color (=Black), FontStyle (=FontRegu
font.go:483
↓ 36 callers
Function
Hex
Hex parses a CSS hexadecimal color such as e.g. #ff0000 or F00.
colors.go:40
↓ 36 callers
Function
NewFontFamily
NewFontFamily returns a new font family.
font.go:365
↓ 36 callers
Method
Rotate
Rotate rotates the path by deg degrees. It modifies the path in-place.
path.go:1354
↓ 36 callers
Method
Transform
(Matrix)
patterns.go:9
↓ 34 callers
Method
End
End returns the current path segment end position.
path_scanner.go:78
↓ 34 callers
Method
write
(s string, v ...interface{})
renderers/pdf/writer.go:140
↓ 33 callers
Method
Bounds
()
renderers/rasterizer/util.go:50
↓ 33 callers
Function
New
New returns a new canvas with width and height in millimeters, that records all drawing operations into layers. The canvas can then be rendered to any
canvas.go:726
↓ 33 callers
Function
angleNorm
angleNorm returns the angle theta in the range [0,2PI).
util.go:69
↓ 32 callers
Method
Angle
Angle returns the angle in radians [0,2PI) between the x-axis and OP.
util.go:327
↓ 32 callers
Function
DPMM
DPMM (dots-per-millimeter) for the resolution of rasterization.
canvas.go:23
↓ 32 callers
Method
Join
(*Path, *Path, float64, Point, Point, Point, float64, float64)
path_stroke.go:78
↓ 32 callers
Function
NewContext
NewContext returns a new context which is a wrapper around a renderer. Contexts maintain the state of the current path, path style, and view transform
canvas.go:244
↓ 32 callers
Method
PerpDot
PerpDot returns the perp dot product between OP and OQ, i.e. zero if aligned and |OP|*|OQ| if perpendicular. This is the cross product in two dimensio
util.go:312
↓ 31 callers
Method
Size
()
canvas.go:207
↓ 30 callers
Method
Length
Length returns the length of the path in millimeters. The length is approximated for cubic Béziers.
path.go:1233
↓ 30 callers
Method
RGBA
()
color/color.go:17
↓ 30 callers
Function
snap
snap "gridsnaps" the floating point to a grid of the given spacing
util.go:126
↓ 29 callers
Method
ArcTo
ArcTo adds an arc with radii rx and ry, with rot the counter clockwise rotation with respect to the coordinate system in degrees, large and sweep bool
path.go:494
↓ 28 callers
Method
At
(float64, float64)
colors.go:81
↓ 28 callers
Method
String
()
util.go:149
↓ 28 callers
Function
moveWhiteSpace
(b []byte, i int)
cmd/pdftext/util.go:28
↓ 27 callers
Function
Interval
Interval returns true if f is in closed interval [lower-Epsilon,upper+Epsilon] where lower and upper can be interchanged.
util.go:48
↓ 27 callers
Method
WriteFace
WriteFace writes a string with a given font face.
text.go:531
↓ 27 callers
Function
enosys
()
examples/html-canvas/wasm_exec.js:8
↓ 26 callers
Method
Empty
Empty returns true if p is an empty path or consists of only MoveTos and Closes.
path.go:168
↓ 26 callers
Method
Fills
(windings int)
path.go:36
↓ 25 callers
Method
Next
()
path_intersection.go:555
↓ 25 callers
Function
toArcFlags
toArcFlags converts to the largeArc and sweep boolean flags given its value in the path.
path.go:86
↓ 24 callers
Method
HasStroke
HasStroke returns true if the style has a stroke
canvas.go:184
↓ 24 callers
Method
Interpolate
Interpolate returns a point on PQ that is linearly interpolated by t in [0,1], i.e. t=0 returns P and t=1 returns Q.
util.go:351
↓ 24 callers
Method
SetStrokeWidth
SetStrokeWidth sets the stroke width.
renderers/gochart.go:87
↓ 23 callers
Method
Encode
([]byte)
cmd/pdftext/encoding.go:18
↓ 23 callers
Method
Norm
Norm normalises OP to be of given length.
util.go:337
↓ 23 callers
Function
ellipseToCenter
ellipseToCenter converts to the center arc format and returns (centerX, centerY, angleFrom, angleTo) with angles in radians. When angleFrom with range
path_util.go:65
↓ 22 callers
Method
DPMM
DPMM returns the resolution in dots-per-millimeter.
canvas.go:33
↓ 22 callers
Method
Metrics
Metrics returns the font metrics. See https://developer.apple.com/library/archive/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Art/glyph_m
font.go:666
↓ 22 callers
Method
add
(pos Point, ta, tb, dira, dirb float64, tangent, same bool)
path_intersection_util.go:147
↓ 21 callers
Method
Bytes
()
cmd/pdftext/encoding.go:108
↓ 21 callers
Method
LoadSystemFont
LoadSystemFont loads a font from the system's fonts.
font.go:411
↓ 21 callers
Method
Set
(x, y int, c color.Color)
image/image.go:233
↓ 21 callers
Method
ToText
ToText takes the added text spans and fits them within a given box of certain width and height using Donald Knuth's line breaking algorithm.
text.go:647
↓ 20 callers
Method
Add
Add adds a new point to the polyline.
polyline.go:34
↓ 20 callers
Method
Equal
Equal returns true if Paints are equal.
canvas.go:113
↓ 20 callers
Method
H
H returns the height of the rectangle.
util.go:409
↓ 20 callers
Method
SetStrokeColor
SetStrokeColor sets the color to be used for stroking operations. The default stroke color is transparent.
canvas.go:443
↓ 20 callers
Method
Start
Start returns the current path segment start position.
path_scanner.go:41
↓ 19 callers
Method
Add
Add adds Q to P.
util.go:260
↓ 19 callers
Method
HasFill
HasFill returns true if the style has a fill
canvas.go:179
↓ 19 callers
Method
RenderPath
(path *Path, style Style, m Matrix)
canvas.go:208
↓ 19 callers
Method
W
W returns the width of the rectangle.
util.go:404
↓ 19 callers
Method
WriteFile
WriteFile writes the canvas to a file using the given writer. See renderers/ for an overview of implementations of canvas.Writer.
canvas.go:882
↓ 19 callers
Function
solveQuadraticFormula
Numerically stable quadratic formula, lowest root is returned first, see https://math.stackexchange.com/a/2007723
util.go:960
↓ 18 callers
Method
Get
(string, float64)
latex_dvi.go:31
↓ 17 callers
Method
Not
Not returns the boolean path operation of path p NOT q, i.e. the difference of both. It removes all self-intersections and overlapping areas, orients
path_intersection.go:198
↓ 17 callers
Method
RenderTo
(Renderer, *Path)
patterns.go:11
↓ 17 callers
Method
Reverse
Reverse returns a new path that is the same path as p but in the reverse direction.
path.go:1913
↓ 17 callers
Method
Scan
Scan scans a new path segment and should be called before the other methods.
path_scanner.go:22
↓ 17 callers
Method
Style
Style returns the style of the font.
font.go:318
↓ 17 callers
Function
cubicBezierSplit
(p0, p1, p2, p3 Point, t float64)
path_util.go:662
↓ 17 callers
Function
draw
(ctx *canvas.Context, y float64, title string, p, q *canvas.Path)
resources/docs/boolean/main.go:94
↓ 16 callers
Method
LoadFontFile
LoadFontFile loads a font from a file.
font.go:429
↓ 16 callers
Method
Overlaps
Overlaps returns true if both rectangles overlap.
util.go:569
↓ 16 callers
Function
bentleyOttmann
(ps, qs Paths, op pathOp, fillRule FillRule)
path_intersection.go:1788
↓ 15 callers
Method
Copy
Copy returns a copy of p.
path.go:269
↓ 15 callers
Method
CubeTo
CubeTo adds a cubic Bézier path with control points (cpx1,cpy1) and (cpx2,cpy2) and end point (x,y).
path.go:473
↓ 15 callers
Function
EllipsePos
EllipsePos returns the position on the ellipse at angle theta.
path_util.go:8
↓ 15 callers
Function
Glue
Glue returns a glue item (a space) where width is the default width, stretch*Tolerance the maximum width, and shrink*Tolerance the minimum width.
text/linebreak.go:172
next →
1–100 of 1,447, ranked by callers