示例#1
0
    def get_shape(self) -> tuples.ImageShape:
        # self.q_scroll_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        # self.q_scroll_area.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)

        x = self._q_scroll_area.viewport().width()
        y = self._q_scroll_area.viewport().height()

        # self.q_scroll_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        # self.q_scroll_area.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)

        return tuples.ImageShape(x, y)
示例#2
0
    def add_border(self, mandel: mandelbrot.Mandel):
        border_size = 14 * 4 * 10  # add 5 large boxes in all directions
        current_shape = mandel.shape
        new_shape = tuples.ImageShape(current_shape.x + border_size * 2,
                                      current_shape.y + border_size * 2)
        self.new_mandel = mandel.lite_copy(shape=new_shape, has_border=True)

        offset = tuples.PixelPoint(x=-border_size, y=-border_size)

        job = mandelbrot.MandelJob(
            compute_manager=self._compute_manager,
            new_mandel=self.new_mandel,
            prev_mandel=mandel,
            offset=offset,
            display_progress=False,  # background job
            save_history=False)
        self._calc_thread_manager.request_job(job,
                                              queue_as=thread.QueueAs.ENQUEUE)
示例#3
0
    def build(self, frame_shape: tuples.ImageShape):
        self._frame_shape = frame_shape
        self.displayed_mandel = self._initial_mandel()
        # self.displayed_mandel = self._sticky_mandel()
        # self.displayed_mandel = self._slow_mandel()
        # self.displayed_mandel = self._different_mandel()
        self.new_mandel = self.displayed_mandel.lite_copy()
        self._compute_manager = mandelbrot.ComputeManager(MAX_ITERATIONS)
        self._calc_thread_manager = thread.Manager(
            on_progress_update=self._on_progress_update,
            # on_active_change=self._on_active_change,
            on_stop_success=self._on_stop_success,
            on_job_complete=self._on_job_complete)
        self.z_model = z_model.ZModel()
        # self.z_model.build(z0=complex(real=0.24091, imag=0.55),
        self.z_model.build(z0=self.displayed_mandel.centre,
                           image_shape=tuples.ImageShape(x=700, y=700))

        self._calc_thread_manager.start_thread()
示例#4
0
 def _get_shape(self, data: np.ndarray):
     height, width = data.shape
     return tuples.ImageShape(x=width, y=height)