mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
vector: Add comments
This commit is contained in:
parent
1fdab58ff5
commit
d256eaa846
@ -55,6 +55,7 @@ func (p *Path) LineTo(x, y float32) {
|
|||||||
p.cur = triangulate.Point{X: x, Y: y}
|
p.cur = triangulate.Point{X: x, Y: y}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nseg returns a number of segments based on the given two points (x0, y0) and (x1, y1).
|
||||||
func nseg(x0, y0, x1, y1 float32) int {
|
func nseg(x0, y0, x1, y1 float32) int {
|
||||||
distx := x1 - x0
|
distx := x1 - x0
|
||||||
if distx < 0 {
|
if distx < 0 {
|
||||||
@ -72,6 +73,7 @@ func nseg(x0, y0, x1, y1 float32) int {
|
|||||||
return int(math.Ceil(float64(dist)))
|
return int(math.Ceil(float64(dist)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QuadTo adds a quadratic Bézier curve to the path.
|
||||||
func (p *Path) QuadTo(cpx, cpy, x, y float32) {
|
func (p *Path) QuadTo(cpx, cpy, x, y float32) {
|
||||||
c := p.cur
|
c := p.cur
|
||||||
num := nseg(c.X, c.Y, x, y)
|
num := nseg(c.X, c.Y, x, y)
|
||||||
@ -82,6 +84,7 @@ func (p *Path) QuadTo(cpx, cpy, x, y float32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CubicTo adds a cubic Bézier curve to the path.
|
||||||
func (p *Path) CubicTo(cp0x, cp0y, cp1x, cp1y, x, y float32) {
|
func (p *Path) CubicTo(cp0x, cp0y, cp1x, cp1y, x, y float32) {
|
||||||
c := p.cur
|
c := p.cur
|
||||||
num := nseg(c.X, c.Y, x, y)
|
num := nseg(c.X, c.Y, x, y)
|
||||||
@ -92,7 +95,9 @@ func (p *Path) CubicTo(cp0x, cp0y, cp1x, cp1y, x, y float32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FillOptions represents options to fill a path.
|
||||||
type FillOptions struct {
|
type FillOptions struct {
|
||||||
|
// Color is a color to fill with.
|
||||||
Color color.Color
|
Color color.Color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user