mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
Remove internal.RGBA
This commit is contained in:
parent
28983e4e24
commit
b57c675996
9
image.go
9
image.go
@ -23,6 +23,7 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/internal/ui"
|
||||
"image"
|
||||
"image/color"
|
||||
"math"
|
||||
)
|
||||
|
||||
// Image represents an image.
|
||||
@ -47,7 +48,13 @@ func (i *Image) Clear() (err error) {
|
||||
// Fill fills the image with a solid color.
|
||||
func (i *Image) Fill(clr color.Color) (err error) {
|
||||
i.pixels = nil
|
||||
r, g, b, a := internal.RGBA(clr)
|
||||
//r, g, b, a := internal.RGBA(clr)
|
||||
cr, cg, cb, ca := clr.RGBA()
|
||||
const max = math.MaxUint16
|
||||
r := float64(cr) / max
|
||||
g := float64(cg) / max
|
||||
b := float64(cb) / max
|
||||
a := float64(ca) / max
|
||||
ui.Use(func(c *opengl.Context) {
|
||||
// TODO: Change to pass color.Color
|
||||
err = i.framebuffer.Fill(c, r, g, b, a)
|
||||
|
@ -14,11 +14,6 @@
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
"math"
|
||||
)
|
||||
|
||||
func NextPowerOf2Int(x int) int {
|
||||
x -= 1
|
||||
x |= (x >> 1)
|
||||
@ -28,13 +23,3 @@ func NextPowerOf2Int(x int) int {
|
||||
x |= (x >> 16)
|
||||
return x + 1
|
||||
}
|
||||
|
||||
func RGBA(clr color.Color) (r, g, b, a float64) {
|
||||
cr, cg, cb, ca := clr.RGBA()
|
||||
const max = math.MaxUint16
|
||||
r = float64(cr) / max
|
||||
g = float64(cg) / max
|
||||
b = float64(cb) / max
|
||||
a = float64(ca) / max
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user