diff options
| author | Martin Lehoux <martin@lehoux.net> | 2020-04-04 14:32:39 -0700 |
|---|---|---|
| committer | Martin Lehoux <martin@lehoux.net> | 2020-04-04 14:32:39 -0700 |
| commit | 658fd1f722932837901c11ae53eedf130ec662fd (patch) | |
| tree | 5a35aee49c26e301e08547616b518193e8a55960 | |
| parent | cf93fc792d70f95fe08f76e8449adeef76fa1686 (diff) | |
misc - Main use color
| -rw-r--r-- | main.go | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -7,11 +7,12 @@ func main() { frame := Frame{} for x := 0; x < HEIGHT; x++ { for y := 0; y < WIDTH; y++ { - frame[HEIGHT-1-x][y] = Pixel{ - r: 255 * y / WIDTH, - g: 255 * x / HEIGHT, - b: 255 * 0.2, + color := Color{ + float64(y) / float64(WIDTH), + float64(x) / float64(HEIGHT), + 0.2, } + frame[HEIGHT-1-x][y] = color.ToPixel() } } frame.Save("img.ppm") |
