Documentation
¶
Index ¶
- Variables
- type CapMode
- type DashOptions
- type Definition
- type GapMode
- type GradDirection
- type GradStop
- type GradType
- type GradUnits
- type Gradient
- type Icon
- type JoinMode
- type JoinOptions
- type LinearParams
- type OpClose
- type OpCubicTo
- type OpLineTo
- type OpMoveTo
- type OpQuadTo
- type Operation
- type Path
- func (p *Path) AddArc(points []float64, cx, cy, px, py float64) (lx, ly float64)
- func (p *Path) AddRoundRect(minX, minY, maxX, maxY, rx, ry, rot float64)
- func (p *Path) Clear()
- func (p *Path) CubeBezier(b, c, d fixed.Point26_6)
- func (p *Path) Line(b fixed.Point26_6)
- func (p *Path) QuadBezier(b, c fixed.Point26_6)
- func (p *Path) Start(a fixed.Point26_6)
- func (p *Path) Stop(closeLoop bool)
- func (p Path) String() string
- func (p Path) ToSVGPath() string
- type PathStyle
- type Pattern
- type PlainColor
- type RadialParams
- type SpreadMethod
- type StyledPath
- type ViewBox
Constants ¶
This section is empty.
Variables ¶
var DefaultStyle = PathStyle{ FillOpacity: 1.0, LineOpacity: 1.0, LineWidth: 2.0, UseNonZeroWinding: true, Join: JoinOptions{ MiterLimit: fixed.Int26_6(4. * 64), LineJoin: Bevel, TrailLineCap: ButtCap, }, FillColor: PlainColor{A: 255}, Transform: matrix.Identity, }
DefaultStyle sets the default PathStyle to fill black, winding rule, full opacity, no stroke, ButtCap line end and Bevel line connect.
Functions ¶
This section is empty.
Types ¶
type DashOptions ¶
type Definition ¶
Definition is used to store what's given in a def tag
type GapMode ¶
type GapMode uint8
GapMode defines how to bridge gaps when the miter limit is exceeded, and is not part of the SVG2.0 standard.
type GradDirection ¶
GradDirection is either Radial or Linear
type Gradient ¶
type Gradient struct {
Direction GradDirection
Stops []GradStop
Bounds ViewBox
Matrix matrix.Matrix2D
Spread SpreadMethod
Units GradUnits
}
Gradient holds a description of an SVG 2.0 gradient
func (*Gradient) ApplyPathExtent ¶
func (g *Gradient) ApplyPathExtent(extent fixed.Rectangle26_6) matrix.Matrix2D
ApplyPathExtent use the given path extent to adjust the bounding box, if required by `Units`. The `Params` field is not modified, but a matrix accounting for both the bounding box and the gradient matrix is returned
type JoinMode ¶
type JoinMode uint8
JoinMode type to specify how segments join.
const ( Arc JoinMode = iota // New in SVG2 Round Bevel Miter MiterClip // New in SVG2 ArcClip // Like MiterClip applied to arcs, and is not part of the SVG2.0 standard. )
JoinMode constants determine how stroke segments bridge the gap at a join ArcClip mode is like MiterClip applied to arcs, and is not part of the SVG2.0 standard.
type JoinOptions ¶
type JoinOptions struct {
MiterLimit fixed.Int26_6 // he miter cutoff value for miter, arc, miterclip and arcClip joinModes
LineJoin JoinMode // JoinMode for curve segments
TrailLineCap CapMode // capping functions for leading and trailing line ends. If one is nil, the other function is used at both ends.
LeadLineCap CapMode // not part of the standard specification
LineGap GapMode // not part of the standard specification. determines how a gap on the convex side of two lines joining is filled
}
type LinearParams ¶
type LinearParams [4]float64
LinearParams contains the linear gradient parameters x1, y1, x2, y2
func (LinearParams) Params ¶
func (p LinearParams) Params() []float64
func (LinearParams) Type ¶
func (LinearParams) Type() GradType
type Path ¶
type Path []Operation
Path describes a sequence of basic SVG operations, which should not be nil Higher-level shapes may be reduced to a path.
func (*Path) AddRoundRect ¶
addRoundRect adds a rectangle of the indicated size, rotated around the center by rot degrees with rounded corners of radius rx in the x axis and ry in the y axis. gf specifes the shape of the filleting function.
func (*Path) CubeBezier ¶
CubeBezier adds a cubic segment to the current curve.
func (*Path) QuadBezier ¶
QuadBezier adds a quadratic segment to the current curve.
type PathStyle ¶
type PathStyle struct {
FillOpacity float64
LineOpacity float64
LineWidth float64
UseNonZeroWinding bool
Join JoinOptions
Dash DashOptions
FillColor Pattern // either PlainColor or Gradient
LineColor Pattern // either PlainColor or Gradient
Transform matrix.Matrix2D // current transform
}
PathStyle holds the state of the SVG style
type Pattern ¶
type Pattern interface {
IsPattern()
}
Pattern groups a basic color and a gradient pattern A nil value may by used to indicated that the function (fill or stroke) is off
type PlainColor ¶
func (PlainColor) IsPattern ¶
func (PlainColor) IsPattern()
func (PlainColor) RGBA ¶
func (c PlainColor) RGBA() (r, g, b, a uint32)
type RadialParams ¶
type RadialParams [6]float64
RadialParams contains the radial gradiant parameters cx, cy, fx, fy, r, fr
func (RadialParams) Params ¶
func (p RadialParams) Params() []float64
func (RadialParams) Type ¶
func (RadialParams) Type() GradType
type SpreadMethod ¶
type SpreadMethod byte
SpreadMethod is the type for spread parameters
const ( PadSpread SpreadMethod = iota ReflectSpread RepeatSpread )
SVG spread parameter constants
type StyledPath ¶
StyledPath binds a style to a path
type ViewBox ¶
type ViewBox struct{ X, Y, W, H float64 }
ViewBox defines a bounding box, such as a viewport or a path extent.
func (ViewBox) AspectMeet ¶
AspectMeet positions and sizes the ViewBox inside the rectangle defined by the arguments, while maintaining the aspect ratio. The arguments dx,dy are the width and height of a rectangle (with X and Y both 0.0) and the alignment of the rectangle. Where {ax:0.0,ay:0.0} is left/top and {ax:1.0,ay:1.0} is right/bottom.