diff --git a/manim/renderer/cairo_renderer.py b/manim/renderer/cairo_renderer.py index 351203a871..93be76803f 100644 --- a/manim/renderer/cairo_renderer.py +++ b/manim/renderer/cairo_renderer.py @@ -26,8 +26,13 @@ class CairoRenderer: """A renderer using Cairo. - num_plays : Number of play() functions in the scene. - time: time elapsed since initialisation of scene. + Attributes + ---------- + num_plays : int + Number of play() functions in the scene. + + time : float + Time elapsed since initialisation of scene. """ def __init__( @@ -138,7 +143,6 @@ def update_frame( # TODO Description in Docstring ignore_skipping **kwargs - """ if self.skip_animations and not ignore_skipping: return @@ -160,20 +164,18 @@ def render(self, scene, time, moving_mobjects): self.add_frame(self.get_frame()) def get_frame(self) -> PixelArray: - """ - Gets the current frame as NumPy array. + """Gets the current frame as NumPy array. Returns ------- np.array NumPy array of pixel values of each pixel in screen. - The shape of the array is height x width x 3 + The shape of the array is height x width x 3. """ return np.array(self.camera.pixel_array) def add_frame(self, frame: np.ndarray, num_frames: int = 1): - """ - Adds a frame to the video_file_stream + """Adds a frame to the video_file_stream Parameters ---------- @@ -203,10 +205,7 @@ def freeze_current_frame(self, duration: float): ) def show_frame(self): - """ - Opens the current frame in the Default Image Viewer - of your system. - """ + """Opens the current frame in the Default Image Viewer of your system.""" self.update_frame(ignore_skipping=True) self.camera.get_image().show() @@ -223,7 +222,7 @@ def save_static_frame_data( scene The scene played. static_mobjects - Static mobjects of the scene. If None, self.static_image is set to None + Static mobjects of the scene. If None, self.static_image is set to None. Returns ------- @@ -276,4 +275,4 @@ def scene_finished(self, scene: Scene) -> None: if config["save_last_frame"]: self.static_image = None self.update_frame(scene) - self.file_writer.save_final_image(self.camera.get_image()) + self.file_writer.save_image(self.camera.get_image()) diff --git a/manim/renderer/opengl_renderer.py b/manim/renderer/opengl_renderer.py index 76ecdad54b..15fc6e8850 100644 --- a/manim/renderer/opengl_renderer.py +++ b/manim/renderer/opengl_renderer.py @@ -403,8 +403,7 @@ def get_texture_id(self, path): return self.path_to_texture_id[repr(path)] def update_skipping_status(self) -> None: - """ - This method is used internally to check if the current + """This method is used internally to check if the current animation needs to be skipped or not. It also checks if the number of animations that were played correspond to the number of animations that need to be played, and @@ -506,7 +505,7 @@ def scene_finished(self, scene): if self.should_save_last_frame(): config.save_last_frame = True self.update_frame(scene) - self.file_writer.save_final_image(self.get_image()) + self.file_writer.save_image(self.get_image()) def should_save_last_frame(self): if config["save_last_frame"]: diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py index 257e4301c6..1e0d02f7ec 100644 --- a/manim/scene/scene_file_writer.py +++ b/manim/scene/scene_file_writer.py @@ -483,7 +483,7 @@ def write_frame( ) def output_image( - self, image: Image.Image, target_dir: StrPath, ext: str, zero_pad: bool + self, image: Image.Image, target_dir: StrPath, ext: str, zero_pad: int ) -> None: if zero_pad: image.save(f"{target_dir}{str(self.frame_count).zfill(zero_pad)}{ext}") @@ -491,9 +491,8 @@ def output_image( image.save(f"{target_dir}{self.frame_count}{ext}") self.frame_count += 1 - def save_final_image(self, image: Image.Image) -> None: - """The name is a misnomer. This method saves the image - passed to it as an in the default image directory. + def save_image(self, image: Image.Image) -> None: + """This method saves the image passed to it in the default image directory. Parameters ----------