Enumeration of all available post-processing filter types.
NONE: Any = 'none'
VIGNETTE: Any = 'vignette'
BLUR: Any = 'blur'
SEPIA: Any = 'sepia'
GRAYSCALE: Any = 'grayscale'
INVERT: Any = 'invert'
TEMPERATURE_WARM: Any = 'temperature_warm'
TEMPERATURE_COLD: Any = 'temperature_cold'
NIGHT_VISION: Any = 'night_vision'
CRT: Any = 'crt'
PIXELATE: Any = 'pixelate'
BLOOM: Any = 'bloom'
EDGE_DETECT: Any = 'edge_detect'
EMBOSS: Any = 'emboss'
SHARPEN: Any = 'sharpen'
POSTERIZE: Any = 'posterize'
NEON: Any = 'neon'
RADIAL_BLUR: Any = 'radial_blur'
FISHEYE: Any = 'fisheye'
TWIRL: Any = 'twirl'
No methods defined.
Defines the shape/region where a filter is applied.
FULLSCREEN: Any = 'fullscreen'
RECTANGLE: Any = 'rectangle'
CIRCLE: Any = 'circle'
No methods defined.
Represents a post-processing filter with configurable region and intensity.
Attributes:
filter_type (FilterType): The type of effect to apply.
intensity (float): Strength of the effect (0.0 to 1.0).
region_type (FilterRegionType): Shape of the affected area.
region_pos (Tuple[float, float]): Position (top‑left for rect, center for circle).
region_size (Tuple[float, float]): Width and height of rectangular region.
radius (float): Radius for circular regions.
feather (float): Edge softness in pixels.
blend_mode (str): How the filter blends with the background (e.g., "normal").
enabled (bool): Whether this filter is active.
time (float): Accumulated time for animated filters.
def __init__(self: Any, filter_type: FilterType = FilterType.NONE, intensity: float = 1.0, region_type: FilterRegionType = FilterRegionType.FULLSCREEN, region_pos: Tuple[float, float] = (0, 0), region_size: Tuple[float, float] = (100, 100), radius: float = 50.0, feather: float = 10.0, blend_mode: str = 'normal') -> Any
def update(self: Any, dt: float) -> None
def copy(self: Any) -> Filter
Base class for all shader programs with automatic uniform location caching.
Attributes:
vertex_source (str | None): Path or source code for vertex shader.
fragment_source (str | None): Path or source code for fragment shader.
geometry_source (str | None): Path or source code for geometry shader.
program (int | None): OpenGL shader program handle.
vao (int | None): Vertex Array Object handle.
vbo (int | None): Vertex Buffer Object handle.
ebo (int | None): Element Buffer Object handle.
vertex_source: str | None = None
fragment_source: str | None = None
geometry_source: str | None = None
def get_source(self: Any, source: str | None, type: str) -> None
def __init__(self: Any, vertex_source: str, fragment_source: str, geometry_source: Optional[str] = None) -> Any
def _get_uniform_location(self: Any, name: str) -> int
def _create_program(self: Any, vertex_source: str, fragment_source: str, geometry_source: Optional[str] = None) -> None
def use(self: Any) -> None
def unuse(self: Any) -> None
def _setup_geometry(self: Any) -> None
Instanced particle rendering shader. Each particle is a point with size and colour.
def __init__(self: Any) -> Any
def _setup_geometry(self: Any) -> None
Simple shader for drawing solid colour rectangles and shapes.
def __init__(self: Any) -> Any
def _setup_geometry(self: Any) -> None
Shader for rendering textured quads (surfaces, images).
def __init__(self: Any) -> Any
def _setup_geometry(self: Any) -> None
Shader that draws rectangles with per‑corner rounded corners using signed distance fields.
def __init__(self: Any) -> Any
def _setup_geometry(self: Any) -> None
Full‑screen quad shader for applying post‑processing filters and effects.
def __init__(self: Any) -> Any
def _setup_geometry(self: Any) -> None
Main hardware‑accelerated renderer for LunaEngine.
Manages OpenGL context, shaders, framebuffers, geometry caches,
filters, particles, and all drawing operations.
Attributes:
width (int): Current viewport width.
height (int): Current viewport height.
camera_position (pygame.math.Vector2): World camera position.
filters (List[Filter]): Active post‑processing filters.
camera_position: Any = pygame.math.Vector2(0, 0)
def __init__(self: Any, width: int, height: int) -> Any
def get_opengl_version(self: Any) -> str
def set_text_cache_timeout(self: Any, seconds: float) -> None
def get_cache_usage(self: Any, target: str = 'all', humanize: bool = False) -> float | Dict[str, float]
def max_particles(self: Any) -> int
def max_particles(self: Any, value: int) -> None
def initialize(self: Any) -> bool
def _initialize_filter_framebuffer(self: Any) -> bool
def add_filter(self: Any, filter_obj: Filter) -> None
def remove_filter(self: Any, filter_obj: Filter) -> None
def clear_filters(self: Any) -> None
def create_quick_filter(self: Any, filter_type: FilterType, intensity: float = 1.0, x: float = 0, y: float = 0, width: float = None, height: float = None, radius: float = 50.0, feather: float = 10.0) -> Filter
def apply_vignette(self: Any, intensity: float = 0.7, feather: float = 100.0) -> Filter
def apply_blur(self: Any, intensity: float = 0.5, x: float = 0, y: float = 0, width: float = None, height: float = None) -> Filter
def apply_sepia(self: Any, intensity: float = 1.0) -> Filter
def apply_grayscale(self: Any, intensity: float = 1.0) -> Filter
def apply_invert(self: Any, intensity: float = 1.0) -> Filter
def apply_warm_temperature(self: Any, intensity: float = 0.5) -> Filter
def apply_cold_temperature(self: Any, intensity: float = 0.5) -> Filter
def apply_night_vision(self: Any, intensity: float = 0.9) -> Filter
def apply_crt_effect(self: Any, intensity: float = 0.8) -> Filter
def apply_pixelate(self: Any, intensity: float = 0.7) -> Filter
def apply_bloom(self: Any, intensity: float = 0.5) -> Filter
def apply_edge_detect(self: Any, intensity: float = 0.8) -> Filter
def apply_emboss(self: Any, intensity: float = 0.7) -> Filter
def apply_sharpen(self: Any, intensity: float = 0.5) -> Filter
def apply_posterize(self: Any, intensity: float = 0.6) -> Filter
def apply_neon(self: Any, intensity: float = 0.7) -> Filter
def apply_radial_blur(self: Any, intensity: float = 0.5) -> Filter
def apply_fisheye(self: Any, intensity: float = 0.4) -> Filter
def apply_twirl(self: Any, intensity: float = 0.3) -> Filter
def apply_circular_grayscale(self: Any, center_x: float, center_y: float, radius: float = 100.0, intensity: float = 1.0) -> Filter
def apply_rectangular_blur(self: Any, x: float, y: float, width: float, height: float, intensity: float = 0.5) -> Filter
def begin_frame(self: Any) -> None
def end_frame(self: Any) -> None
def _apply_filters(self: Any) -> None
def get_surface(self: Any) -> pygame.Surface
def set_surface(self: Any, surface: Optional[pygame.Surface]) -> None
def _surface_to_texture(self: Any, surface: pygame.Surface) -> int
def _surface_to_texture_cached(self: Any, surface: pygame.Surface) -> int
def _convert_color(self: Any, color: Union[Tuple[int, int, int, float], Tuple[int, int, int], Tuple[float, float, float, float], Color, ThemeStyle]) -> Tuple[float, float, float, float]
def enable_scissor(self: Any, x: int | float, y: int | float, width: int | float, height: int | float) -> None
def disable_scissor(self: Any) -> None
def draw_rect(self: Any, x: int | float, y: int | float, width: int | float, height: int | float, color: Union[Tuple[int, int, int, float], Tuple[int, int, int], Color, Tuple[float, float, float, float], ThemeStyle], fill: bool = True, pivot: tuple = (0.0, 0.0), border_width: int = 1, surface: Optional[pygame.Surface] = None, corner_radius: Union[int, float, Tuple[int, int, int, int], Tuple[float, float, float, float]] = 0, border_color: Optional[Union[Tuple[int, int, int, float], Tuple[int, int, int], Color, Tuple[float, float, float, float], ThemeStyle]] = None) -> None
def draw_isosceles_triangle(self: Any, x: int | float, y: int | float, width: int | float, height: int | float, color: Union[Tuple[int, int, int, float], Tuple[int, int, int], Color, Tuple[float, float, float, float], ThemeStyle], fill: bool = True, border_width: int = 1, border_color: Optional[Union[Tuple[int, int, int, float], Tuple[int, int, int], Color, Tuple[float, float, float, float], ThemeStyle]] = None) -> None
def draw_equilateral_triangle(self: Any, x: int | float, y: int | float, width: int | float, color: Union[Tuple[int, int, int, float], Tuple[int, int, int], Color, Tuple[float, float, float, float], ThemeStyle], fill: bool = True, border_width: int = 1, border_color: Optional[Union[Tuple[int, int, int, float], Tuple[int, int, int], Color, Tuple[float, float, float, float], ThemeStyle]] = None) -> None
def _draw_outline_rect(self: Any, x: int, y: int, width: int, height: int, color: tuple, border_width: int, radii: Tuple[int, int, int, int]) -> None
def _draw_sharp_rect(self: Any, x: int, y: int, width: int, height: int, color: tuple, fill: bool = True, border_width: int = 1) -> None
def _draw_rounded_rect(self: Any, x: int, y: int, w: int, h: int, color: tuple, fill: bool = True, border_width: int = 1, radii: Tuple[int, int, int, int] = (0, 0, 0, 0)) -> None
def draw_line(self: Any, start_x: int | float, start_y: int | float, end_x: int | float, end_y: int | float, color: tuple, width: int = 2, surface: Optional[pygame.Surface] = None) -> None
def _draw_thick_line(self: Any, x1: float, y1: float, x2: float, y2: float, color: tuple, width: float) -> None
def draw_lines(self: Any, points: List[Tuple[Tuple[int, int], Tuple[int, int]]], color: tuple, width: int = 2, surface: Optional[pygame.Surface] = None) -> None
def draw_circle(self: Any, center_x: int | float, center_y: int | float, radius: int | float, color: tuple, fill: bool = True, border_width: int = 1, surface: Optional[pygame.Surface] = None, pivot: Tuple[float, float] = (0.5, 0.5)) -> None
def _generate_filled_circle_geometry(self: Any, segments: int) -> Tuple[np.ndarray, np.ndarray]
def _generate_hollow_circle_geometry(self: Any, segments: int, border_width: float, radius: float) -> Tuple[np.ndarray, np.ndarray]
def _upload_geometry(self: Any, vertices: np.ndarray, indices: np.ndarray) -> Tuple[int, int, int]
def draw_polygon(self: Any, points: List[Tuple[float, float]], color: tuple, fill: bool = True, border_width: int = 1, surface: Optional[pygame.Surface] = None, pivot: Tuple[float, float] = (0.0, 0.0)) -> None
def _generate_filled_polygon_geometry(self: Any, points: List[Tuple[float, float]]) -> Tuple[np.ndarray, np.ndarray]
def _generate_hollow_polygon_geometry(self: Any, points: List[Tuple[float, float]], border_width: float) -> Tuple[np.ndarray, np.ndarray]
def draw_text(self: Any, text: str, x: int, y: int, color: Any, font: pygame.font.Font, surface: Optional[pygame.Surface] = None, pivot: Tuple[float, float] = (0.0, 0.0), flip: Tuple[bool, bool] = (False, False), rotate: float = 0.0, *args: tuple, **kwargs: dict) -> None
def draw_rich_text(self: Any, text: str, x: int, y: int, default_color: Any, font: pygame.font.Font, surface: Optional[pygame.Surface] = None, pivot: Tuple[float, float] = (0.0, 0.0), **kwargs: dict) -> None
def draw_rich_text_line(self: Any, line: List['RichTextSegment'], x: int, y: int, default_color: Any, font: pygame.font.Font, surface: Optional[pygame.Surface] = None) -> None
def _cleanup_text_cache(self: Any, now: float) -> None
def draw_surface(self: Any, surface: pygame.Surface, x: int, y: int, pivot: Tuple[float, float] = (0.0, 0.0), use_cache: bool = True) -> None
def blit(self: Any, source: pygame.Surface, dest: Union[Tuple[int, int], pygame.Rect], area: Optional[pygame.Rect] = None, special_flags: int = 0, pivot: Tuple[float, float] = (0.0, 0.0), use_cache: bool = False) -> None
def fill_screen(self: Any, color: Tuple[int, int, int, float] | Tuple[int, int, int]) -> None
def clear(self: Any) -> None
def render_particles(self: Any, particle_data: Dict[str, Any], camera: Any) -> None
def _ensure_particle_capacity(self: Any, required: int) -> None
def cleanup(self: Any) -> None
def set_blend_mode(self: Any, mode: str) -> None