Rename image.FillRect -> DrawFilledRect (FillRect is confusing with Fill)

This commit is contained in:
Hajime Hoshi 2015-01-18 04:19:38 +09:00
parent 719cc03123
commit 0bd0a4dbc2
5 changed files with 12 additions and 12 deletions

View File

@ -120,7 +120,7 @@ func init() {
} }
func drawWindow(r *ebiten.Image, x, y, width, height int) error { 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} var fontColor = color.NRGBA{0x40, 0x40, 0xff, 0xff}

View File

@ -31,8 +31,8 @@ func update(screen *ebiten.Image) error {
for i := 0; i < 6; i++ { for i := 0; i < 6; i++ {
screen.DrawRect(2*i, 2*i, 100, 100, color.NRGBA{0x80, 0x80, 0xff, 0x80}) 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.DrawFilledRect(10, 10, 100, 100, color.NRGBA{0x80, 0x80, 0xff, 0x80})
screen.FillRect(20, 20, 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(130, 0, 140, 100, color.NRGBA{0xff, 0x80, 0x80, 0x80})
screen.DrawLine(140, 0, 150, 100, color.NRGBA{0xff, 0x80, 0x80, 0x80}) screen.DrawLine(140, 0, 150, 100, color.NRGBA{0xff, 0x80, 0x80, 0x80})

View File

@ -118,15 +118,15 @@ func (i *Image) DrawRects(rects Rects) error {
return i.DrawLines(&rectsAsLines{rects}) return i.DrawLines(&rectsAsLines{rects})
} }
// FillRect draws a filled rectangle. // DrawFilledRect draws a filled rectangle.
func (i *Image) FillRect(x, y, width, height int, clr color.Color) error { func (i *Image) DrawFilledRect(x, y, width, height int, clr color.Color) error {
return i.FillRects(&rect{x, y, width, height, clr}) return i.DrawFilledRects(&rect{x, y, width, height, clr})
} }
// FillRects draws filled rectangles on the image. // DrawFilledRects draws filled rectangles on the image.
func (i *Image) FillRects(rects Rects) (err error) { func (i *Image) DrawFilledRects(rects Rects) (err error) {
ui.Use(func(c *opengl.Context) { ui.Use(func(c *opengl.Context) {
err = i.framebuffer.FillRects(c, rects) err = i.framebuffer.DrawFilledRects(c, rects)
}) })
return return
} }

View File

@ -134,12 +134,12 @@ type Rects interface {
Color(i int) color.Color 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 { if err := f.setAsViewport(c); err != nil {
return err return err
} }
p := f.projectionMatrix() p := f.projectionMatrix()
return shader.FillRects(c, p, rects) return shader.DrawFilledRects(c, p, rects)
} }
func (f *Framebuffer) Pixels(c *opengl.Context) ([]uint8, error) { func (f *Framebuffer) Pixels(c *opengl.Context) ([]uint8, error) {

View File

@ -139,7 +139,7 @@ type Rects interface {
Color(i int) color.Color 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 !initialized {
if err := initialize(c); err != nil { if err := initialize(c); err != nil {
return err return err