# Path: art/baseclasses/barber.py
# class Barber(ArtBaseClass):
# 
#     def __init__(self, matrix, config):
#         self.width = int(matrix.width/SEGMENTS)
#         self.hue = getHueGen(step=0.01)
# 
#     def start(self, matrix):
#         pass
# 
#     def _line(self, matrix, x1, x2, hue):
#         raise NotImplementedError
# 
#     def refresh(self, matrix):
#         matrix.scroll("up")
#         matrix.scroll("right")
# 
#         hue = next(self.hue)
#         for segment in range(SEGMENTS):
#             self._line(
#                     matrix,
#                     self.width*segment,
#                     self.width*(segment+1),
#                     hue+(HUEDELTA*segment)
#                     )
# 
#     def interval(self):
#         return 120
# 
# Path: opc/hue.py
# @mwt(timeout=20)
# @timefunc
# def hsvToRgb(h, s=1.0, v=1.0, rainbow=True):
#     """
#     Convert a (h, s, v) value to the (r, g, b) color space. By default,
#     we use a more cpu-intense method to curve the hue ramps above the
#     typical linear, with a view to evening out the visible range of yellow,
#     cyan, and purple.
# 
#     This method takes h, s, and v values in range 0..1 and returns r, g,
#     and b values in range 0..255.
#     """
#     if rainbow:
#         return [sin(c*pi/2)*255 for c in colorsys.hsv_to_rgb(h, s, v)]
# 
#     return [c*255 for c in colorsys.hsv_to_rgb(h, s, v)]


from .baseclasses.barber import Barber
from random import random
from opc.hue import hsvToRgb




class Art(Barber):

    description = "Barber-pole-esque (dirty)"

    def _line(self, matrix, x1, x2, hue):
        for x in range(x1, x2):
            val = 0.8 + 0.2*random()

# Path: art/baseclasses/barber.py
# class Barber(ArtBaseClass):
# 
#     def __init__(self, matrix, config):
#         self.width = int(matrix.width/SEGMENTS)
#         self.hue = getHueGen(step=0.01)
# 
#     def start(self, matrix):
#         pass
# 
#     def _line(self, matrix, x1, x2, hue):
#         raise NotImplementedError
# 
#     def refresh(self, matrix):
#         matrix.scroll("up")
#         matrix.scroll("right")
# 
#         hue = next(self.hue)
#         for segment in range(SEGMENTS):
#             self._line(
#                     matrix,
#                     self.width*segment,
#                     self.width*(segment+1),
#                     hue+(HUEDELTA*segment)
#                     )
# 
#     def interval(self):
#         return 120
# 
# Path: opc/hue.py
# @mwt(timeout=20)
# @timefunc
# def hsvToRgb(h, s=1.0, v=1.0, rainbow=True):
#     """
#     Convert a (h, s, v) value to the (r, g, b) color space. By default,
#     we use a more cpu-intense method to curve the hue ramps above the
#     typical linear, with a view to evening out the visible range of yellow,
#     cyan, and purple.
# 
#     This method takes h, s, and v values in range 0..1 and returns r, g,
#     and b values in range 0..255.
#     """
#     if rainbow:
#         return [sin(c*pi/2)*255 for c in colorsys.hsv_to_rgb(h, s, v)]
# 
#     return [c*255 for c in colorsys.hsv_to_rgb(h, s, v)]


# Path: art/dirtybarber.py
from .baseclasses.barber import Barber
from random import random
from opc.hue import hsvToRgb





class Art(Barber):

    description = "Barber-pole-esque (dirty)"

    def _line(self, matrix, x1, x2, hue):
        for x in range(x1, x2):
            val = 0.8 + 0.2*random()

            matrix.drawPixel(x, 0, hsvToRgb(hue, 1, val))