@@ -675,29 +675,33 @@ def draw_lines(self, points: NDArray[np.number] | Sequence[tuple[float, float]])
675675 def geometry (
676676 self ,
677677 texture : Texture | None ,
678- xy : NDArray [np .float32 ],
679- color : NDArray [np .uint8 ],
680- uv : NDArray [np .float32 ],
678+ xy : NDArray [np .float32 ] | Sequence [ tuple [ float , float ]] ,
679+ color : NDArray [np .uint8 ] | Sequence [ tuple [ int , int , int , int ]] ,
680+ uv : NDArray [np .float32 ] | Sequence [ tuple [ float , float ]] ,
681681 indices : NDArray [np .uint8 | np .uint16 | np .uint32 ] | None = None ,
682682 ) -> None :
683683 """Render triangles from texture and vertex data.
684684
685+ Args:
686+ texture: The SDL texture to render from.
687+ xy: A sequence of (x, y) points to buffer.
688+ color: A sequence of (r, g, b, a) colors to buffer.
689+ uv: A sequence of (x, y) coordinates to buffer.
690+ indices: A sequence of indexes referring to the buffered data, every 3 indexes is a triangle to render.
691+
685692 .. versionadded:: 13.5
686693 """
687- assert xy . dtype == np .float32
694+ xy = np .ascontiguousarray ( xy , np . float32 )
688695 assert len (xy .shape ) == 2 # noqa: PLR2004
689696 assert xy .shape [1 ] == 2 # noqa: PLR2004
690- assert xy [0 ].flags .c_contiguous
691697
692- assert color . dtype == np .uint8
698+ color = np .ascontiguousarray ( color , np . uint8 )
693699 assert len (color .shape ) == 2 # noqa: PLR2004
694700 assert color .shape [1 ] == 4 # noqa: PLR2004
695- assert color [0 ].flags .c_contiguous
696701
697- assert uv . dtype == np .float32
702+ uv = np .ascontiguousarray ( uv , np . float32 )
698703 assert len (uv .shape ) == 2 # noqa: PLR2004
699704 assert uv .shape [1 ] == 2 # noqa: PLR2004
700- assert uv [0 ].flags .c_contiguous
701705 if indices is not None :
702706 assert indices .dtype .type in (np .uint8 , np .uint16 , np .uint32 , np .int8 , np .int16 , np .int32 )
703707 indices = np .ascontiguousarray (indices )
@@ -709,7 +713,7 @@ def geometry(
709713 texture .p if texture else ffi .NULL ,
710714 ffi .cast ("float*" , xy .ctypes .data ),
711715 xy .strides [0 ],
712- ffi .cast ("uint8_t *" , color .ctypes .data ),
716+ ffi .cast ("SDL_Color *" , color .ctypes .data ),
713717 color .strides [0 ],
714718 ffi .cast ("float*" , uv .ctypes .data ),
715719 uv .strides [0 ],
0 commit comments