Adding render/palette.go
This commit is contained in:
parent
575791cfc1
commit
0364f6ca9e
1 changed files with 15 additions and 0 deletions
15
render/palette.go
Normal file
15
render/palette.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package render
|
||||
|
||||
import "github.com/pnx/go-raytracer/graphics"
|
||||
|
||||
func DrawPalette(ctx *graphics.Context, w, h int32) {
|
||||
y := int32(0)
|
||||
for i := range int32(255) {
|
||||
|
||||
if i > 0 && (i%0x10) == 0 {
|
||||
y += 1
|
||||
}
|
||||
|
||||
ctx.DrawRect(int32((i%0x10)*w), int32(y*h), int32(w), int32(h), byte(i))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue