# Path: uchroma/renderer.py
# MAX_FPS = 30
# DEFAULT_FPS = 15
# NUM_BUFFERS = 2
# class Renderer(HasTraits, object):
#     def __init__(self, driver, *args, **kwargs):
#     def _z_changed(self, change):
#     def init(self, frame) -> bool:
#     def finish(self, frame ):
#     async def draw(self, layer: Layer, timestamp: float) -> bool:
#     def has_key_input(self) -> bool:
#     def key_expire_time(self) -> float:
#     def key_expire_time(self, expire_time: float):
#     async def get_input_events(self):
#     def _fps_changed(self, change):
#     def logger(self):
#     def _free_layer(self, layer):
#     async def _run(self):
#     def _flush(self):
#     async def _stop(self):


import asyncio
from traitlets import Int, observe
from grapefruit import Color
from uchroma.renderer import Renderer, RendererMeta

        self.fps = 5


    @staticmethod
    def _hue_gradient(start, length):
        step = 360 / length
        return [Color.NewFromHsv((start + (step * x)) % 360, 1, 1) for x in range(0, length)]


    @observe('speed', 'stagger')
    def _create_gradient(self, change=None):
        self._offset = 0
        self._gradient = Rainbow._hue_gradient( \
            0, self.speed * self.width + (self.height * self.stagger))


    def init(self, frame):
        self._create_gradient()
        return True


    async def draw(self, layer, timestamp):
        data = []
        for row in range(0, layer.height):
            data.append( \
                [self._gradient[ \
                (self._offset + (row * self.stagger) + col) % len(self._gradient)] \
                for col in range(0, layer.width)])


# Path: uchroma/renderer.py
# MAX_FPS = 30
# DEFAULT_FPS = 15
# NUM_BUFFERS = 2
# class Renderer(HasTraits, object):
#     def __init__(self, driver, *args, **kwargs):
#     def _z_changed(self, change):
#     def init(self, frame) -> bool:
#     def finish(self, frame ):
#     async def draw(self, layer: Layer, timestamp: float) -> bool:
#     def has_key_input(self) -> bool:
#     def key_expire_time(self) -> float:
#     def key_expire_time(self, expire_time: float):
#     async def get_input_events(self):
#     def _fps_changed(self, change):
#     def logger(self):
#     def _free_layer(self, layer):
#     async def _run(self):
#     def _flush(self):
#     async def _stop(self):


# Path: uchroma/fxlib/rainbow.py
import asyncio
from traitlets import Int, observe
from grapefruit import Color
from uchroma.renderer import Renderer, RendererMeta


        self.fps = 5


    @staticmethod
    def _hue_gradient(start, length):
        step = 360 / length
        return [Color.NewFromHsv((start + (step * x)) % 360, 1, 1) for x in range(0, length)]


    @observe('speed', 'stagger')
    def _create_gradient(self, change=None):
        self._offset = 0
        self._gradient = Rainbow._hue_gradient( \
            0, self.speed * self.width + (self.height * self.stagger))


    def init(self, frame):
        self._create_gradient()
        return True


    async def draw(self, layer, timestamp):
        data = []
        for row in range(0, layer.height):
            data.append( \
                [self._gradient[ \
                (self._offset + (row * self.stagger) + col) % len(self._gradient)] \
                for col in range(0, layer.width)])


        layer.put_all(data)