1414
1515import cairo
1616import numpy as np
17+ import numpy .typing as npt
1718from PIL import Image
1819from scipy .spatial .distance import pdist
1920from typing_extensions import Self
2021
21- from manim .typing import MatrixMN , PixelArray , Point3D , Point3D_Array
22+ from manim .typing import (
23+ FloatRGBA_Array ,
24+ FloatRGBALike_Array ,
25+ ManimInt ,
26+ PixelArray ,
27+ Point3D ,
28+ Point3D_Array ,
29+ )
2230
2331from .. import config , logger
2432from ..constants import *
@@ -211,8 +219,8 @@ def type_or_raise(
211219 type [Mobject ], Callable [[list [Mobject ], PixelArray ], Any ]
212220 ] = {
213221 VMobject : self .display_multiple_vectorized_mobjects , # type: ignore[dict-item]
214- PMobject : self .display_multiple_point_cloud_mobjects ,
215- AbstractImageMobject : self .display_multiple_image_mobjects ,
222+ PMobject : self .display_multiple_point_cloud_mobjects , # type: ignore[dict-item]
223+ AbstractImageMobject : self .display_multiple_image_mobjects , # type: ignore[dict-item]
216224 Mobject : lambda batch , pa : batch , # Do nothing
217225 }
218226 # We have to check each type in turn because we are dealing with
@@ -723,7 +731,7 @@ def set_cairo_context_path(self, ctx: cairo.Context, vmobject: VMobject) -> Self
723731 return self
724732
725733 def set_cairo_context_color (
726- self , ctx : cairo .Context , rgbas : MatrixMN , vmobject : VMobject
734+ self , ctx : cairo .Context , rgbas : FloatRGBALike_Array , vmobject : VMobject
727735 ) -> Self :
728736 """Sets the color of the cairo context
729737
@@ -818,7 +826,7 @@ def apply_stroke(
818826
819827 def get_stroke_rgbas (
820828 self , vmobject : VMobject , background : bool = False
821- ) -> PixelArray :
829+ ) -> FloatRGBA_Array :
822830 """Gets the RGBA array for the stroke of the passed
823831 VMobject.
824832
@@ -837,7 +845,7 @@ def get_stroke_rgbas(
837845 """
838846 return vmobject .get_stroke_rgbas (background )
839847
840- def get_fill_rgbas (self , vmobject : VMobject ) -> PixelArray :
848+ def get_fill_rgbas (self , vmobject : VMobject ) -> FloatRGBA_Array :
841849 """Returns the RGBA array of the fill of the passed VMobject
842850
843851 Parameters
@@ -898,7 +906,7 @@ def display_multiple_background_colored_vmobjects(
898906 # As a result, the other methods do not have as detailed docstrings as would be preferred.
899907
900908 def display_multiple_point_cloud_mobjects (
901- self , pmobjects : list , pixel_array : PixelArray
909+ self , pmobjects : Iterable [ PMobject ] , pixel_array : PixelArray
902910 ) -> None :
903911 """Displays multiple PMobjects by modifying the passed pixel array.
904912
@@ -921,8 +929,8 @@ def display_multiple_point_cloud_mobjects(
921929 def display_point_cloud (
922930 self ,
923931 pmobject : PMobject ,
924- points : list ,
925- rgbas : np . ndarray ,
932+ points : Point3D_Array ,
933+ rgbas : FloatRGBA_Array ,
926934 thickness : float ,
927935 pixel_array : PixelArray ,
928936 ) -> None :
@@ -972,7 +980,9 @@ def display_point_cloud(
972980 pixel_array [:, :] = new_pa .reshape ((ph , pw , rgba_len ))
973981
974982 def display_multiple_image_mobjects (
975- self , image_mobjects : list , pixel_array : np .ndarray
983+ self ,
984+ image_mobjects : Iterable [AbstractImageMobject ],
985+ pixel_array : PixelArray ,
976986 ) -> None :
977987 """Displays multiple image mobjects by modifying the passed pixel_array.
978988
@@ -1121,8 +1131,8 @@ def transform_points_pre_display(
11211131 def points_to_pixel_coords (
11221132 self ,
11231133 mobject : Mobject ,
1124- points : np . ndarray ,
1125- ) -> np . ndarray : # TODO: Write more detailed docstrings for this method.
1134+ points : Point3D_Array ,
1135+ ) -> npt . NDArray [ ManimInt ] : # TODO: Write more detailed docstrings for this method.
11261136 points = self .transform_points_pre_display (mobject , points )
11271137 shifted_points = points - self .frame_center
11281138
0 commit comments