setColor only does black and white
iffy opened this issue · comments
I suspect I'm doing something wrong, but here's what I'm seeing:
import pixie
let i1 = newImage(10, 10)
i1.setColor(0, 0, color(255, 0, 0, 1))
i1.setColor(1, 1, color(0, 255, 0, 1))
i1.setColor(2, 2, color(0, 0, 255, 1))
i1.writeFile("i1.png")
Running that produces a black and white image:
How do I set pixel colors with color?
I see the issue here: color()
expects float values from 0 to 1. In this code above you're using 255 for the color channel which but then 1 for the alpha channel. You'll either want to use color(1, 0, 0, 1)
or rgba(255, 0, 0, 255)
.
derp... Thank you!