From 80e3e01e88e46a62627e73e6f6a25cff7e3ec6d3 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 6 Jul 2025 23:54:09 +0900 Subject: [PATCH] vector: rename functions from DrawFilled* to Fill* Updates #3150 --- ebitenutil/shapes.go | 10 ++++---- examples/audio/main.go | 4 ++-- examples/blocks/blocks/gamescene.go | 2 +- examples/cursor/main.go | 2 +- examples/piano/main.go | 4 ++-- examples/raycasting/main.go | 4 ++-- examples/scroll/main.go | 2 +- examples/shapes/main.go | 4 ++-- examples/snake/main.go | 4 ++-- examples/text/main.go | 8 +++---- examples/texti18n/main.go | 36 ++++++++++++++--------------- examples/textinput/main.go | 2 +- examples/vector/main.go | 8 +++---- image.go | 8 +++---- vector/path.go | 4 ++-- vector/util.go | 36 ++++++++++++++++++++--------- 16 files changed, 76 insertions(+), 62 deletions(-) diff --git a/ebitenutil/shapes.go b/ebitenutil/shapes.go index 0bb8daadc..8d7322dc3 100644 --- a/ebitenutil/shapes.go +++ b/ebitenutil/shapes.go @@ -25,7 +25,7 @@ import ( // // DrawLine is intended to be used mainly for debugging or prototyping purpose. // -// Deprecated: as of v2.5. Use vector.StrokeLine without anti-aliasing instead. +// Deprecated: as of v2.5. Use [github.com/hajimehoshi/ebiten/v2/vector.StrokeLine] without anti-aliasing instead. func DrawLine(dst *ebiten.Image, x1, y1, x2, y2 float64, clr color.Color) { vector.StrokeLine(dst, float32(x1), float32(y1), float32(x2), float32(y2), 1, clr, false) } @@ -34,16 +34,16 @@ func DrawLine(dst *ebiten.Image, x1, y1, x2, y2 float64, clr color.Color) { // // DrawRect is intended to be used mainly for debugging or prototyping purpose. // -// Deprecated: as of v2.5. Use vector.DrawFilledRect without anti-aliasing instead. +// Deprecated: as of v2.5. Use [github.com/hajimehoshi/ebiten/v2/vector.FillRect] without anti-aliasing instead. func DrawRect(dst *ebiten.Image, x, y, width, height float64, clr color.Color) { - vector.DrawFilledRect(dst, float32(x), float32(y), float32(width), float32(height), clr, false) + vector.FillRect(dst, float32(x), float32(y), float32(width), float32(height), clr, false) } // DrawCircle draws a circle on given destination dst. // // DrawCircle is intended to be used mainly for debugging or prototyping purpose. // -// Deprecated: as of v2.5. Use vector.DrawFilledCircle without anti-aliasing instead. +// Deprecated: as of v2.5. Use [github.com/hajimehoshi/ebiten/v2/vector.FillCircle] without anti-aliasing instead. func DrawCircle(dst *ebiten.Image, cx, cy, r float64, clr color.Color) { - vector.DrawFilledCircle(dst, float32(cx), float32(cy), float32(r), clr, false) + vector.FillCircle(dst, float32(cx), float32(cy), float32(r), clr, false) } diff --git a/examples/audio/main.go b/examples/audio/main.go index f90c2499d..67eda153c 100644 --- a/examples/audio/main.go +++ b/examples/audio/main.go @@ -310,12 +310,12 @@ func (p *Player) seekBarIfNeeded() error { func (p *Player) draw(screen *ebiten.Image) { // Draw the bar. x, y, w, h := playerBarRect() - vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), playerBarColor, true) + vector.FillRect(screen, float32(x), float32(y), float32(w), float32(h), playerBarColor, true) // Draw the cursor on the bar. cx := float32(x) + float32(w)*float32(p.current)/float32(p.total) cy := float32(y) + float32(h)/2 - vector.DrawFilledCircle(screen, cx, cy, 12, playerCurrentColor, true) + vector.FillCircle(screen, cx, cy, 12, playerCurrentColor, true) // Draw buttons op := &ebiten.DrawImageOptions{} diff --git a/examples/blocks/blocks/gamescene.go b/examples/blocks/blocks/gamescene.go index cc8647378..df8e7f2a4 100644 --- a/examples/blocks/blocks/gamescene.go +++ b/examples/blocks/blocks/gamescene.go @@ -108,7 +108,7 @@ func init() { } func drawWindow(r *ebiten.Image, x, y, width, height int) { - vector.DrawFilledRect(r, float32(x), float32(y), float32(width), float32(height), color.RGBA{0, 0, 0, 0xc0}, false) + vector.FillRect(r, float32(x), float32(y), float32(width), float32(height), color.RGBA{0, 0, 0, 0xc0}, false) } var fontColor = color.RGBA{0x40, 0x40, 0xff, 0xff} diff --git a/examples/cursor/main.go b/examples/cursor/main.go index 28c0f9818..35c0bf0a6 100644 --- a/examples/cursor/main.go +++ b/examples/cursor/main.go @@ -66,7 +66,7 @@ func (g *Game) Update() error { func (g *Game) Draw(screen *ebiten.Image) { for r, c := range g.gridColors { - vector.DrawFilledRect(screen, float32(r.Min.X), float32(r.Min.Y), float32(r.Dx()), float32(r.Dy()), c, false) + vector.FillRect(screen, float32(r.Min.X), float32(r.Min.Y), float32(r.Dx()), float32(r.Dy()), c, false) } switch ebiten.CursorShape() { diff --git a/examples/piano/main.go b/examples/piano/main.go index 84c64274a..118b9bbfc 100644 --- a/examples/piano/main.go +++ b/examples/piano/main.go @@ -143,7 +143,7 @@ func init() { for i, k := range whiteKeys { x := i*keyWidth + 36 height := 112 - vector.DrawFilledRect(pianoImage, float32(x), float32(y), float32(keyWidth-1), float32(height), color.White, false) + vector.FillRect(pianoImage, float32(x), float32(y), float32(keyWidth-1), float32(height), color.White, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x+keyWidth/2), float64(y+height-12)) op.ColorScale.ScaleWithColor(color.Black) @@ -161,7 +161,7 @@ func init() { } x := i*keyWidth + 24 height := 64 - vector.DrawFilledRect(pianoImage, float32(x), float32(y), float32(keyWidth-1), float32(height), color.Black, false) + vector.FillRect(pianoImage, float32(x), float32(y), float32(keyWidth-1), float32(height), color.Black, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x+keyWidth/2), float64(y+height-12)) op.ColorScale.ScaleWithColor(color.White) diff --git a/examples/raycasting/main.go b/examples/raycasting/main.go index ef195145e..cebc629a5 100644 --- a/examples/raycasting/main.go +++ b/examples/raycasting/main.go @@ -264,8 +264,8 @@ func (g *Game) Draw(screen *ebiten.Image) { } // Draw player as a rect - vector.DrawFilledRect(screen, float32(g.px)-2, float32(g.py)-2, 4, 4, color.Black, true) - vector.DrawFilledRect(screen, float32(g.px)-1, float32(g.py)-1, 2, 2, color.RGBA{255, 100, 100, 255}, true) + vector.FillRect(screen, float32(g.px)-2, float32(g.py)-2, 4, 4, color.Black, true) + vector.FillRect(screen, float32(g.px)-1, float32(g.py)-1, 2, 2, color.RGBA{255, 100, 100, 255}, true) if g.showRays { ebitenutil.DebugPrintAt(screen, "R: hide rays", padding, 0) diff --git a/examples/scroll/main.go b/examples/scroll/main.go index 00889dcd2..c9a8859f7 100644 --- a/examples/scroll/main.go +++ b/examples/scroll/main.go @@ -162,7 +162,7 @@ func (g *Game) Draw(screen *ebiten.Image) { continue } - vector.DrawFilledRect(screenContentArea, float32(itemRegion.Min.X), float32(itemRegion.Min.Y), float32(itemRegion.Dx()), float32(itemRegion.Dy()), color.RGBA{byte(i), byte(i), byte(i), 0xff}, false) + vector.FillRect(screenContentArea, float32(itemRegion.Min.X), float32(itemRegion.Min.Y), float32(itemRegion.Dx()), float32(itemRegion.Dy()), color.RGBA{byte(i), byte(i), byte(i), 0xff}, false) text := fmt.Sprintf("Item %d", i) if i == 0 { text += " (drag or touch to scroll)" diff --git a/examples/shapes/main.go b/examples/shapes/main.go index b0c0b1746..17ff9825f 100644 --- a/examples/shapes/main.go +++ b/examples/shapes/main.go @@ -62,10 +62,10 @@ func (g *Game) Draw(screen *ebiten.Image) { vector.StrokeLine(screen, 50, 150, 50, 350, 1, color.RGBA{0xff, 0xff, 0x00, 0xff}, g.aa) vector.StrokeLine(screen, 50, 100+cf, 200+cf, 250, 4, color.RGBA{0x00, 0xff, 0xff, 0xff}, g.aa) - vector.DrawFilledRect(screen, 50+cf, 50+cf, 100+cf, 100+cf, color.RGBA{0x80, 0x80, 0x80, 0xc0}, g.aa) + vector.FillRect(screen, 50+cf, 50+cf, 100+cf, 100+cf, color.RGBA{0x80, 0x80, 0x80, 0xc0}, g.aa) vector.StrokeRect(screen, 300-cf, 50, 120, 120, 10+cf/4, color.RGBA{0x00, 0x80, 0x00, 0xff}, g.aa) - vector.DrawFilledCircle(screen, 400, 400, 100, color.RGBA{0x80, 0x00, 0x80, 0x80}, g.aa) + vector.FillCircle(screen, 400, 400, 100, color.RGBA{0x80, 0x00, 0x80, 0x80}, g.aa) vector.StrokeCircle(screen, 400, 400, 10+cf, 10+cf/2, color.RGBA{0xff, 0x80, 0xff, 0xff}, g.aa) g.debugui.Draw(screen) diff --git a/examples/snake/main.go b/examples/snake/main.go index 34dd9989b..a3d438cde 100644 --- a/examples/snake/main.go +++ b/examples/snake/main.go @@ -169,9 +169,9 @@ func (g *Game) Update() error { func (g *Game) Draw(screen *ebiten.Image) { for _, v := range g.snakeBody { - vector.DrawFilledRect(screen, float32(v.X*gridSize), float32(v.Y*gridSize), gridSize, gridSize, color.RGBA{0x80, 0xa0, 0xc0, 0xff}, false) + vector.FillRect(screen, float32(v.X*gridSize), float32(v.Y*gridSize), gridSize, gridSize, color.RGBA{0x80, 0xa0, 0xc0, 0xff}, false) } - vector.DrawFilledRect(screen, float32(g.apple.X*gridSize), float32(g.apple.Y*gridSize), gridSize, gridSize, color.RGBA{0xFF, 0x00, 0x00, 0xff}, false) + vector.FillRect(screen, float32(g.apple.X*gridSize), float32(g.apple.Y*gridSize), gridSize, gridSize, color.RGBA{0xFF, 0x00, 0x00, 0xff}, false) if g.moveDirection == dirNone { ebitenutil.DebugPrint(screen, fmt.Sprintf("Press up/down/left/right to start")) diff --git a/examples/text/main.go b/examples/text/main.go index 37322c606..71530086f 100644 --- a/examples/text/main.go +++ b/examples/text/main.go @@ -85,7 +85,7 @@ func (g *Game) Draw(screen *ebiten.Image) { { const x, y = 20, 20 w, h := text.Measure(sampleText, mplusNormalFace, mplusNormalFace.Size*1.5) - vector.DrawFilledRect(screen, x, y, float32(w), float32(h), gray, false) + vector.FillRect(screen, x, y, float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(x, y) op.LineSpacing = mplusNormalFace.Size * 1.5 @@ -94,7 +94,7 @@ func (g *Game) Draw(screen *ebiten.Image) { { const x, y = 20, 120 w, h := text.Measure(sampleText, mplusBigFace, mplusBigFace.Size*1.5) - vector.DrawFilledRect(screen, x, y, float32(w), float32(h), gray, false) + vector.FillRect(screen, x, y, float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(x, y) op.LineSpacing = mplusBigFace.Size * 1.5 @@ -113,7 +113,7 @@ func (g *Game) Draw(screen *ebiten.Image) { const x, y = 160, 220 const lineSpacingInPixels = 80 w, h := text.Measure(sampleText, mplusBigFace, lineSpacingInPixels) - vector.DrawFilledRect(screen, x, y, float32(w), float32(h), gray, false) + vector.FillRect(screen, x, y, float32(w), float32(h), gray, false) op := &text.DrawOptions{} // Add the width as the text rendering region's upper-right position comes to (0, 0) // when the horizontal alignment is right. The alignment is specified later (PrimaryAlign). @@ -155,7 +155,7 @@ func (g *Game) Draw(screen *ebiten.Image) { if g.showOrigins { for _, gl := range g.glyphs { - vector.DrawFilledCircle(screen, x+float32(gl.OriginX), y+float32(gl.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) + vector.FillCircle(screen, x+float32(gl.OriginX), y+float32(gl.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) } } } diff --git a/examples/texti18n/main.go b/examples/texti18n/main.go index 336a419c4..4b7527682 100644 --- a/examples/texti18n/main.go +++ b/examples/texti18n/main.go @@ -137,7 +137,7 @@ func (g *Game) Draw(screen *ebiten.Image) { x, y := screenWidth-20, 50 w, h := text.Measure(arabicText, f, 0) // The left upper point is not x but x-w, since the text runs in the rigth-to-left direction. - vector.DrawFilledRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false) + vector.FillRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x), float64(y)) text.Draw(screen, arabicText, f, op) @@ -145,8 +145,8 @@ func (g *Game) Draw(screen *ebiten.Image) { if g.showOrigins { op := &text.LayoutOptions{} for _, g := range text.AppendGlyphs(nil, arabicText, f, op) { - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) } } } @@ -159,7 +159,7 @@ func (g *Game) Draw(screen *ebiten.Image) { } x, y := 20, 110 w, h := text.Measure(hindiText, f, 0) - vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) + vector.FillRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x), float64(y)) text.Draw(screen, hindiText, f, op) @@ -167,8 +167,8 @@ func (g *Game) Draw(screen *ebiten.Image) { if g.showOrigins { op := &text.LayoutOptions{} for _, g := range text.AppendGlyphs(nil, hindiText, f, op) { - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) } } } @@ -181,7 +181,7 @@ func (g *Game) Draw(screen *ebiten.Image) { } x, y := 20, 170 w, h := text.Measure(myanmarText, f, 0) - vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) + vector.FillRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x), float64(y)) text.Draw(screen, myanmarText, f, op) @@ -189,8 +189,8 @@ func (g *Game) Draw(screen *ebiten.Image) { if g.showOrigins { op := &text.LayoutOptions{} for _, g := range text.AppendGlyphs(nil, myanmarText, f, op) { - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) } } } @@ -203,7 +203,7 @@ func (g *Game) Draw(screen *ebiten.Image) { } x, y := 20, 230 w, h := text.Measure(thaiText, f, 0) - vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) + vector.FillRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x), float64(y)) text.Draw(screen, thaiText, f, op) @@ -211,8 +211,8 @@ func (g *Game) Draw(screen *ebiten.Image) { if g.showOrigins { op := &text.LayoutOptions{} for _, g := range text.AppendGlyphs(nil, thaiText, f, op) { - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) } } } @@ -229,7 +229,7 @@ func (g *Game) Draw(screen *ebiten.Image) { const lineSpacing = 48 x, y := 20, 290 w, h := text.Measure(mongolianText, f, lineSpacing) - vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) + vector.FillRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x), float64(y)) op.LineSpacing = lineSpacing @@ -239,8 +239,8 @@ func (g *Game) Draw(screen *ebiten.Image) { op := &text.LayoutOptions{} op.LineSpacing = lineSpacing for _, g := range text.AppendGlyphs(nil, mongolianText, f, op) { - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) } } } @@ -256,7 +256,7 @@ func (g *Game) Draw(screen *ebiten.Image) { x, y := screenWidth-20, 290 w, h := text.Measure(japaneseText, f, lineSpacing) // The left upper point is not x but x-w, since the text runs in the rigth-to-left direction as the secondary direction. - vector.DrawFilledRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false) + vector.FillRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x), float64(y)) op.LineSpacing = lineSpacing @@ -266,8 +266,8 @@ func (g *Game) Draw(screen *ebiten.Image) { op := &text.LayoutOptions{} op.LineSpacing = lineSpacing for _, g := range text.AppendGlyphs(nil, japaneseText, f, op) { - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) - vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true) + vector.FillCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true) } } } diff --git a/examples/textinput/main.go b/examples/textinput/main.go index 5aa0396d3..563ba7166 100644 --- a/examples/textinput/main.go +++ b/examples/textinput/main.go @@ -227,7 +227,7 @@ func (t *TextField) cursorPos() (int, int) { } func (t *TextField) Draw(screen *ebiten.Image) { - vector.DrawFilledRect(screen, float32(t.bounds.Min.X), float32(t.bounds.Min.Y), float32(t.bounds.Dx()), float32(t.bounds.Dy()), color.White, false) + vector.FillRect(screen, float32(t.bounds.Min.X), float32(t.bounds.Min.Y), float32(t.bounds.Dx()), float32(t.bounds.Dy()), color.White, false) var clr color.Color = color.Black if t.field.IsFocused() { clr = color.RGBA{0, 0, 0xff, 0xff} diff --git a/examples/vector/main.go b/examples/vector/main.go index e90830f92..2b117e371 100644 --- a/examples/vector/main.go +++ b/examples/vector/main.go @@ -119,7 +119,7 @@ func (g *Game) drawEbitenText(screen *ebiten.Image, x, y int, aa bool, line bool op.LineJoin = vector.LineJoinRound vector.StrokePath(screen, &path, color.RGBA{0xdb, 0x56, 0x20, 0xff}, aa, op) } else { - vector.DrawFilledPath(screen, &path, color.RGBA{0xdb, 0x56, 0x20, 0xff}, aa, vector.FillRuleNonZero) + vector.FillPath(screen, &path, color.RGBA{0xdb, 0x56, 0x20, 0xff}, aa, vector.FillRuleNonZero) } } @@ -159,7 +159,7 @@ func (g *Game) drawEbitenLogo(screen *ebiten.Image, x, y int, aa bool, line bool op.LineJoin = vector.LineJoinRound vector.StrokePath(screen, &newPath, color.RGBA{0xdb, 0x56, 0x20, 0xff}, aa, op) } else { - vector.DrawFilledPath(screen, &newPath, color.RGBA{0xdb, 0x56, 0x20, 0xff}, aa, vector.FillRuleNonZero) + vector.FillPath(screen, &newPath, color.RGBA{0xdb, 0x56, 0x20, 0xff}, aa, vector.FillRuleNonZero) } } @@ -185,7 +185,7 @@ func (g *Game) drawArc(screen *ebiten.Image, count int, aa bool, line bool) { op.LineJoin = vector.LineJoinRound vector.StrokePath(screen, &path, color.RGBA{0x33, 0xcc, 0x66, 0xff}, aa, op) } else { - vector.DrawFilledPath(screen, &path, color.RGBA{0x33, 0xcc, 0x66, 0xff}, aa, vector.FillRuleNonZero) + vector.FillPath(screen, &path, color.RGBA{0x33, 0xcc, 0x66, 0xff}, aa, vector.FillRuleNonZero) } } @@ -224,7 +224,7 @@ func (g *Game) drawWave(screen *ebiten.Image, counter int, aa bool, line bool) { op.LineJoin = vector.LineJoinRound vector.StrokePath(screen, &path, color.RGBA{0x33, 0x66, 0xff, 0xff}, aa, op) } else { - vector.DrawFilledPath(screen, &path, color.RGBA{0x33, 0x66, 0xff, 0xff}, aa, vector.FillRuleNonZero) + vector.FillPath(screen, &path, color.RGBA{0x33, 0x66, 0xff, 0xff}, aa, vector.FillRuleNonZero) } } diff --git a/image.go b/image.go index 024389145..3229dbf70 100644 --- a/image.go +++ b/image.go @@ -504,7 +504,7 @@ type DrawTrianglesOptions struct { // // The default (zero) value is FillRuleFillAll. // - // Deprecated: as of v2.9. Use [github.com/hajimehoshi/ebiten/v2/vector.DrawFilledPath] instead. + // Deprecated: as of v2.9. Use [github.com/hajimehoshi/ebiten/v2/vector.FillPath] instead. FillRule FillRule // AntiAlias indicates whether the rendering uses anti-alias or not. @@ -515,7 +515,7 @@ type DrawTrianglesOptions struct { // // The default (zero) value is false.// // - // Deprecated: as of v2.9. Use [github.com/hajimehoshi/ebiten/v2/vector.DrawFilledPath] instead. + // Deprecated: as of v2.9. Use [github.com/hajimehoshi/ebiten/v2/vector.FillPath] instead. AntiAlias bool // DisableMipmaps disables mipmaps. @@ -733,7 +733,7 @@ type DrawTrianglesShaderOptions struct { // // The default (zero) value is FillRuleFillAll. // - // Deprecated: as of v2.9. Use [github.com/hajimehoshi/ebiten/v2/vector.DrawFilledPath] instead. + // Deprecated: as of v2.9. Use [github.com/hajimehoshi/ebiten/v2/vector.FillPath] instead. FillRule FillRule // AntiAlias indicates whether the rendering uses anti-alias or not. @@ -744,7 +744,7 @@ type DrawTrianglesShaderOptions struct { // // The default (zero) value is false. // - // Deprecated: as of v2.9. Use [github.com/hajimehoshi/ebiten/v2/vector.DrawFilledPath] instead. + // Deprecated: as of v2.9. Use [github.com/hajimehoshi/ebiten/v2/vector.FillPath] instead. AntiAlias bool } diff --git a/vector/path.go b/vector/path.go index bc2bbdddf..4266f7830 100644 --- a/vector/path.go +++ b/vector/path.go @@ -705,7 +705,7 @@ func (p *Path) closeFlatPath() { // 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. // -// Deprecated: as of v2.9. Use [DrawFilledPath] instead. +// Deprecated: as of v2.9. Use [FillPath] instead. func (p *Path) AppendVerticesAndIndicesForFilling(vertices []ebiten.Vertex, indices []uint16) ([]ebiten.Vertex, []uint16) { return appendVerticesAndIndicesForFilling(p, vertices, indices) } @@ -724,7 +724,7 @@ func (p *Path) AppendVerticesAndIndicesForFilling(vertices []ebiten.Vertex, indi // 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. // -// Deprecated: as of v2.9. Use [DrawFilledPath] instead. +// Deprecated: as of v2.9. Use [FillPath] instead. func (p *Path) AppendVerticesAndIndicesForFilling32(vertices []ebiten.Vertex, indices []uint32) ([]ebiten.Vertex, []uint32) { return appendVerticesAndIndicesForFilling(p, vertices, indices) } diff --git a/vector/util.go b/vector/util.go index 143a572a1..f84c76240 100644 --- a/vector/util.go +++ b/vector/util.go @@ -73,15 +73,15 @@ func StrokeLine(dst *ebiten.Image, x0, y0, x1, y1 float32, strokeWidth float32, dst.DrawImage(whiteSubImage, op) } -// DrawFilledRect fills a rectangle with the specified width and color. -func DrawFilledRect(dst *ebiten.Image, x, y, width, height float32, clr color.Color, antialias bool) { +// FillRect fills a rectangle with the specified width and color. +func FillRect(dst *ebiten.Image, x, y, width, height float32, clr color.Color, antialias bool) { if antialias { var path Path path.MoveTo(x, y) path.LineTo(x, y+height) path.LineTo(x+width, y+height) path.LineTo(x+width, y) - DrawFilledPath(dst, &path, clr, true, FillRuleNonZero) + FillPath(dst, &path, clr, true, FillRuleNonZero) return } @@ -93,6 +93,13 @@ func DrawFilledRect(dst *ebiten.Image, x, y, width, height float32, clr color.Co dst.DrawImage(whiteSubImage, op) } +// DrawFilledRect fills a rectangle with the specified width and color. +// +// Deprecated: as of v2.9. Use [FillRect] instead. +func DrawFilledRect(dst *ebiten.Image, x, y, width, height float32, clr color.Color, antialias bool) { + FillRect(dst, x, y, width, height, clr, antialias) +} + // StrokeRect strokes a rectangle with the specified width and color. func StrokeRect(dst *ebiten.Image, x, y, width, height float32, strokeWidth float32, clr color.Color, antialias bool) { if antialias { @@ -114,7 +121,7 @@ func StrokeRect(dst *ebiten.Image, x, y, width, height float32, strokeWidth floa } if strokeWidth >= width || strokeWidth >= height { - DrawFilledRect(dst, x-strokeWidth/2, y-strokeWidth/2, width+strokeWidth, height+strokeWidth, clr, false) + FillRect(dst, x-strokeWidth/2, y-strokeWidth/2, width+strokeWidth, height+strokeWidth, clr, false) return } @@ -153,12 +160,12 @@ func StrokeRect(dst *ebiten.Image, x, y, width, height float32, strokeWidth floa } } -// DrawFilledCircle fills a circle with the specified center position (cx, cy), the radius (r), width and color. -func DrawFilledCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color, antialias bool) { +// FillCircle fills a circle with the specified center position (cx, cy), the radius (r), width and color. +func FillCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color, antialias bool) { if antialias { var path Path path.Arc(cx, cy, r, 0, 2*math.Pi, Clockwise) - DrawFilledPath(dst, &path, clr, true, FillRuleNonZero) + FillPath(dst, &path, clr, true, FillRuleNonZero) return } @@ -197,6 +204,13 @@ func DrawFilledCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color, ant }) } +// DrawFilledCircle fills a circle with the specified center position (cx, cy), the radius (r), width and color. +// +// Deprecated: as of v2.9. Use [FillCircle] instead. +func DrawFilledCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color, antialias bool) { + FillCircle(dst, cx, cy, r, clr, antialias) +} + // StrokeCircle strokes a circle with the specified center position (cx, cy), the radius (r), width and color. func StrokeCircle(dst *ebiten.Image, cx, cy, r float32, strokeWidth float32, clr color.Color, antialias bool) { if antialias { @@ -215,7 +229,7 @@ func StrokeCircle(dst *ebiten.Image, cx, cy, r float32, strokeWidth float32, clr } if strokeWidth >= r { - DrawFilledCircle(dst, cx, cy, r+strokeWidth/2, clr, false) + FillCircle(dst, cx, cy, r+strokeWidth/2, clr, false) return } @@ -289,8 +303,8 @@ var ( theFillPathM sync.Mutex ) -// DrawFilledRect fills the specified path with the specified color. -func DrawFilledPath(dst *ebiten.Image, path *Path, clr color.Color, antialias bool, fillRule FillRule) { +// FillPath fills the specified path with the specified color. +func FillPath(dst *ebiten.Image, path *Path, clr color.Color, antialias bool, fillRule FillRule) { theFillPathM.Lock() defer theFillPathM.Unlock() @@ -336,7 +350,7 @@ func StrokePath(dst *ebiten.Image, path *Path, clr color.Color, antialias bool, op := &AddPathStrokeOptions{} op.StrokeOptions = *options stroke.AddPathStroke(path, op) - DrawFilledPath(dst, &stroke, clr, antialias, FillRuleNonZero) + FillPath(dst, &stroke, clr, antialias, FillRuleNonZero) } //go:linkname addUsageCallback github.com/hajimehoshi/ebiten/v2.addUsageCallback