1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
from typing import Any, List, Optional, Sequence, Text, Tuple, Union, overload, Iterable
from typing_extensions import Protocol
from pygame.bufferproxy import BufferProxy
from pygame.color import Color
from pygame.rect import Rect
from pygame.math import Vector2
_ColorInput = Union[
Color, str, List[int], Tuple[int, int, int], Tuple[int, int, int, int]
]
_RgbaOutput = Tuple[int, int, int, int]
_CanBeRect = Union[
Rect,
Tuple[float, float, float, float],
Tuple[Tuple[float, float], Tuple[float, float]],
List[float],
List[Vector2],
Tuple[Vector2, Vector2],
Iterable[Vector2],
]
class _HasRectAttribute(Protocol):
rect: _CanBeRect
_RectValue = Union[
_CanBeRect, _HasRectAttribute
]
_Coordinate = Union[Tuple[float, float], List[float], Vector2]
class Surface(object):
_pixels_address: int
@overload
def __init__(
self,
size: _Coordinate,
flags: int = ...,
depth: int = ...,
masks: Optional[_ColorInput] = ...,
) -> None: ...
@overload
def __init__(
self, size: _Coordinate, flags: int = ..., surface: Surface = ...,
) -> None: ...
def blit(
self,
source: Surface,
dest: Union[Sequence[float], Rect],
area: Optional[Rect] = ...,
special_flags: int = ...,
) -> Rect: ...
def blits(
self, sequence: Sequence[Union[Surface, Rect]], doreturn: Union[int, bool]
) -> Union[List[Rect], None]: ...
@overload
def convert(self, surface: Surface) -> Surface: ...
@overload
def convert(self, depth: int, flags: int = ...) -> Surface: ...
@overload
def convert(self, masks: _ColorInput, flags: int = ...) -> Surface: ...
@overload
def convert(self) -> Surface: ...
@overload
def convert_alpha(self, surface: Surface) -> Surface: ...
@overload
def convert_alpha(self) -> Surface: ...
def copy(self) -> Surface: ...
def fill(
self,
color: _ColorInput,
rect: Optional[_RectStyle] = ...,
special_flags: int = ...,
) -> Rect: ...
def scroll(self, dx: int = ..., dy: int = ...) -> None: ...
@overload
def set_colorkey(self, color: _ColorInput, flags: int = ...) -> None: ...
@overload
def set_colorkey(self, color: None) -> None: ...
def get_colorkey(self) -> Optional[_RgbaOutput]: ...
@overload
def set_alpha(self, value: int, flags: int = ...) -> None: ...
@overload
def set_alpha(self, value: None) -> None: ...
def get_alpha(self) -> Optional[int]: ...
def lock(self) -> None: ...
def unlock(self) -> None: ...
def mustlock(self) -> bool: ...
def get_locked(self) -> bool: ...
def get_locks(self) -> Tuple[Any, ...]: ...
def get_at(self, x_y: Sequence[int]) -> _RgbaOutput: ...
def set_at(self, x_y: Sequence[int], color: _ColorInput) -> None: ...
def get_at_mapped(self, x_y: Sequence[int]) -> int: ...
def get_palette(self) -> List[_RgbaOutput]: ...
def get_palette_at(self, index: int) -> _RgbaOutput: ...
def set_palette(self, palette: List[_ColorInput]) -> None: ...
def set_palette_at(self, index: int, color: _ColorInput) -> None: ...
def map_rgb(self, color: _ColorInput) -> int: ...
def unmap_rgb(self, mapped_int: int) -> _RgbaOutput: ...
def set_clip(self, rect: Optional[Rect]) -> None: ...
def get_clip(self) -> Rect: ...
@overload
def subsurface(self, rect: Union[_RectStyle, Rect]) -> Surface: ...
@overload
def subsurface(
self,
left_top: Union[List[float], Tuple[float, float], Vector2],
width_height: Union[List[float], Tuple[float, float], Vector2],
) -> Surface: ...
@overload
def subsurface(
self, left: float, top: float, width: float, height: float
) -> Surface: ...
def get_parent(self) -> Surface: ...
def get_abs_parent(self) -> Surface: ...
def get_offset(self) -> Tuple[int, int]: ...
def get_abs_offset(self) -> Tuple[int, int]: ...
def get_size(self) -> Tuple[int, int]: ...
def get_width(self) -> int: ...
def get_height(self) -> int: ...
def get_rect(self, **kwargs) -> Rect: ...
def get_bitsize(self) -> int: ...
def get_bytesize(self) -> int: ...
def get_flags(self) -> int: ...
def get_pitch(self) -> int: ...
def get_masks(self) -> _RgbaOutput: ...
def set_masks(self, color: _ColorInput) -> None: ...
def get_shifts(self) -> _RgbaOutput: ...
def set_shifts(self, color: _ColorInput) -> None: ...
def get_losses(self) -> _RgbaOutput: ...
def get_bounding_rect(self, min_alpha: int = ...) -> Rect: ...
def get_view(self, kind: Text = ...) -> BufferProxy: ...
def get_buffer(self) -> BufferProxy: ...
|