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
↓ 15 callers
Method
QuadTo
QuadTo adds a quadratic Bézier path with control point (cpx,cpy) and end point (x,y).
path.go:453
↓ 15 callers
Method
Shear
Shear adds a shear transformation with sx the horizontal shear and sy the vertical shear.
util.go:686
↓ 15 callers
Method
ToPath
ToPath converts the rectangle to a path.
util.go:606
↓ 15 callers
Function
Write
Write renders the canvas and writes to a file. A renderer is chosen based on the filename extension. The options will be passed to the respective rend
renderers/renderers.go:28
↓ 15 callers
Function
errorWriter
(err error)
renderers/renderers.go:62
↓ 15 callers
Method
len
()
latex_dvi.go:295
↓ 15 callers
Method
readUint32
()
latex_dvi.go:310
↓ 14 callers
Method
Draw
(canvasFont.Pather, float64, float64, uint32)
latex_dvi.go:36
↓ 14 callers
Method
GetDict
(val any)
cmd/pdftext/reader.go:367
↓ 14 callers
Method
IsGradient
IsGradient returns true when paint is a gradient.
canvas.go:135
↓ 14 callers
Method
Rot
Rot rotates the line OP by phi radians CCW.
util.go:290
↓ 14 callers
Function
ToOpacity
(col color.Color, a float64)
colors.go:29
↓ 14 callers
Function
ellipseDeriv
(rx, ry, phi float64, sweep bool, theta float64)
path_util.go:16
↓ 14 callers
Method
readByte
()
latex_dvi.go:299
↓ 13 callers
Method
AngleBetween
AngleBetween returns the angle in radians [-PI,PI] from OP to OQ.
util.go:332
↓ 13 callers
Method
Bounds
Fit shrinks the canvas' size that so all elements fit with a given margin in millimeters.
canvas.go:801
↓ 13 callers
Method
Has
(rune)
cmd/pdftext/encoding.go:17
↓ 13 callers
Method
IsColor
IsColor returns true when paint is a uniform color.
canvas.go:130
↓ 13 callers
Method
IsSimilarity
IsSimilarity is true if the matrix consists of only translation, rotation, reflection, and uniform scaling transformations. Uniform scaling means that
util.go:842
↓ 13 callers
Method
Len
Len returns the number of segments.
path.go:287
↓ 13 callers
Method
Name
Name returns the name of the font.
font.go:313
↓ 13 callers
Method
SetStrokeWidth
SetStrokeWidth sets the width in millimeters for stroking operations. The default stroke width is 1.0.
canvas.go:458
↓ 12 callers
Method
Contains
Contains returns true if r contains q.
util.go:564
↓ 12 callers
Method
Decode
([]byte)
cmd/pdftext/encoding.go:19
↓ 12 callers
Method
Equals
(o Intersection)
path_intersection_util.go:105
↓ 12 callers
Method
Flatten
Flatten flattens all Bézier and arc curves into linear segments and returns a new path. It uses tolerance as the maximum deviation.
path.go:1448
↓ 12 callers
Function
NewRichText
NewRichText returns a new rich text with the given default font face.
text.go:444
↓ 12 callers
Method
Offset
Offset offsets the path by w and returns a new path. A positive w will offset the path to the right-hand side, that is, it expands CCW oriented contou
path_stroke.go:634
↓ 12 callers
Function
ParseSVGPath
ParseSVGPath parses an SVG path data string.
path.go:2084
↓ 12 callers
Function
Penalty
Penalty returns a penalty item (explicit or possible newline, hyphen) with a given penalization factor. For hyphen insertion, width is the hyphen widt
text/linebreak.go:182
↓ 12 callers
Method
ReverseScanner
ReverseScanner returns a path scanner in reverse order.
path_scanner.go:11
↓ 12 callers
Method
Rot90CW
Rot90CW rotates the line OP by 90 degrees CW.
util.go:280
↓ 12 callers
Method
ToSVG
ToSVG returns a string that represents the path in the SVG path data format with minification.
path.go:2291
↓ 12 callers
Function
angleEqual
angleEqual returns true if both angles are equal.
util.go:64
↓ 12 callers
Function
cohenSutherlandOutcode
(rect Rect, p Point, eps float64)
util.go:887
↓ 12 callers
Method
get
(val any)
cmd/pdftext/reader.go:305
↓ 12 callers
Method
writeObject
(val interface{})
renderers/pdf/writer.go:280
↓ 11 callers
Method
Arc
Arc adds an elliptical arc with radii rx and ry, with rot the counter clockwise rotation in degrees, and theta0 and theta1 the angles in degrees of th
path.go:535
↓ 11 callers
Method
Bounds
Bounds returns the exact bounding box rectangle of the path.
path.go:1108
↓ 11 callers
Method
Close
()
cmd/pdftext/writer.go:99
↓ 11 callers
Method
Close
()
renderers/ps/ps.go:80
↓ 11 callers
Method
Closed
Closed returns true if the last subpath of p is a closed path.
path.go:247
↓ 11 callers
Method
IsPattern
IsPattern returns true when paint is a pattern.
canvas.go:140
↓ 11 callers
Method
Pos
Pos returns the current position of the path, which is the end point of the last command.
path.go:366
↓ 11 callers
Method
Tile
P1 wallpaper group var P1 = []Matrix{Identity} Pm wallpaper group var Pm = []Matrix{ Identity, Identity.ReflectYAbout(0.5), } Pg wallpaper group v
path_tiling.go:293
↓ 11 callers
Function
addCubicBezierLine
(p *Path, p0, p1, p2, p3 Point, t, d float64)
path_util.go:678
↓ 11 callers
Function
draw
(ctx *canvas.Context, y float64, p, q *canvas.Path)
resources/boolean/main.go:94
↓ 11 callers
Function
pdfWriteVal
(w io.Writer, r *pdfReader, ref pdfRef, i any)
cmd/pdftext/writer.go:191
↓ 10 callers
Method
Copy
()
text.go:463
↓ 10 callers
Method
Div
Div divides x and y by f.
util.go:275
↓ 10 callers
Method
FastBounds
FastBounds returns the maximum bounding box rectangle of the path. It is quicker than Bounds.
path.go:1056
↓ 10 callers
Function
IntervalExclusive
IntervalExclusive returns true if f is in open interval [lower+Epsilon,upper-Epsilon] where lower and upper can be interchanged.
util.go:56
↓ 10 callers
Function
RoundedRectangle
RoundedRectangle returns a rectangle of width w and height h with rounded corners of radius r. A negative radius will cast the corners inwards (i.e. c
shapes.go:45
↓ 10 callers
Method
String
()
renderers/pdf/util.go:31
↓ 10 callers
Method
Stroke
Stroke converts a path into a stroke of width w and returns a new path. It uses cr to cap the start and end of the path, and jr to join all path eleme
path_stroke.go:658
↓ 10 callers
Method
Touches
Touches returns true if both rectangles touch (or overlap).
util.go:581
↓ 10 callers
Method
Transform
Transform transforms the path by the given transformation matrix. It modifies the path in-place.
path.go:1267
↓ 10 callers
Function
drawPos
(c *canvas.Context, x, y float64)
resources/docs/paths/main.go:24
↓ 10 callers
Function
drawStrokedPath
(c *canvas.Context, x, y float64, path string, cr canvas.Capper, jr canvas.Joiner)
resources/docs/stroke/main.go:28
↓ 10 callers
Function
drawText
(c *canvas.Context, x, y float64, text string)
resources/docs/stroke/main.go:43
↓ 10 callers
Function
fontDecorate
(face *FontFace, width float64)
font_test.go:57
↓ 10 callers
Function
pdfReadContentVal
(b []byte)
cmd/pdftext/reader.go:548
↓ 10 callers
Method
point
(p canvas.Point)
renderers/gio/gio.go:84
↓ 10 callers
Method
write
(s string, v ...any)
cmd/pdftext/writer.go:74
↓ 9 callers
Method
CSS
CSS returns the CSS boldness value for the font face.
font.go:44
↓ 9 callers
Method
Dash
Dash returns a new path that consists of dashes. The elements in d specify the width of the dashes and gaps. It will alternate between dashes and gaps
path.go:1856
↓ 9 callers
Method
Det
Det returns the matrix determinant.
util.go:725
↓ 9 callers
Method
GetInt
(val any)
cmd/pdftext/reader.go:331
↓ 9 callers
Method
GetString
(val any)
cmd/pdftext/reader.go:343
↓ 9 callers
Method
Intersects
Intersects returns true if both shapes have at least one point in common, ie. they may touch/overlap/contain/equal.
path_intersection.go:2452
↓ 9 callers
Method
Merge
()
path.go:115
↓ 9 callers
Method
Prev
()
path_intersection.go:539
↓ 9 callers
Function
RegularPolygon
RegularPolygon returns a regular polygon with radius r. It uses n vertices/edges, so when n approaches infinity this will return a path that approxima
shapes.go:123
↓ 9 callers
Method
Rot90CCW
Rot90CCW rotates the line OP by 90 degrees CCW.
util.go:285
↓ 9 callers
Method
Scale
Scale applies a scaling transform to the context
renderers/gonumplot.go:92
↓ 9 callers
Method
SetStrokeJoiner
SetStrokeJoiner sets the line join function to be used for stroke mid points. The default stroke joiner is a miter join with a limit of 4.0 for a beve
canvas.go:468
↓ 9 callers
Method
Stroke
Stroke strokes the path.
renderers/gochart.go:139
↓ 9 callers
Function
addIntersections
type SweepPointPair [2]*SweepPoint func (pair SweepPointPair) Swapped() SweepPointPair { return SweepPointPair{pair[1], pair[0]} }
path_intersection.go:1137
↓ 9 callers
Function
angleBetween
angleBetween is true when theta is in range [lower,upper] including the end points. Angles can be outside the [0,2PI) range.
util.go:101
↓ 9 callers
Function
angleTime
angleTime returns the time [0.0,1.0] of theta between [lower,upper]. When outside of [lower,upper], the result will also be outside of [0.0,1.0].
util.go:78
↓ 9 callers
Function
draw
(ctx *canvas.Context, i, j int, text string, hatch *canvas.HatchPattern)
resources/docs/hatches/main.go:37
↓ 9 callers
Function
rgbaColor
(col color.Color)
util.go:193
↓ 8 callers
Method
And
And returns the rectangle that is the overlap of both.
util.go:593
↓ 8 callers
Method
CP1
CP1 returns the first control point for quadratic and cubic Béziers.
path.go:1983
↓ 8 callers
Function
Draw
TODO: add ASM optimized version for NRGBA images, since those are much faster to write as PNG Draw draws the canvas on a new image with given resoluti
renderers/rasterizer/rasterizer.go:20
↓ 8 callers
Method
End
End returns the current path segment end position.
path_scanner.go:159
↓ 8 callers
Method
GetStream
(val any)
cmd/pdftext/reader.go:379
↓ 8 callers
Method
Inv
Inv returns the matrix inverse.
util.go:730
↓ 8 callers
Method
IsText
IsText returns true if the text span is text and not objects (such as images or paths).
text.go:202
↓ 8 callers
Method
Italic
Italic returns true if italic.
font.go:34
↓ 8 callers
Function
NewRadialGradient
NewRadialGradient returns a new radial gradient pattern.
colors.go:221
↓ 8 callers
Function
NewTextBox
NewTextBox is an advanced text formatter that will format text placement based on the settings. It takes a single font face, a string, the width or he
text.go:414
↓ 8 callers
Method
Relate
Relate returns the spatial relation as defined by DE-9IM between the two paths as well as the intersections between both. It is faster if you need to
path_intersection.go:227
↓ 8 callers
Method
Rotate
Rotate applies a rotation transform to the context. The parameter is specified in radians.
renderers/gonumplot.go:80
↓ 8 callers
Method
SetDashes
SetDashes sets the dash phase and array.
renderers/pdf/writer.go:1071
↓ 8 callers
Method
SetFill
SetFill sets the filling paint.
renderers/pdf/writer.go:974
↓ 8 callers
Function
StarPolygon
StarPolygon returns a star polygon of n points with alternating radius R and r. The up boolean defines whether the first point will be point upwards o
shapes.go:154
↓ 8 callers
Method
TextWidth
TextWidth returns the width of a given string in millimeters.
font.go:705
↓ 8 callers
Function
drawText
(ctx *canvas.Context, x, y float64, halign, valign canvas.TextAlign)
resources/docs/text/main.go:108
↓ 8 callers
Method
push
(tag string, attrs map[string]string)
svg.go:117
← previous
next →
101–200 of 1,447, ranked by callers