# Path: sc8pr/util.py
# def rgba(*args):
#     "Return a color or list of colors from str or tuple data"
#     c = list(_rgba(*args))
#     return c[0] if len(c) == 1 else c
# 
# def style(srf, bg=None, border=(0,0,0), weight=0, padding=0, borderradius=None):
#     "Create a new surface with padding, background color, and/or border"
#     w, h = srf.get_size()
# 
#     # Add padding
#     if type(padding) is int: px = py = padding + weight
#     else: px, py = [p + weight for p in padding]
#     w += 2 * px
#     h += 2 * py
#     img = pygame.Surface((w, h), pygame.SRCALPHA)
# 
#     # Add background color and border
#     if bg: img.fill(rgba(bg))
#     img.blit(srf, (px, py))
#     if weight: drawBorder(img, border, weight)
#     if borderradius: img = borderRadius(img, borderradius)
# 
#     return img


from random import uniform, random
from math import sqrt, tan, pi, sin, cos, hypot
from sys import stderr
from pygame.pixelarray import PixelArray
from sc8pr.util import rgba, style
    from pygame.surfarray import pixels_alpha
import pygame
        if self._time is None: n = 0
        else:
            t0, t1 = self._time
            n = (n - t0) / (t1 - t0)
        return self.apply(img, 0 if n <= 0 else 1 if n >= 1 else n)

    def srfSize(self, img, size=False):
        srf = img if isinstance(img, pygame.Surface) else img.image
        return (srf, srf.get_size()) if size else srf


class Remove(Effect):
    "Remove a graphic, or its effects lists, at the specified frame"

    def __init__(self, gr, complete=False):
        self._gr = gr
        self._complete = complete

    def apply(self, img, n=0):
        if n <= 0:
            if self._complete:
                self._gr.bind(ondraw=lambda gr:gr.remove())
            else: self._gr.effects = None
        return img


class ReplaceColor(Effect):
    "Replace one color by another (non-animated)"

    def __init__(self, color, replace=(0,0,0,0), dist=0.0):

# Path: sc8pr/util.py
# def rgba(*args):
#     "Return a color or list of colors from str or tuple data"
#     c = list(_rgba(*args))
#     return c[0] if len(c) == 1 else c
# 
# def style(srf, bg=None, border=(0,0,0), weight=0, padding=0, borderradius=None):
#     "Create a new surface with padding, background color, and/or border"
#     w, h = srf.get_size()
# 
#     # Add padding
#     if type(padding) is int: px = py = padding + weight
#     else: px, py = [p + weight for p in padding]
#     w += 2 * px
#     h += 2 * py
#     img = pygame.Surface((w, h), pygame.SRCALPHA)
# 
#     # Add background color and border
#     if bg: img.fill(rgba(bg))
#     img.blit(srf, (px, py))
#     if weight: drawBorder(img, border, weight)
#     if borderradius: img = borderRadius(img, borderradius)
# 
#     return img


# Path: sc8pr/misc/effect.py
from random import uniform, random
from math import sqrt, tan, pi, sin, cos, hypot
from sys import stderr
from pygame.pixelarray import PixelArray
from sc8pr.util import rgba, style
    from pygame.surfarray import pixels_alpha
import pygame

        if self._time is None: n = 0
        else:
            t0, t1 = self._time
            n = (n - t0) / (t1 - t0)
        return self.apply(img, 0 if n <= 0 else 1 if n >= 1 else n)

    def srfSize(self, img, size=False):
        srf = img if isinstance(img, pygame.Surface) else img.image
        return (srf, srf.get_size()) if size else srf


class Remove(Effect):
    "Remove a graphic, or its effects lists, at the specified frame"

    def __init__(self, gr, complete=False):
        self._gr = gr
        self._complete = complete

    def apply(self, img, n=0):
        if n <= 0:
            if self._complete:
                self._gr.bind(ondraw=lambda gr:gr.remove())
            else: self._gr.effects = None
        return img


class ReplaceColor(Effect):
    "Replace one color by another (non-animated)"

    def __init__(self, color, replace=(0,0,0,0), dist=0.0):

        self.color1 = rgba(color)