@@ -67,13 +67,19 @@ def update(self, *, center_x, center_y, radius, width, height, max_iterations=25
67
67
radius_pixels = min (width , height ) / 2
68
68
step = radius / radius_pixels
69
69
70
+ self .radius = radius
71
+ self .center_x = center_x
72
+ self .center_y = center_y
70
73
self .step = float2fix (step )
71
74
self .corner_x = float2fix (center_x - (width / 2 ) * step )
72
75
self .corner_y = float2fix (center_y - (height / 2 ) * step )
73
76
self .width = width
74
77
self .height = height
75
78
self .max_iterations = max_iterations
76
79
80
+ def update_size (self , width , height , iterations ):
81
+ self .update (center_x = self .center_x , center_y = self .center_y , radius = self .radius , width = width , height = height , max_iterations = iterations )
82
+
77
83
def get_center (self ):
78
84
center_x = fix2float (self .corner_x ) + fix2float (self .step ) * (self .width / 2 )
79
85
center_y = fix2float (self .corner_y ) + fix2float (self .step ) * (self .height / 2 )
@@ -304,9 +310,14 @@ def onDraw(self, canvas: DrawingArea, cr: cairo.Context):
304
310
elif argv [1 ] == "png" :
305
311
tstart = time .perf_counter ()
306
312
307
- if len (argv ) == 4 :
308
- view .width = int (argv [2 ])
309
- view .height = int (argv [3 ])
313
+ if len (argv ) >= 4 :
314
+ width = int (argv [2 ])
315
+ height = int (argv [3 ])
316
+ if (len (argv ) == 5 ):
317
+ iterations = int (argv [4 ])
318
+ view .update_size (width , height , iterations )
319
+ else :
320
+ view .update_size (width , height , 170 )
310
321
311
322
print ("Rendering view to PNG:" )
312
323
lower_left = view .get_lower_left_corner ()
0 commit comments