Documentation ¶
Overview ¶
Package vector provides functions for vector graphics rendering.
This package is under experiments and the API might be changed with breaking backward compatibility.
Index ¶
- func DrawFilledCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color, antialias bool)
- func DrawFilledRect(dst *ebiten.Image, x, y, width, height float32, clr color.Color, ...)
- func StrokeCircle(dst *ebiten.Image, cx, cy, r float32, strokeWidth float32, clr color.Color, ...)
- func StrokeLine(dst *ebiten.Image, x0, y0, x1, y1 float32, strokeWidth float32, ...)
- func StrokeRect(dst *ebiten.Image, x, y, width, height float32, strokeWidth float32, ...)
- type Direction
- type LineCap
- type LineJoin
- type Path
- func (p *Path) AppendVerticesAndIndicesForFilling(vertices []ebiten.Vertex, indices []uint16) ([]ebiten.Vertex, []uint16)
- func (p *Path) AppendVerticesAndIndicesForStroke(vertices []ebiten.Vertex, indices []uint16, op *StrokeOptions) ([]ebiten.Vertex, []uint16)
- func (p *Path) Arc(x, y, radius, startAngle, endAngle float32, dir Direction)
- func (p *Path) ArcTo(x1, y1, x2, y2, radius float32)
- func (p *Path) Close()
- func (p *Path) CubicTo(x1, y1, x2, y2, x3, y3 float32)
- func (p *Path) LineTo(x, y float32)
- func (p *Path) MoveTo(x, y float32)
- func (p *Path) QuadTo(x1, y1, x2, y2 float32)
- type StrokeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DrawFilledCircle ¶ added in v2.5.0
DrawFilledCircle fills a circle with the specified center position (cx, cy), the radius (r), width and color.
func DrawFilledRect ¶ added in v2.5.0
func DrawFilledRect(dst *ebiten.Image, x, y, width, height float32, clr color.Color, antialias bool)
DrawFilledRect fills a rectangle with the specified width and color.
func StrokeCircle ¶ added in v2.5.0
func StrokeCircle(dst *ebiten.Image, cx, cy, r float32, strokeWidth float32, clr color.Color, antialias bool)
StrokeCircle strokes a circle with the specified center position (cx, cy), the radius (r), width and color.
clr has be to be a solid (non-transparent) color.
Types ¶
type Direction ¶ added in v2.2.0
type Direction int
Direction represents clockwise or counterclockwise.
type LineCap ¶ added in v2.5.0
type LineCap int
LineCap represents the way in which how the ends of the stroke are rendered.
type LineJoin ¶ added in v2.5.0
type LineJoin int
LineJoin represents the way in which how two segments are joined.
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path represents a collection of path subpathments.
func (*Path) AppendVerticesAndIndicesForFilling ¶ added in v2.2.0
func (p *Path) AppendVerticesAndIndicesForFilling(vertices []ebiten.Vertex, indices []uint16) ([]ebiten.Vertex, []uint16)
AppendVerticesAndIndicesForFilling appends vertices and indices to fill this path and returns them. AppendVerticesAndIndicesForFilling works in a similar way to the built-in append function. If the arguments are nils, AppendVerticesAndIndicesForFilling returns new slices.
The returned vertice's SrcX and SrcY are 0, and ColorR, ColorG, ColorB, and ColorA are 1.
The returned values are intended to be passed to DrawTriangles or DrawTrianglesShader with the fill rule NonZero or EvenOdd in order to render a complex polygon like a concave polygon, a polygon with holes, or a self-intersecting polygon.
The returned vertices and indices should be rendered with a solid (non-transparent) color with the default Blend (source-over). Otherwise, there is no guarantee about the rendering result.
func (*Path) AppendVerticesAndIndicesForStroke ¶ added in v2.5.0
func (p *Path) AppendVerticesAndIndicesForStroke(vertices []ebiten.Vertex, indices []uint16, op *StrokeOptions) ([]ebiten.Vertex, []uint16)
AppendVerticesAndIndicesForStroke appends vertices and indices to render a stroke of this path and returns them. AppendVerticesAndIndicesForStroke works in a similar way to the built-in append function. If the arguments are nils, AppendVerticesAndIndicesForStroke returns new slices.
The returned vertice's SrcX and SrcY are 0, and ColorR, ColorG, ColorB, and ColorA are 1.
The returned values are intended to be passed to DrawTriangles or DrawTrianglesShader with a solid (non-transparent) color with the FillAll fill rule (not NonZero or EvenOdd fill rule).
func (*Path) ArcTo ¶ added in v2.2.0
ArcTo adds an arc curve to the path. (x1, y1) is the first control point, and (x2, y2) is the second control point.
func (*Path) Close ¶ added in v2.5.0
func (p *Path) Close()
Close adds a new line from the last position of the current subpath to the first position of the current subpath, and marks the current subpath closed. Following operations for this path will start with a new subpath.
func (*Path) CubicTo ¶
CubicTo adds a cubic Bézier curve to the path. (x1, y1) and (x2, y2) are the control points, and (x3, y3) is the destination.
func (*Path) LineTo ¶
LineTo adds a line segment to the path, which starts from the last position of the current subpath and ends to the given position (x, y). If p doesn't have any subpaths or the last subpath is closed, LineTo sets (x, y) as the start position of a new subpath.
type StrokeOptions ¶ added in v2.5.0
type StrokeOptions struct { // Width is the stroke width in pixels. // // The default (zero) value is 0. Width float32 // LineCap is the way in which how the ends of the stroke are rendered. // Line caps are not rendered when the subpath is marked as closed. // // The default (zero) value is LineCapButt. LineCap LineCap // LineJoin is the way in which how two segments are joined. // // The default (zero) value is LineJoiMiter. LineJoin LineJoin // MiterLimit is the miter limit for LineJoinMiter. // For details, see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit. // // The default (zero) value is 0. MiterLimit float32 }
StrokeOptions is options to render a stroke.