Skip to content

Port Texture to C code #3330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 70 additions & 3 deletions buildconfig/stubs/pygame/_render.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import Optional, Protocol, Union, final
from collections.abc import Iterable
from typing import Any, Optional, Protocol, Union, final

from pygame.color import Color
from pygame.rect import Rect
from pygame.surface import Surface
from pygame.typing import ColorLike, IntPoint, Point, RectLike, SequenceLike
from pygame.window import Window
from typing_extensions import deprecated # added in 3.13

class _DrawableClass(Protocol):
# Object that has the draw method that accepts area and dest arguments
Expand Down Expand Up @@ -74,7 +74,74 @@ class Renderer:

@final
class Texture:
pass
def __init__(
self,
renderer: Renderer,
size: Iterable[int],
depth: int = 0,
static: bool = False,
streaming: bool = False,
target: bool = False,
scale_quality: Optional[int] = None,
) -> None: ...
@property
def alpha(self) -> int: ...
@alpha.setter
def alpha(self, value: int) -> None: ...
@property
def blend_mode(self) -> int: ...
@blend_mode.setter
def blend_mode(self, value: int) -> None: ...
@property
def color(self) -> Color: ...
@color.setter
def color(self, value: ColorLike) -> None: ...
@property
def width(self) -> int: ...
@property
def height(self) -> int: ...
@property
def renderer(self) -> Renderer: ...
@classmethod
def from_surface(cls, renderer: Renderer, surface: Surface) -> Texture: ...
def draw(
self,
srcrect: Optional[RectLike] = None,
dstrect: Optional[RectLike] = None,
angle: float = 0.0,
origin: Optional[Iterable[int]] = None,
flip_x: bool = False,
flip_y: bool = False,
) -> None: ...
def draw_triangle(
self,
p1_xy: Point,
p2_xy: Point,
p3_xy: Point,
p1_uv: Point = (0.0, 0.0),
p2_uv: Point = (1.0, 1.0),
p3_uv: Point = (0.0, 1.0),
p1_mod: Iterable[int] = (255, 255, 255, 255),
p2_mod: Iterable[int] = (255, 255, 255, 255),
p3_mod: Iterable[int] = (255, 255, 255, 255),
) -> None: ...
def draw_quad(
self,
p1_xy: Point,
p2_xy: Point,
p3_xy: Point,
p4_xy: Point,
p1_uv: Point = (0.0, 0.0),
p2_uv: Point = (1.0, 0.0),
p3_uv: Point = (1.0, 1.0),
p4_uv: Point = (0.0, 1.0),
p1_mod: Iterable[int] = (255, 255, 255, 255),
p2_mod: Iterable[int] = (255, 255, 255, 255),
p3_mod: Iterable[int] = (255, 255, 255, 255),
p4_mod: Iterable[int] = (255, 255, 255, 255),
) -> None: ...
def get_rect(self, **kwargs: Any) -> Rect: ...
def update(self, surface: Surface, area: Optional[RectLike] = None) -> None: ...

@final
class Image:
Expand Down
Loading
Loading