-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.go
More file actions
29 lines (24 loc) · 607 Bytes
/
Copy pathimage.go
File metadata and controls
29 lines (24 loc) · 607 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package impress
import (
"image"
"github.com/codeation/impress/driver"
)
// Image represents a drawable image.
type Image struct {
imager driver.Imager
Size image.Point
}
// NewImage returns an Image struct containing the image resources.
func (app *Application) NewImage(img image.Image) *Image {
imager := app.driver.NewImage(img)
return &Image{
imager: imager,
Size: imager.Size(),
}
}
// Close destroys the image resources.
// Note that a closed image can no longer be used.
func (i *Image) Close() {
i.imager.Close()
i.imager = nil // TODO: Add notice when the image is closed.
}