mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
Rename image.FillRect -> DrawFilledRect (FillRect is confusing with Fill)
This commit is contained in:
parent
719cc03123
commit
0bd0a4dbc2
@ -120,7 +120,7 @@ func init() {
|
||||
}
|
||||
|
||||
func drawWindow(r *ebiten.Image, x, y, width, height int) error {
|
||||
return r.FillRect(x, y, width, height, color.NRGBA{0, 0, 0, 0xc0})
|
||||
return r.DrawFilledRect(x, y, width, height, color.NRGBA{0, 0, 0, 0xc0})
|
||||
}
|
||||
|
||||
var fontColor = color.NRGBA{0x40, 0x40, 0xff, 0xff}
|
||||
|
@ -31,8 +31,8 @@ func update(screen *ebiten.Image) error {
|
||||
for i := 0; i < 6; i++ {
|
||||
screen.DrawRect(2*i, 2*i, 100, 100, color.NRGBA{0x80, 0x80, 0xff, 0x80})
|
||||
}
|
||||
screen.FillRect(10, 10, 100, 100, color.NRGBA{0x80, 0x80, 0xff, 0x80})
|
||||
screen.FillRect(20, 20, 100, 100, color.NRGBA{0x80, 0x80, 0xff, 0x80})
|
||||
screen.DrawFilledRect(10, 10, 100, 100, color.NRGBA{0x80, 0x80, 0xff, 0x80})
|
||||
screen.DrawFilledRect(20, 20, 100, 100, color.NRGBA{0x80, 0x80, 0xff, 0x80})
|
||||
screen.DrawLine(130, 0, 140, 100, color.NRGBA{0xff, 0x80, 0x80, 0x80})
|
||||
screen.DrawLine(140, 0, 150, 100, color.NRGBA{0xff, 0x80, 0x80, 0x80})
|
||||
|
||||
|
12
image.go
12
image.go
@ -118,15 +118,15 @@ func (i *Image) DrawRects(rects Rects) error {
|
||||
return i.DrawLines(&rectsAsLines{rects})
|
||||
}
|
||||
|
||||
// FillRect draws a filled rectangle.
|
||||
func (i *Image) FillRect(x, y, width, height int, clr color.Color) error {
|
||||
return i.FillRects(&rect{x, y, width, height, clr})
|
||||
// DrawFilledRect draws a filled rectangle.
|
||||
func (i *Image) DrawFilledRect(x, y, width, height int, clr color.Color) error {
|
||||
return i.DrawFilledRects(&rect{x, y, width, height, clr})
|
||||
}
|
||||
|
||||
// FillRects draws filled rectangles on the image.
|
||||
func (i *Image) FillRects(rects Rects) (err error) {
|
||||
// DrawFilledRects draws filled rectangles on the image.
|
||||
func (i *Image) DrawFilledRects(rects Rects) (err error) {
|
||||
ui.Use(func(c *opengl.Context) {
|
||||
err = i.framebuffer.FillRects(c, rects)
|
||||
err = i.framebuffer.DrawFilledRects(c, rects)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -134,12 +134,12 @@ type Rects interface {
|
||||
Color(i int) color.Color
|
||||
}
|
||||
|
||||
func (f *Framebuffer) FillRects(c *opengl.Context, rects Rects) error {
|
||||
func (f *Framebuffer) DrawFilledRects(c *opengl.Context, rects Rects) error {
|
||||
if err := f.setAsViewport(c); err != nil {
|
||||
return err
|
||||
}
|
||||
p := f.projectionMatrix()
|
||||
return shader.FillRects(c, p, rects)
|
||||
return shader.DrawFilledRects(c, p, rects)
|
||||
}
|
||||
|
||||
func (f *Framebuffer) Pixels(c *opengl.Context) ([]uint8, error) {
|
||||
|
@ -139,7 +139,7 @@ type Rects interface {
|
||||
Color(i int) color.Color
|
||||
}
|
||||
|
||||
func FillRects(c *opengl.Context, projectionMatrix *[4][4]float64, rects Rects) error {
|
||||
func DrawFilledRects(c *opengl.Context, projectionMatrix *[4][4]float64, rects Rects) error {
|
||||
if !initialized {
|
||||
if err := initialize(c); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user