lg = ph.gradient.linear([pal[0], pal[1]], [1, 0], theta=np.pi / 2) C += circle(0, 0, radius - 2 * offset, thickness=tc / 2, gradient=lg) lg = ph.gradient.linear([pal[2], pal[1]], [1, 0], theta=-np.pi / 2) C += circle(0, 0, radius - offset, thickness=tc / 2, gradient=lg) lg = ph.gradient.linear([pal[2], pal[1]], [1, 0], theta=np.pi / 2) C += circle(0, 0, radius + 1.5 * offset, thickness=tc / 2, gradient=lg) # Start a new canvas and load in an image. It will resize automatically. C = Canvas().load("asphalt-dark-dawn-531321.jpg") # Apply the instagram-like filter named 1977. # Use ph.filters.instafilter("") to get a list of all known. C += ph.filters.instafilter("1977") # Start a new layer. This uses the current image as a background, and then # applies it after the context is over. with C.layer() as layer: # Draw the circles, blend, then draw them again. # This makes them have a glowy effect. draw_circles(layer) layer += ph.filters.gaussian_blur() draw_circles(layer) C.save("figures/blue_woods.png") C.show()
# A working file to test various aspects of the module import numpy as np import pixelhouse as ph from pixelhouse import Canvas, Animation, circle, rectangle C = Canvas(width=400, height=400, bg="purple") with C.layer() as CX: CX += circle(x=0, color="w") for i in range(10): CX += ph.filters.gaussian_blur(blur_x=0.25) CX += circle(x=0, color="w") C += circle(x=0, y=2, r=0.7, color="r") C += circle(x=0, y=-2, r=0.7, color="k") C += circle(x=0, y=2, r=0.7, color="r") C.show()
base_r = 0.80 r = base_r + dx lg = linear_gradient(pal[0], pal[1], theta=np.pi / 2) C += ellipse(0, 0, r, r, thickness=tc, gradient=lg) r = base_r - 2 * dx lg = linear_gradient(pal[0], pal[1], theta=-np.pi / 2) C += ellipse(0, 0, r, r, thickness=tc / 2, gradient=lg) r = base_r - dx lg = linear_gradient(pal[2], pal[1], theta=np.pi / 2) C += ellipse(0, 0, r, r, thickness=tc / 2, gradient=lg) r = base_r + 1.5 * dx lg = linear_gradient(pal[2], pal[1], theta=-np.pi / 2) C += ellipse(0, 0, r, r, thickness=tc / 2, gradient=lg) C = Canvas().load("asphalt-dark-dawn-531321.jpg") C += instafilter("1977") with C.layer() as C2: draw_circles(C2) C2 += gaussian_blur() draw_circles(C2) C.save("blue_woods.png") C.show()