17 lines
254 B
Go
17 lines
254 B
Go
|
package sdlui
|
||
|
|
||
|
import (
|
||
|
"image"
|
||
|
"image/draw"
|
||
|
)
|
||
|
|
||
|
func RGBAImage(m image.Image) *image.RGBA {
|
||
|
rgba, ok := m.(*image.RGBA)
|
||
|
if ok {
|
||
|
return rgba
|
||
|
}
|
||
|
rgba = image.NewRGBA(m.Bounds())
|
||
|
draw.Draw(rgba, rgba.Bounds(), m, image.ZP, draw.Over)
|
||
|
return rgba
|
||
|
}
|