Documentation ¶
Overview ¶
Package clip provides operations for clipping paint operations. Drawing outside the current clip area is ignored.
The current clip is initially the infinite set. An Op sets the clip to the intersection of the current clip and the clip area it represents. If you need to reset the current clip to its value before applying an Op, use op.StackOp.
General clipping areas are constructed with Path. Simpler special cases such as rectangular clip areas also exist as convenient constructors.
Index ¶
- type Circle
- type Dash
- type DashSpec
- type Op
- type Outline
- type Path
- func (p *Path) Arc(f1, f2 f32.Point, angle float32)
- func (p *Path) Begin(ops *op.Ops)
- func (p *Path) Close()
- func (p *Path) Cube(ctrl0, ctrl1, to f32.Point)
- func (p *Path) CubeTo(ctrl0, ctrl1, to f32.Point)
- func (p *Path) End() PathSpec
- func (p *Path) Line(delta f32.Point)
- func (p *Path) LineTo(to f32.Point)
- func (p *Path) Move(delta f32.Point)
- func (p *Path) MoveTo(to f32.Point)
- func (p *Path) Pos() f32.Point
- func (p *Path) Quad(ctrl, to f32.Point)
- func (p *Path) QuadTo(ctrl, to f32.Point)
- type PathSpec
- type RRect
- type Rect
- type Stroke
- type StrokeCap
- type StrokeJoin
- type StrokeStyle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dash ¶
type Dash struct {
// contains filtered or unexported fields
}
Dash records dashes' lengths and phase for a stroked path.
type DashSpec ¶
type DashSpec struct {
// contains filtered or unexported fields
}
DashSpec describes a dashed pattern.
type Op ¶
type Op struct {
// contains filtered or unexported fields
}
Op represents a clip area. Op intersects the current clip area with itself.
type Outline ¶
type Outline struct {
Path PathSpec
}
Outline represents the area inside of a path, according to the non-zero winding rule.
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path constructs a Op clip path described by lines and Bézier curves, where drawing outside the Path is discarded. The inside-ness of a pixel is determines by the non-zero winding rule, similar to the SVG rule of the same name.
Path generates no garbage and can be used for dynamic paths; path data is stored directly in the Ops list supplied to Begin.
func (*Path) Arc ¶
Arc adds an elliptical arc to the path. The implied ellipse is defined by its focus points f1 and f2. The arc starts in the current point and ends angle radians along the ellipse boundary. The sign of angle determines the direction; positive being counter-clockwise, negative clockwise.
func (*Path) Cube ¶
Cube records a cubic Bézier from the pen through two control points ending in to.
func (*Path) CubeTo ¶
CubeTo records a cubic Bézier from the pen through two control points ending in to, with absolute coordinates.
type RRect ¶
RRect represents the clip area of a rectangle with rounded corners.
Specify a square with corner radii equal to half the square size to construct a circular clip area.
func UniformRRect ¶
UniformRRect returns an RRect with all corner radii set to the provided radius.
type Stroke ¶
type Stroke struct { Path PathSpec Style StrokeStyle // Dashes specify the dashes of the stroke. // The empty value denotes no dashes. Dashes DashSpec }
Stroke represents a stroked path.
type StrokeCap ¶
type StrokeCap uint8
StrokeCap describes the head or tail of a stroked path.
const ( // RoundCap caps stroked paths with a round cap, joining the right-hand and // left-hand sides of a stroked path with a half disc of diameter the // stroked path's width. RoundCap StrokeCap = iota // FlatCap caps stroked paths with a flat cap, joining the right-hand // and left-hand sides of a stroked path with a straight line. FlatCap // SquareCap caps stroked paths with a square cap, joining the right-hand // and left-hand sides of a stroked path with a half square of length // the stroked path's width. SquareCap )
type StrokeJoin ¶
type StrokeJoin uint8
StrokeJoin describes how stroked paths are collated.
const ( // RoundJoin joins path segments with a round segment. RoundJoin StrokeJoin = iota // BevelJoin joins path segments with sharp bevels. BevelJoin )
type StrokeStyle ¶
type StrokeStyle struct { Width float32 // Width of the stroked path. // Miter is the limit to apply to a miter joint. // The zero Miter disables the miter joint; setting Miter to +∞ // unconditionally enables the miter joint. Miter float32 Cap StrokeCap // Cap describes the head or tail of a stroked path. Join StrokeJoin // Join describes how stroked paths are collated. }
StrokeStyle describes how a path should be stroked.