# Path: art/baseclasses/flow.py
# class Flow(ArtBaseClass):
# 
#     huecount = (8+1)  # the addition covers offscreen for recoloring
# 
#     def __init__(self, matrix, config):
#         self.base = 0
#         self.offset = 0
#         self.usecount = []
#         self.blocksize = int(matrix.numpix/(self.huecount-1))
# 
#         self.hues = []
#         for hue in range(0, self.huecount):
#             self.hues.append(random())
# 
#         self.sinlut = []
#         for i in range(0, self.blocksize):
#             s = sin(pi*i/(self.blocksize-1))
#             self.sinlut.append(s*s*s)
# 
#     def start(self, matrix):
#         pass
# 
#     def _color(self):
#         self.offset += 1
# 
#         if self.contiguous:
#             hue = 0.0 + (self.offset+2*self.base) % 256
#             return hsvToRgb(hue/255)
# 
#         index = ((self.base+self.offset)/self.blocksize) % self.huecount
#         hue = self.hues[int(index)]
# 
#         phase = (self.base+self.offset) % self.blocksize
#         value = self.sinlut[phase]
# 
#         self.usecount[int(index)] += 1
# 
#         return hsvToRgb(hue, 1, value)
# 
#     def plot(self, matrix, x, y):
#         color = self._color()
#         matrix.drawPixel(x, y, color)
# 
#     def refresh(self, matrix):
#         xmin = 0
#         ymin = 0
#         xmax = matrix.width
#         ymax = matrix.height
#         x = xmax - 1
#         y = 0
# 
#         self.offset = 0
#         self.base += 1
# 
#         self.usecount = [0]*self.huecount
# 
#         while xmin < xmax and ymin < ymax:
#             while x < xmax-1:
#                 self.plot(matrix, x, y)
#                 x = x + 1
# 
#             xmax -= 1
# 
#             while y < ymax-1:
#                 self.plot(matrix, x, y)
#                 y = y + 1
# 
#             ymax -= 1
# 
#             while x > xmin:
#                 self.plot(matrix, x, y)
#                 x = x - 1
# 
#             xmin += 1
# 
#             while y > ymin:
#                 self.plot(matrix, x, y)
#                 y = y - 1
# 
#             ymin += 1
# 
#         self.plot(matrix, x, y)
# 
#         for i in range(0, self.huecount):
#             if self.usecount[i] == 1:
#                 self.hues[i] = random()
# 
#     def interval(self):
#         return 500


from .baseclasses.flow import Flow


class Art(Flow):

    description = "Like cflow, but color blocks are segmented"

    def __init__(self, matrix, config):

# Path: art/baseclasses/flow.py
# class Flow(ArtBaseClass):
# 
#     huecount = (8+1)  # the addition covers offscreen for recoloring
# 
#     def __init__(self, matrix, config):
#         self.base = 0
#         self.offset = 0
#         self.usecount = []
#         self.blocksize = int(matrix.numpix/(self.huecount-1))
# 
#         self.hues = []
#         for hue in range(0, self.huecount):
#             self.hues.append(random())
# 
#         self.sinlut = []
#         for i in range(0, self.blocksize):
#             s = sin(pi*i/(self.blocksize-1))
#             self.sinlut.append(s*s*s)
# 
#     def start(self, matrix):
#         pass
# 
#     def _color(self):
#         self.offset += 1
# 
#         if self.contiguous:
#             hue = 0.0 + (self.offset+2*self.base) % 256
#             return hsvToRgb(hue/255)
# 
#         index = ((self.base+self.offset)/self.blocksize) % self.huecount
#         hue = self.hues[int(index)]
# 
#         phase = (self.base+self.offset) % self.blocksize
#         value = self.sinlut[phase]
# 
#         self.usecount[int(index)] += 1
# 
#         return hsvToRgb(hue, 1, value)
# 
#     def plot(self, matrix, x, y):
#         color = self._color()
#         matrix.drawPixel(x, y, color)
# 
#     def refresh(self, matrix):
#         xmin = 0
#         ymin = 0
#         xmax = matrix.width
#         ymax = matrix.height
#         x = xmax - 1
#         y = 0
# 
#         self.offset = 0
#         self.base += 1
# 
#         self.usecount = [0]*self.huecount
# 
#         while xmin < xmax and ymin < ymax:
#             while x < xmax-1:
#                 self.plot(matrix, x, y)
#                 x = x + 1
# 
#             xmax -= 1
# 
#             while y < ymax-1:
#                 self.plot(matrix, x, y)
#                 y = y + 1
# 
#             ymax -= 1
# 
#             while x > xmin:
#                 self.plot(matrix, x, y)
#                 x = x - 1
# 
#             xmin += 1
# 
#             while y > ymin:
#                 self.plot(matrix, x, y)
#                 y = y - 1
# 
#             ymin += 1
# 
#         self.plot(matrix, x, y)
# 
#         for i in range(0, self.huecount):
#             if self.usecount[i] == 1:
#                 self.hues[i] = random()
# 
#     def interval(self):
#         return 500


# Path: art/sflow.py
from .baseclasses.flow import Flow



class Art(Flow):

    description = "Like cflow, but color blocks are segmented"

    def __init__(self, matrix, config):

        Flow.__init__(self, matrix, config)