Commit fac22198 authored by santiaago's avatar santiaago
Browse files

first draft of func Palette in jpeg format #31

parent 71bfaad6
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -5,6 +5,15 @@ import (
	"image/color"
)

// Palette builds an image with all the colors present in the theme array.
func Palette(m *image.RGBA, theme []color.RGBA) {

	size := m.Bounds().Size()
	numColors := len(theme)
	quadrant := size.X / numColors
	for x := 0; x < size.X; x++ {
		currentQuadrant := (x / quadrant) % numColors
		for y := 0; y < size.Y; y++ {
			m.Set(x, y, theme[currentQuadrant])
		}
	}
}