Skip to content

Commit

Permalink
Perfection
Browse files Browse the repository at this point in the history
  • Loading branch information
AwesomeDude091 committed Nov 17, 2022
1 parent 596a67d commit 9acf798
Show file tree
Hide file tree
Showing 18 changed files with 13 additions and 4 deletions.
Binary file added 0-rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3-rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4-rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 5-rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 13 additions & 4 deletions MandelView.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import cv2
import pygame
from PIL import Image
from screeninfo import get_monitors
Expand All @@ -23,11 +24,12 @@ def __init__(self, width, height, cores, iterations, color_iterations):
self.img = None

def start(self):
index = 0
monitor = None
for m in get_monitors():
if m.is_primary:
monitor = m
brot = Mandelbrot(self.width, self.height, self.cores, self.iterations, debug=False,
brot = Mandelbrot(self.width, self.height, self.cores, self.iterations, debug=True,
color_iteration=self.color_iterations)
brot.generate_image(-8/3, 8/3, -1.5)
data = brot.get_image_array()
Expand All @@ -40,6 +42,7 @@ def start(self):
pygame.mouse.set_cursor(pygame.SYSTEM_CURSOR_CROSSHAIR)
pygame.display.set_caption('Mandelbulb')
screen.blit(self.pilImageToSurface(tempImg), (0, 0))
pygame.image.save(screen, str(index) + '.png')
pygame.display.flip()
first_click = True
image_ready = False
Expand All @@ -60,8 +63,8 @@ def start(self):
self.end_x, self.end_y = pygame.mouse.get_pos()
height = (self.end_x - self.start_x) / (16 / 9)
local = (self.end_y + self.start_y) / 2
self.end_y = local + height
self.start_y = local - height
self.end_y = local + height / 2
self.start_y = local - height / 2
pygame.draw.rect(screen, (255, 255, 255), pygame.Rect(self.start_x, self.start_y,
(self.end_x - self.start_x),
(self.end_y - self.start_y)), 2)
Expand All @@ -70,13 +73,19 @@ def start(self):
image_ready = True
elif e.type == pygame.KEYDOWN:
if pygame.key.name(e.key) == 'return' and image_ready:
pygame.image.save(screen, str(index) + '-rect.png')
self.img = self.give_game_image(monitor)
screen.blit(self.pilImageToSurface(self.img), (0, 0))
pygame.display.flip()
index += 1
pygame.image.save(screen, str(index) + '.png')
image_ready = False
elif pygame.key.name(e.key) == 'q':
pygame.quit()

def set_iterations(self, iterations):
self.iterations = iterations

def give_game_image(self, monitor):
brot = Mandelbrot(self.width, self.height, self.cores, self.iterations, debug=True,
color_iteration=self.color_iterations)
Expand Down Expand Up @@ -106,4 +115,4 @@ def pilImageToSurface(pilImage):


if __name__ == '__main__':
MandelView(3840, 2160, 16, 256, 8).start()
MandelView(3840, 2160, 24, 16384, 1).start()
Binary file modified __pycache__/Mandelbrot.cpython-310.pyc
Binary file not shown.
Binary file added tes-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9acf798

Please sign in to comment.