def color_line_h(self, x, y): color_current = colors.near_hue_hsv(self.color_current) return color_current
return color_current def color_line_v(self, x, y): color_current = colors.near_v_hsv(self.color_current) return color_current if __name__ == '__main__': w = 880 h = 440 ps = [] planet_ave = w/12 for i in range(random.randint(1, 3)): ps.append(Planet((w/2+random.normalvariate(0, w/4), h/2 + random.normalvariate(0, h/4)), random.normalvariate(planet_ave, planet_ave))) c = colors.near_hue_hsv(colors.dark_color_hsv()) img = image.Image(w, h) star_density = random.uniform(0.001, 0.05) star_base_color_hsv = colors.dark_color_hsv() for y in range(h): for x in range(w): for p in ps: if p.is_inside((x, y)): c = p.coloring_func(x, y) img.set_pixel(x, y, colorsys.hsv_to_rgb(*c)) break else: if random.random() < star_density: img.set_pixel(x, y, colorsys.hsv_to_rgb(*colors.v_up_to(star_base_color_hsv))) else:
def color_near(self, x, y): return colors.near_hue_hsv(p.base_color_hsv)
max = 1.75 scale = max - min result = (result-min)/scale return result def water_value(x, y, height, max_height): result = height + 0.5*math.fabs(simp1.noise2(x*50, y*50)) result = result / (max_height + 0.5) return result if __name__ == '__main__': w = 880 h = 440 img = image.Image(w, h) land_c = colors.bright_color_hsv() water_c = colors.near_hue_hsv(colorsys.rgb_to_hsv(105/255.0, 216/255.0, 255/255.0)) simp = perlin.SimplexNoise() simp.randomize() ssimp = perlin.SimplexNoise() ssimp.randomize() for y in range(h): for x in range(w): v = normalizer.normalize(height(x/w,y/h), 0.0, 1.0) if v < 0.4: img.set_pixel(x, y, colorsys.hsv_to_rgb(water_c[0], water_c[1], water_value(x/w, y/h, v, 0.4))) else: img.set_pixel(x, y, colorsys.hsv_to_rgb(land_c[0], land_c[1], v))