|
| 1 | +from typing import Optional, Protocol, Union, final |
| 2 | + |
| 3 | +from pygame.color import Color |
| 4 | +from pygame.rect import Rect |
| 5 | +from pygame.surface import Surface |
| 6 | +from pygame.typing import ColorLike, IntPoint, Point, RectLike, SequenceLike |
| 7 | +from pygame.window import Window |
| 8 | +from typing_extensions import deprecated # added in 3.13 |
| 9 | + |
| 10 | +class _DrawableClass(Protocol): |
| 11 | + # Object that has the draw method that accepts area and dest arguments |
| 12 | + def draw( |
| 13 | + self, area: Optional[RectLike] = None, dest: Optional[RectLike] = None |
| 14 | + ): ... |
| 15 | + |
| 16 | +@final |
| 17 | +class Renderer: |
| 18 | + def __init__( |
| 19 | + self, |
| 20 | + window: Window, |
| 21 | + index: int = -1, |
| 22 | + accelerated: int = -1, |
| 23 | + vsync: bool = False, |
| 24 | + target_texture: bool = False, |
| 25 | + ) -> None: ... |
| 26 | + def blit( |
| 27 | + self, |
| 28 | + source: Union["Texture", "Image", _DrawableClass], |
| 29 | + dest: Optional[RectLike] = None, |
| 30 | + area: Optional[RectLike] = None, |
| 31 | + special_flags: int = 0, |
| 32 | + ) -> Rect: ... |
| 33 | + def clear(self) -> None: ... |
| 34 | + def draw_line(self, p1: Point, p2: Point) -> None: ... |
| 35 | + def draw_point(self, point: Point) -> None: ... |
| 36 | + def draw_quad(self, p1: Point, p2: Point, p3: Point, p4: Point) -> None: ... |
| 37 | + def draw_rect(self, rect: RectLike) -> None: ... |
| 38 | + def draw_triangle(self, p1: Point, p2: Point, p3: Point) -> None: ... |
| 39 | + def fill_quad(self, p1: Point, p2: Point, p3: Point, p4: Point) -> None: ... |
| 40 | + def fill_rect(self, rect: RectLike) -> None: ... |
| 41 | + def fill_triangle(self, p1: Point, p2: Point, p3: Point) -> None: ... |
| 42 | + def get_viewport(self) -> Rect: ... |
| 43 | + def present(self) -> None: ... |
| 44 | + def set_viewport(self, area: Optional[RectLike]) -> None: ... |
| 45 | + def to_surface( |
| 46 | + self, surface: Optional[Surface] = None, area: Optional[RectLike] = None |
| 47 | + ) -> Surface: ... |
| 48 | + @property |
| 49 | + def draw_blend_mode(self) -> int: ... |
| 50 | + @draw_blend_mode.setter |
| 51 | + def draw_blend_mode(self, value: int) -> None: ... |
| 52 | + @property |
| 53 | + def draw_color(self) -> Color: ... |
| 54 | + @draw_color.setter |
| 55 | + def draw_color(self, value: ColorLike) -> None: ... |
| 56 | + @property |
| 57 | + def logical_size(self) -> tuple[int, int]: ... |
| 58 | + @logical_size.setter |
| 59 | + def logical_size(self, value: IntPoint) -> None: ... |
| 60 | + @property |
| 61 | + def scale(self) -> tuple[float, float]: ... |
| 62 | + @scale.setter |
| 63 | + def scale(self, value: Point) -> None: ... |
| 64 | + @property |
| 65 | + def target(self) -> "Texture": ... |
| 66 | + @target.setter |
| 67 | + def target(self, value: "Texture") -> None: ... |
| 68 | + @classmethod |
| 69 | + def compose_custom_blend_mode( |
| 70 | + cls, color_mode: SequenceLike[int], alpha_mode: SequenceLike[int] |
| 71 | + ) -> int: ... |
| 72 | + @classmethod |
| 73 | + def from_window(cls, window: Window) -> Renderer: ... |
| 74 | + |
| 75 | +@final |
| 76 | +class Texture: |
| 77 | + pass |
| 78 | + |
| 79 | +@final |
| 80 | +class Image: |
| 81 | + pass |
0 commit comments