cmd,example: fix uses of color.NRGBA

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
Egon Elbre
2020-11-18 20:40:38 +02:00
committed by Elias Naur
parent 21ef492cc9
commit 2affb6eaa4
10 changed files with 32 additions and 35 deletions
+6 -6
View File
@@ -96,11 +96,11 @@ func runEndToEndTest(t *testing.T, driver TestDriver) {
t.Log("starting driver and gio app")
driver.Start("testdata/red.go")
beef := color.RGBA{R: 0xde, G: 0xad, B: 0xbe}
white := color.RGBA{R: 0xff, G: 0xff, B: 0xff}
black := color.RGBA{R: 0x00, G: 0x00, B: 0x00}
gray := color.RGBA{R: 0xbb, G: 0xbb, B: 0xbb}
red := color.RGBA{R: 0xff, G: 0x00, B: 0x00}
beef := color.NRGBA{R: 0xde, G: 0xad, B: 0xbe, A: 0xff}
white := color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
black := color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff}
gray := color.NRGBA{R: 0xbb, G: 0xbb, B: 0xbb, A: 0xff}
red := color.NRGBA{R: 0xff, G: 0x00, B: 0x00, A: 0xff}
// These are the four colors at the beginning.
t.Log("taking initial screenshot")
@@ -181,7 +181,7 @@ func (m colorMismatch) String() string {
)
}
func checkImageCorners(img image.Image, topLeft, topRight, botLeft, botRight color.RGBA) error {
func checkImageCorners(img image.Image, topLeft, topRight, botLeft, botRight color.Color) error {
// The colors are split in four rectangular sections. Check the corners
// of each of the sections. We check the corners left to right, top to
// bottom, like when reading left-to-right text.
+7 -7
View File
@@ -47,16 +47,16 @@ type (
func loop(w *app.Window) error {
topLeft := quarterWidget{
color: color.RGBA{R: 0xde, G: 0xad, B: 0xbe, A: 0xff},
color: color.NRGBA{R: 0xde, G: 0xad, B: 0xbe, A: 0xff},
}
topRight := quarterWidget{
color: color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff},
color: color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff},
}
botLeft := quarterWidget{
color: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff},
color: color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff},
}
botRight := quarterWidget{
color: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x80},
color: color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x80},
}
var ops op.Ops
@@ -103,15 +103,15 @@ func loop(w *app.Window) error {
// quarterWidget paints a quarter of the screen with one color. When clicked, it
// turns red, going back to its normal color when clicked again.
type quarterWidget struct {
color color.RGBA
color color.NRGBA
clicked bool
}
var red = color.RGBA{R: 0xff, G: 0x00, B: 0x00, A: 0xff}
var red = color.NRGBA{R: 0xff, G: 0x00, B: 0x00, A: 0xff}
func (w *quarterWidget) Layout(gtx layout.Context) layout.Dimensions {
var color color.RGBA
var color color.NRGBA
if w.clicked {
color = red
} else {