aboutsummaryrefslogtreecommitdiff
path: root/image.go
diff options
context:
space:
mode:
Diffstat (limited to 'image.go')
-rw-r--r--image.go24
1 files changed, 17 insertions, 7 deletions
diff --git a/image.go b/image.go
index 035ca81..35101e0 100644
--- a/image.go
+++ b/image.go
@@ -121,7 +121,7 @@ func imageFromColors(colors []color.Color, w int, h int) (image.Image, error) {
case "random":
return randomImage(colors, w, h), nil
case "circles":
- return Circles(colors, w, h, *circleSize, *circleSizeVariance, *circleOverlap, *circleDrawLargestToSmallest, *circleFilled, *circleBorderSize), nil
+ return Circles(colors, w, h, *circlesSize, *circlesSizeVariance, *circlesOverlap, *circlesDrawLargestToSmallest, *circlesFilled, *circlesBorderSize), nil
case "rays":
return Rays(colors, w, h, *raysSize, *raysSizeVariance, *raysDistributeEvenly, *raysCentered, *raysDrawLargestToSmallest), nil
case "stripes":
@@ -148,14 +148,17 @@ func Circles(colors []color.Color, w int, h int, size int, sizevar int, overlap
img := image.NewNRGBA(image.Rect(0, 0, w, h))
circles := make([]Circle, 0)
+ bg := colors[0]
for _, c := range colors {
+ // Do not create circle with background color
+ if c == bg {
+ continue
+ }
circle := Circle{c, rand.Intn(w), rand.Intn(h), randMinMax(size-sizevar, size+sizevar)}
circles = append(circles, circle)
}
- bg := colors[0]
-
if large2small {
sort.Sort(sort.Reverse(circleBySize(circles)))
}
@@ -207,7 +210,13 @@ func Rays(colors []color.Color, w int, h int, size int, sizevar int, evendist bo
xpos := w / 2
ypos := h / 2
+ bg := colors[0]
+
for _, c := range colors {
+ // Do not create ray with background color
+ if c == bg {
+ continue
+ }
var ray Ray
if !centered {
xpos = rand.Intn(w)
@@ -228,8 +237,6 @@ func Rays(colors []color.Color, w int, h int, size int, sizevar int, evendist bo
sort.Sort(sort.Reverse(rayBySize(rays)))
}
- bg := colors[0]
-
for x := 0; x < w; x++ {
for y := 0; y < h; y++ {
img.Set(x, y, bg)
@@ -268,8 +275,13 @@ func Lines(colors []color.Color, w int, h int, size int, sizevar int, horizontal
spacing := spacingsize
lines := make([]Line, 0)
+ bg := colors[0]
for _, c := range colors {
+ // Do not create line with background color
+ if c == bg {
+ continue
+ }
line := Line{c, currentposition, randMinMax(size-sizevar, size+sizevar)}
lines = append(lines, line)
if !equalspacing {
@@ -278,8 +290,6 @@ func Lines(colors []color.Color, w int, h int, size int, sizevar int, horizontal
currentposition += line.size + spacing
}
- bg := colors[0]
-
for x := 0; x < w; x++ {
for y := 0; y < h; y++ {
img.Set(x, y, bg)