You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
586 B

  1. package main
  2. import (
  3. "git.aiterp.net/lucifer3/server/internal/color"
  4. "image"
  5. color2 "image/color"
  6. "image/png"
  7. "log"
  8. "os"
  9. )
  10. func main() {
  11. img := image.NewRGBA(image.Rect(0, 0, 500, 500))
  12. for y := 0; y < 500; y += 1 {
  13. for x := 0; x < 500; x += 1 {
  14. rgb := (color.XY{X: float64(x) / 499, Y: float64(y) / 499}).ToRGB()
  15. if y == 300 {
  16. log.Println(rgb.Red, rgb.Green, rgb.Blue)
  17. }
  18. img.Set(x, y, color2.RGBA{
  19. R: uint8(rgb.Red * 255.0),
  20. G: uint8(rgb.Green * 255.0),
  21. B: uint8(rgb.Blue * 255.0),
  22. A: 255,
  23. })
  24. }
  25. }
  26. _ = png.Encode(os.Stdout, img)
  27. }