ebiten/graphics/graphics.go

35 lines
598 B
Go
Raw Normal View History

2013-06-19 01:49:54 +02:00
package graphics
import (
"image"
"image/color"
)
type Device interface {
Update()
}
type GraphicsContext interface {
Clear()
Fill(color color.Color)
2013-06-19 03:31:44 +02:00
DrawTexture(texture *Texture,
2013-06-19 01:49:54 +02:00
srcX, srcY, srcWidth, srcHeight int,
geometryMatrix *GeometryMatrix, colorMatrix *ColorMatrix)
2013-06-19 03:31:44 +02:00
SetOffscreen(texture *Texture)
2013-06-19 01:49:54 +02:00
}
2013-06-19 03:31:44 +02:00
type Texture struct {
Width int
Height int
Image image.Image
}
func NewTexture(width, height int) *Texture {
return &Texture{width, height, nil}
}
func NewTextureFromImage(img image.Image) *Texture {
size := img.Bounds().Size()
return &Texture{size.X, size.Y, img}
2013-06-19 01:49:54 +02:00
}