mini_arcade_native_backend.ports.render ======================================= .. py:module:: mini_arcade_native_backend.ports.render .. autoapi-nested-parse:: Render port implementation for the native backend. Provides functionality to draw shapes and manage rendering state. Classes ------- .. autoapisummary:: mini_arcade_native_backend.ports.render.RenderPort Module Contents --------------- .. py:class:: RenderPort(native_backend: mini_arcade_native_backend._native.Backend, vp: mini_arcade_core.backend.viewport.ViewportTransform) Render port for the Mini Arcade native backend. :param native_backend: The native backend instance. :type native_backend: native.Backend :param vp: The viewport transform. :type vp: ViewportTransform .. py:method:: set_clear_color(r: int, g: int, b: int) Set the clear color for the renderer. :param r: Red component (0-255). :type r: int :param g: Green component (0-255). :type g: int :param b: Blue component (0-255). :type b: int .. py:method:: begin_frame() Begin a new rendering frame. .. py:method:: end_frame() End the current rendering frame. .. py:method:: draw_rect(x: int, y: int, w: int, h: int, color=(255, 255, 255)) Draw a filled rectangle. :param x: The x-coordinate of the rectangle. :type x: int :param y: The y-coordinate of the rectangle. :type y: int :param w: The width of the rectangle. :type w: int :param h: The height of the rectangle. :type h: int :param color: The color of the rectangle as an (R, G, B) or (R, G, B, A) tuple. :type color: tuple[int, int, int] | tuple[int, int, int, int] .. py:method:: draw_line(x1: int, y1: int, x2: int, y2: int, color=(255, 255, 255), thickness: int = 1) Draw a line between two points. :param x1: The x-coordinate of the start point. :type x1: int :param y1: The y-coordinate of the start point. :type y1: int :param x2: The x-coordinate of the end point. :type x2: int :param y2: The y-coordinate of the end point. :type y2: int :param color: The color of the line as an (R, G, B) or (R, G, B, A) tuple. :type color: tuple[int, int, int] | tuple[int, int, int, int] .. py:method:: draw_circle(x: int, y: int, radius: int, color=(255, 255, 255)) Draw a filled circle. :param x: Center x :param y: Center y :param radius: Radius in pixels :param color: (R,G,B) or (R,G,B,A) .. py:method:: draw_poly(points: list[tuple[int, int]], color=(255, 255, 255), filled: bool = True) Draw a polygon defined by a list of points. :param points: A list of (x, y) tuples defining the vertices of the polygon. :type points: list[tuple[int, int]] :param color: The color of the polygon as an (R, G, B) or (R, G, B, A) tuple. :type color: tuple[int, int, int] | tuple[int, int, int, int] :param filled: Whether to draw a filled polygon (True) or an outline (False :type filled: bool .. py:method:: set_clip_rect(x: int, y: int, w: int, h: int) Set the clipping rectangle. :param x: The x-coordinate of the clipping rectangle. :type x: int :param y: The y-coordinate of the clipping rectangle. :type y: int :param w: The width of the clipping rectangle. :type w: int :param h: The height of the clipping rectangle. :type h: int .. py:method:: clear_clip_rect() Clear the clipping rectangle. .. py:method:: create_texture_rgba(w: int, h: int, pixels: bytes, pitch: int | None = None) -> int Create a texture from RGBA pixel data. :param w: The width of the texture. :type w: int :param h: The height of the texture. :type h: int :param pixels: The pixel data in RGBA format. :type pixels: bytes :param pitch: The number of bytes in a row of pixel data. If None, defaults to w * 4. :type pitch: int | None .. py:method:: destroy_texture(tex: int) -> None Destroy a texture. :param tex: The texture ID to destroy. :type tex: int .. py:method:: draw_texture(tex: int, x: int, y: int, w: int, h: int, angle_deg: float = 0.0) Draw a texture at the specified position and size. :param tex: The texture ID. :type tex: int :param x: The x-coordinate to draw the texture. :type x: int :param y: The y-coordinate to draw the texture. :type y: int :param w: The width to draw the texture. :type w: int :param h: The height to draw the texture. :type h: int :param angle_deg: Clockwise rotation angle in degrees around texture center. The native backend currently ignores non-zero rotation. :type angle_deg: float .. py:method:: draw_texture_tiled_y(tex: int, x: int, y: int, w: int, h: int) Draw a texture tiled vertically at the specified position and size. :param tex: The texture ID. :type tex: int :param x: The x-coordinate to draw the texture. :type x: int :param y: The y-coordinate to draw the texture. :type y: int :param w: The width to draw the texture. :type w: int :param h: The height to draw the texture. :type h: int