def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=3.2, startx=-1.6, starty=-1.2) for px in range(pixel_width): for py in range(pixel_height): x, y = scaler.device_to_user(px, py) count = calc(x, y) image[py, px] = count
def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=3, startx=-2, starty=-2) x = 0.01 y = 0.01 for i in range(MAX_COUNT): x, y = x * x - y * y + A * x + B * y, 2 * x * y + C * x + D * y px, py = scaler.user_to_device(x, y) image[py, px] += 1
def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=3, height=2, startx=-1.5, starty=-1) draw = ImageDraw.Draw(image) a = 1.4 b = 0.3 x, y = 0, 0 for i in range(10000): draw.point(scaler.user_to_device(x, y), fill=Color("black").as_rgbstr()) x, y = 1 - a*x*x + y, b*x
def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=4, startx=-2, starty=-2) x = 2 y = 2 for i in range(MAX_COUNT): x, y = math.sin(A * x) + B * math.sin(A * y), math.sin( C * x) + D * math.sin(C * y) px, py = scaler.user_to_device(x, y) image[py, px] += 1
def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=12, startx=-3.5, starty=-3.5) x = -0.1 y = 0.0 for i in range(MAX_COUNT): x, y = 1 - y + abs(x), x px, py = scaler.user_to_device(x, y) image[py, px] = 0
def paint2(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=.5, startx=0.8, starty=-0.25) x = 0.01 y = 0.01 for i in range(MAX_COUNT): x, y = 1 - A * x * x + y, B * x px, py = scaler.user_to_device(x, y) if 0 <= px < pixel_width and 0 <= py < pixel_height: image[py, px] = 0
def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=300, startx=-150, starty=-150) x = -1 y = 0 for i in range(MAX_COUNT): x, y = y - math.sqrt(abs(B * x - C)) * sign(x), A - x px, py = scaler.user_to_device(x, y) if 0 <= px < pixel_width and 0 <= py < pixel_height: image[py, px] += 1
def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=3, startx=-1.5, starty=-1.5) for px in range(pixel_width): for py in range(pixel_height): x, y = scaler.device_to_user(px, py) z = complex(x, y) image[py, px] = MAX_COUNT for i in range(MAX_COUNT): z = iterate(z) if converged(z) > 0: image[py, px] = i break
def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=3, height=2, startx=-2, starty=-1) draw = ImageDraw.Draw(image) a = 1.4 b = 0.3 x, y = 0, 0 for i in range(pixel_width): for j in range(pixel_height): c = complex(*scaler.device_to_user(i, j)) if not mandelbrot(c): draw.point((i, j), fill=Color("black").as_rgbstr())
def paint(image, pixel_width, pixel_height, frame_no, frame_count): scaler = Scaler(pixel_width, pixel_height, width=USERWIDTH, startx=-USERWIDTH / 2, starty=-USERWIDTH / 2) image[...] = 0 for i in range(0, WIDTH, 1): print(i) for j in range(0, WIDTH, 1): x, y = scaler.device_to_user(i, j) for _ in range(MAX_COUNT): x, y = calc(x, y) px, py = scaler.user_to_device(x, y) if 0 <= px < WIDTH and 0 <= py < WIDTH: image[py, px] += 1
from generativepy.bitmap import Scaler scaler = Scaler(300, 200, width=3, height=2, startx=-1.5, starty=-1) print(scaler.user_to_device(1, .5)) print(scaler.device_to_user(20, 50))