Exemple #1
0
def refreshDisplay(tempture, pressure):
    image = Image.new("RGB", (width, height), (0, 0, 0))
    draw = ImageDraw.Draw(image)

    draw.text((0, -1), '{0:d}℃'.format(tempture), fill=COLOR, font=font)
    draw.text((0, 4), '{0:04d}'.format(pressure), fill=COLOR, font=font)
    draw.text((4, 10), 'hPa', fill=COLOR, font=font)

    unicornhathd.clear()

    # x, yを指定して1ドットずつ描写する
    for x in range(width):
        for y in range(height):
            r, g, b = image.getpixel((x, y))
            # ここの部分でx軸を反転させている
            unicornhathd.set_pixel(width - x - 1, y, r, g, b)

    # 現在時刻の秒を基準にドットの点滅をさせる
    if datetime.datetime.now().second % 2:
        unicornhathd.set_pixel(15, 15, *COLOR)
        unicornhathd.set_pixel(15, 14, *COLOR)
        unicornhathd.set_pixel(14, 15, *COLOR)
        unicornhathd.set_pixel(14, 14, *COLOR)

    # 画面のリフレッシュ命令
    unicornhathd.show()
def listen(s):
    for msg in _listen(s):
        if (msg):
            print "Received: %s" % str(msg)
            if msg[0] == 'broadcast':
                commands = msg[1].split('_')
                if commands[0] == 'uhat':
                    if commands[1] == 'red':
                        unicornhathd.set_pixel(0, 0, 255, 0, 0)
                        unicornhathd.show()
                    elif commands[1] == 'green':
                        unicornhathd.set_pixel(0, 0, 0, 255, 0)
                        unicornhathd.show()
                    elif commands[1] == 'blue':
                        unicornhathd.set_pixel(0, 0, 0, 0, 255)
                        unicornhathd.show()
                    elif commands[1] == 'show':
                        unicornhathd.show()
                    elif commands[1] == 'clear':
                        unicornhathd.clear()
                    else:
                        x = int(commands[1])
                        if x > 15:
                            x = 15
                        if x < 0:
                            x = 0
                        y = int(commands[2])
                        if y > 15:
                            y = 15
                        if y < 0:
                            y = 0
                        r = int(commands[3])
                        g = int(commands[4])
                        b = int(commands[5])
                        unicornhathd.set_pixel(x, y, r, g, b)
Exemple #3
0
 def __init__(self, rotation):
     unicornhathd.brightness(0.6)
     unicornhathd.clear()
     unicornhathd.rotation(rotation)  #(x|colonne, y|lignes)  (0,0): en bas à gauche
     self.c_gris_fonce = [20,20,10]
     self.c_rouge = [255,0,0]
     self.c_orange = [240,150,28]
     self.c_vert = [0,255,0]
     self.c_bleu = [23,7,238]
     self.c_jaune = [100,100,0]
     self.hue_min = 0.33                 # color HSV: vert pour un niveau 0%
     self.hue_max = 1.0                  # color HSV: rouge pour un niveau 100%
     self.hue_delta = self.hue_max - self.hue_min     # calculé une fois pour toutes
     self.msg = Msg()
     
     #initialisation de l'affichage
     self.animation_start()
     self.draw_titles(self.c_orange) #dessine les titres persistants 4 premières lignes
     self.draw_level(0,1,6)        #fond niveau CPU0
     self.draw_level(0,2,6)        #fond niveau CPU1
     self.draw_level(0,3,6)        #fond niveau CPU2
     self.draw_level(0,4,6)        #fond niveau CPU3
     self.draw_level(0,7,6)        #fond niveau RAM
     self.draw_fullbox(10, 6, 14, 10 ,self.c_gris_fonce) #fond niveau DISK
     self.draw_level(0,1,0)        #fond niveau T°
     unicornhathd.show()
Exemple #4
0
 def Erase(self,h1,v1):
   #This function draws a black sprite, erasing the sprite.  This may be useful for
   #a future "floating over the screen" type of sprite motion
   #It is pretty fast now, seems just as fast as blanking whole screen using off() or clear()
   x = 0
   y = 0
   #print ("Erase:",self.width, self.height, self.r, self.g, self.b,v1,h1)
   for count in range (0,(self.width * self.height)):
     y,x = divmod(count,self.width)
     #print("Count:",count,"xy",x,y)
     if self.grid[count] == 1:
       if (CheckBoundary(x+h1,y+v1) == 0):
         #setpixel(x+h1,y+v1,0,0,0)
         setpixel(x+h1,y+v1,0,0,0)
   try:
     unicorn.show()
   
   except Exception as ErrorMessage:
     TheTrace = traceback.format_exc()
     print("")
     print("")
     print("--------------------------------------------------------------")
     print("ERROR - Unicorn.show")
     print(ErrorMessage)
     print("")
     #print("EXCEPTION")
     #print(sys.exc_info())
     print("")
     print ("TRACE")
     print (TheTrace)
     print("--------------------------------------------------------------")
     print("")
     print("")
     unicorn.clear()
     ShowScrollingBanner("Display Error!",100,0,0,0.05)
Exemple #5
0
    def run(self):
        while self.is_alive():
            unicornhathd.clear()

            for y in range(0, 16):
                for x in range(0, 16):
                    if y == self.scanline:
                        unicornhathd.set_pixel(x, y, 0, 0, 32)
                    if (y + 1) % 16 == self.scanline:
                        unicornhathd.set_pixel(x, y, 0, 0, 16)
                    if (y + 2) % 16 == self.scanline:
                        unicornhathd.set_pixel(x, y, 0, 0, 8)
                    if (y + 3) % 16 == self.scanline:
                        unicornhathd.set_pixel(x, y, 0, 0, 4)
                    if self.blips[x][y] > 0:
                        self.set_green(x, y, self.blips[x][y])
                        self.blips[x][y] -= 1

            for ac in airport_coords:
                c = self.gps_to_matrix_coords(ac)
                self.set_red(c[1], c[0], 128)

            ref = self.gps_to_matrix_coords(center_coord)
            self.set_red(ref[1], ref[0], 16)

            unicornhathd.show()

            self.scanline = (self.scanline + 1) % 16
            time.sleep(1.0)
Exemple #6
0
 def DisplayIncludeBlack(self,h1,v1):
   x = 0,
   y = 0
   for count in range (0,(self.width * self.height)):
     y,x = divmod(count,self.width)
     
     if self.grid[count] == 1:
       if (CheckBoundary(x+h1,y+v1) == 0):
         setpixel(x+h1,y+v1,self.r,self.g,self.b)
     elif self.grid[count] == 0:
       if (CheckBoundary(x+h1,y+v1) == 0):
         setpixel(x+h1,y+v1,0,0,0)
   
   try:
     unicorn.show()
   
   except Exception as ErrorMessage:
     TheTrace = traceback.format_exc()
     print("")
     print("")
     print("--------------------------------------------------------------")
     print("ERROR - Unicorn.show")
     print(ErrorMessage)
     print("")
     #print("EXCEPTION")
     #print(sys.exc_info())
     print("")
     print ("TRACE")
     print (TheTrace)
     print("--------------------------------------------------------------")
     print("")
     print("")
     unicorn.clear()
     ShowScrollingBanner("Display Error!",100,0,0,0.05)
Exemple #7
0
def doCPU():
    cpu = psutil.cpu_times_percent()

    u = cpu.user + cpu.nice
    s = cpu.system + cpu.steal + cpu.guest_nice + cpu.guest
    w = cpu.irq + cpu.iowait + cpu.softirq
    i = cpu.idle

    # Cumulative
    ac = s
    bc = ac + w
    cc = bc + u
    tot = cc + i

    aIdx = 16 * (ac / 100)
    bIdx = 16 * (bc / 100)
    cIdx = 16 * (cc / 100)

    uhd.clear()

    def set_row(y, r, g, b):
        for x in range(5, 10):
            uhd.set_pixel(x, y, r, g, b)

    for y in range(16):
        if y <= aIdx:
            set_row(y, 70, 0, 0)
        elif y <= bIdx:
            set_row(y, 0, 0, 150)
        elif y <= cIdx:
            set_row(y, 0, 100, 0)
        else:
            set_row(y, 0, 0, 0)

    uhd.show()
Exemple #8
0
def main(run, running):
    running(True)

    star_count = randint(20, 25)
    star_speed = 0.05
    stars = []

    for i in range(0, star_count):
        stars.append((random.uniform(4, 11), random.uniform(4, 11), 0))

    while run():
        unicornhathd.clear()

        for i in range(0, star_count):
            stars[i] = (stars[i][0] + ((stars[i][0] - 8.1) * star_speed),
                        stars[i][1] + ((stars[i][1] - 8.1) * star_speed),
                        stars[i][2] + star_speed * 50)

            if stars[i][0] < 0 or stars[i][1] < 0 or stars[i][0] > 16 or stars[
                    i][1] > 16:
                stars[i] = (random.uniform(4, 11), random.uniform(4, 11), 0)

            v = stars[i][2]

            unicornhathd.set_pixel(stars[i][0], stars[i][1], v, v, v)

        unicornhathd.show()
    unicornhathd.off()
    running(False)
Exemple #9
0
def draw():

    # Clear the display
    unicornhathd.off()

    # Clear the buffer
    unicornhathd.clear()

    # Set the rotation of the display
    unicornhathd.rotation(270)

    time.sleep(0.5)

    drawPurpleRow(2)
    drawPurpleRow(3)
    drawPurpleRow(4)
    drawPurpleRow(5)
    drawBlueRow(6)
    drawBlueRow(7)
    drawPurpleRow(8)
    drawPurpleRow(9)
    drawPurpleRow(10)
    drawPurpleRow(11)

    drawBow()

    unicornhathd.show()

    time.sleep(5)
def UnicornStarfield():

    print("Running starfield")

    unicorn.rotation(270)

    lenght = conf.STARFIELD_LENGHT
    current_pos = 1
    star_count = 25
    star_speed = 0.05
    stars = []

    for i in range(0, star_count):
        stars.append((random.uniform(4, 11), random.uniform(4, 11), 0))

    while current_pos <= lenght:
        unicorn.clear()
        for i in range(0, star_count):
            stars[i] = (stars[i][0] + ((stars[i][0] - 8.1) * star_speed),
                        stars[i][1] + ((stars[i][1] - 8.1) * star_speed),
                        stars[i][2] + star_speed * 50)
            if stars[i][0] < 0 or stars[i][1] < 0 or stars[i][0] > 16 or stars[
                    i][1] > 16:
                stars[i] = (random.uniform(4, 11), random.uniform(4, 11), 0)
            v = stars[i][2]
            unicorn.set_pixel(stars[i][0], stars[i][1], v, v, v)
        unicorn.show()
        current_pos = current_pos + 1
        #print(current_pos)
    unicorn.clear()
    unicorn.off()
    return 0
Exemple #11
0
def plot(grid: np.ndarray):
    if not u:
        return
    u.clear()
    for x, y in zip(*np.where(grid[:, :, 2] > 0.)):
        u.set_pixel_hsv(x, y, *grid[x, y])
    u.show()
Exemple #12
0
def run(data):
  cmd = ''

  if data.find(':') < 0:
    parts = []
    cmd = data
  else:
    parts = data.split(':')
    cmd = parts[0]

  if data == 'show':
    show()
    time.sleep(.025)
    clear()
    show()
  elif data == 'clear':
    clear()
  elif cmd == 'f':
    full()
  elif cmd == 'l' and len(parts) > 0 and len(parts[1]) > 0:
    c = parts[1][0]
    line(ord(c) % 16)
  elif cmd == 'n' and len(parts) > 0 and len(parts[1]) > 0:
    c = parts[1][0]
    note(ord(c) % 16)
  elif cmd == 'd' and len(parts) > 0 and len(parts[1]) > 2:
    if parts[1].find(';') > -1:
      values = parts[1].split(';')
      dot(ord(values[0][0]) % 16,ord(values[1][0]) % 16)
  else:
    print(data)
Exemple #13
0
def run(params):
  star_count = 25
  star_speed = 0.05
  stars = []

  for i in range(0, star_count):
    stars.append((random.uniform(4, 11), random.uniform(4, 11), 0))

  try:
      while True:
        unicornhathd.clear()

        for i in range(0, star_count):
          stars[i] = (
              stars[i][0] + ((stars[i][0] - 8.1) * star_speed),
              stars[i][1] + ((stars[i][1] - 8.1) * star_speed),
              stars[i][2] + star_speed * 50)

          if stars[i][0] < 0 or stars[i][1] < 0 or stars[i][0] > 16 or stars[i][1] > 16:
            stars[i] = (random.uniform(4, 11), random.uniform(4, 11), 0)
             
          v = stars[i][2]

          unicornhathd.set_pixel(int(stars[i][0]), int(stars[i][1]), v, v, v)

        unicornhathd.show()

  except KeyboardInterrupt:
      unicornhathd.off()  
 def __init__(self):
     unicornhathd.clear()
     unicornhathd.set_all(10, 0, 10)
     unicornhathd.show()
     unicornhathd.rotation(270)  # Rotation
     unicornhathd.brightness(.75)
     unicornhathd.show()
Exemple #15
0
def main():
    # 無限ループ
    while True:
        # 描写用キャンバスの新規作成
        image = Image.new("RGB", (width, height), (0, 0, 0))
        draw = ImageDraw.Draw(image)

        # 現在時刻の取得
        now = datetime.datetime.now()

        # キャンバスに時、分の描写
        draw.text((0, -2), '{0:02}'.format(now.hour), fill=COLOR)
        draw.text((0, 7), '{0:02}'.format(now.minute), fill=COLOR)

        # ここからunicornhatへキャンバス描写作業
        unicornhathd.clear()

        # x, yを指定して1ドットずつ描写する
        for x in range(width):
            for y in range(height):
                r, g, b = image.getpixel((x, y))
                # ここの部分でx軸を反転させている
                unicornhathd.set_pixel(width - x - 1, y, r, g, b)

        # コロンの代わりに2x2のドットを描写する
        if now.second % 2:
            unicornhathd.set_pixel(0, height - 1, *COLOR)
            unicornhathd.set_pixel(1, height - 1, *COLOR)
            unicornhathd.set_pixel(0, height - 2, *COLOR)
            unicornhathd.set_pixel(1, height - 2, *COLOR)

        # 画面のリフレッシュ命令
        unicornhathd.show()

        time.sleep(0.1)
Exemple #16
0
def init():
    print('initializing..')
    unicornhathd.clear()
    unicornhathd.rotation(270)
    unicornhathd.brightness(1.0)
    scroll_text("Hola! Hola! Hola! Hola!", NEUTRAL)
    unicornhathd.brightness(0.5)
Exemple #17
0
def calibrate_preview():
    '''Opens a preview for user focusing, then takes series of pics
    for averaging and background subtraction'''
    with picamera.PiCamera() as camera:
        camera.resolution = (1664, 1232)
        camera.awb_mode = 'off'
        camera.awb_gains = (1.2, 1.2)
        camera.framerate = 30
        camera.start_preview()
        pihat.brightness(1.0)
        pihat.clear()
        for y in range(16):
            for x in range(16):
                v = display[x, y]  # brightness depends on range
                if v == 0:
                    red = int(255)  # makes 0-1 range > 0-255 range
                    green = int(255)
                    blue = int(255)
                elif v == 1:
                    red = int(0)
                    green = int(0)
                    blue = int(0)
                elif v == 2:
                    red = int(0)
                    green = int(0)
                    blue = int(0)
                pihat.set_pixel(x, y, red, green, blue)  # sets pixels on the hat
        pihat.rotation(180)
        pihat.show()  # show the pixels
        GPIO.output(VALVE, True)
        time.sleep(20)
        GPIO.output(VALVE, False)
        pihat.clear()
        pihat.off()
        camera.stop_preview()
Exemple #18
0
 def drawCurrent(self):
     """Display the current counter value."""
     unicornhathd.clear()
     current = self.values[-1]
     im = self.blueFont.drawString("{:02d}".format(current[1]))
     scrollImage(im, 0, 0, HEIGHT, 8, 0.0, horiz=False)
     unicornhathd.show()
     im = self.redFont.drawString("CURRENT ")
     scrollImage(im, 0, 0, WIDTH + 1, -im.size[0], 0.02)
Exemple #19
0
    def render(self):
        """ draws and updates all pythons in the visualizer. """
        unicornhathd.clear()

        for python in self.pythons:
            python.update()
            python.draw()

        self.pythons = set(filter(Visualizer.filter_python, self.pythons))
        unicornhathd.show()
def unicorn_init():
    unicorn.brightness(BRIGHTNESS)
    if UNICORN_VERSION == "HD":
        unicorn.rotation(0)
    elif UNICORN_VERSION == "SD":
        unicorn.rotation(90)
    else:
        log_string(
            'No valid Unicorn Version found in config file - use "SD" or "HD"')
    unicorn.clear()
    unicorn.show()
def unicorn_init():
    unicorn.brightness(BRIGHTNESS)

    if UNICORN_VERSION == "HD":
        unicorn.rotation(0)
    elif UNICORN_VERSION == "SD":
        unicorn.rotation(90)
    else:
        log_string('No valid Unicorn Version found in config file - use "SD" or "HD"')
    unicorn.clear()
    unicorn.show()
def main():
    uhat.clear()
    uhat.set_rotation(90)
    uhat.show()

    try:
        while True:
            sky_show()
            ground_show()
    except KeyboardInterrupt:
        uhat.off()
        exit()
Exemple #23
0
def main():
    """
    メイン処理
    これをループし続ける
    """

    # 現在時刻の取得
    now = datetime.datetime.now()

    # datetimeオブジェクトをUnixTimeに変換し、ターゲット時間を作る
    # ターゲットを2時間先とする
    target_timestamp = now.timestamp() + 60 * 60 * 2

    try:
        r = getWeather(CITY, APIKEY)
        if not r.ok:
            logger.warn('error, weather get fail')
            time.sleep(30 * 3)
            return

        weathers = r.json()['list']
        weather = filterNearstWeather(weathers, target_timestamp)
        logger.debug('weather is %s', weather)

        image = getIconImage(weather['weather'][0]['icon'])

        if image is None:
            logger.warning("image is None.")
            time.sleep(30 * 3)
            return

    except requests.exceptions.ConnectionError as e:
        logger.exception(e)
        time.sleep(30 * 3)

    except KeyError:
        time.sleep(30 * 3)
        return

    logger.debug('start write icon.')

    unicornhathd.clear()

    # x, yを指定して1ドットずつ描写する
    for x in range(width):
        for y in range(height):
            r, g, b = image.getpixel((x, y))
            # ここの部分でx軸を反転させている
            unicornhathd.set_pixel(width-x-1, y, r, g, b)

    unicornhathd.show()

    time.sleep(1800)
Exemple #24
0
def serve_next_client():
    print('Waiting for a client to connect...')
    conn, addr = s.accept()
    with conn:
        print('Client connected with address: ', addr)
        while True:
            usages = conn.recv(16)
            if not usages:
                return
            unicornhathd.clear()
            draw_usages(usages)
            unicornhathd.show()
def draw(ground, air):
    unicornhathd.clear()
    for x, height in enumerate(ground):
        r = 0
        for y in range(maxHeight, 0, -1):
            if (y == height):
                r = 63
            if (r > 0) and (r < 255):
                r = r + 16
            unicornhathd.set_pixel(x, maxHeight - y, r, 0, 0)
    for air in air:
        unicornhathd.set_pixel(air.x, maxHeight - air.h, snowColor(), 0, 0)
    unicornhathd.show()
Exemple #26
0
  def Scroll(self,h,v,direction,moves,delay):
    #print("Entering Scroll")
    x = 0
    oldh = 0
    #Buffer = copy.deepcopy(unicorn.get_pixels())
    
    #modifier is used to increment or decrement the location
    if direction == "right" or direction == "down":
      modifier = 1
    else: 
      modifier = -1
    
    #print("Modifier:",modifier)
    
    if direction == "left" or direction == "right":
      #print ("Direction: ",direction)  
      for count in range (0,moves):
        h = h + (modifier)
        #erase old sprite
        if count >= 1:
          oldh = h - modifier
          #print ("Scroll:",self.width, self.height, self.r, self.g, self.b,h,v)
          unicorn.clear()

        #draw new sprite
        self.Display(h,v)
        
        try:
          unicorn.show()
          
        except Exception as ErrorMessage:
          TheTrace = traceback.format_exc()
          print("")
          print("")
          print("--------------------------------------------------------------")
          print("ERROR - Unicorn.show")
          print(ErrorMessage)
          print("")
          #print("EXCEPTION")
          #print(sys.exc_info())
          print("")
          print ("TRACE")
          print (TheTrace)
          print("--------------------------------------------------------------")
          print("")
          print("")
          unicorn.clear()
          ShowScrollingBanner("Display Error!",100,0,0,delay)
        
        time.sleep(delay)
Exemple #27
0
 def drawLastHour(self):
     """Display the max counter value over the last hour."""
     unicornhathd.clear()
     now = datetime.datetime.now()
     vals = [
         val for (dt, val) in self.values
         if now - dt <= datetime.timedelta(seconds=60 * 60)
     ]
     maxval = max(vals)
     im = self.blueFont.drawString("{:02d}".format(maxval))
     scrollImage(im, 0, 0, HEIGHT, 8, 0.0, horiz=False)
     unicornhathd.show()
     im = self.redFont.drawString("LAST HOUR ")
     scrollImage(im, 0, 0, WIDTH + 1, -im.size[0], 0.02)
def update_counter():
    threading.Timer(1.0, update_counter).start()

    seconds = math.ceil(
        (datetime(2020, 6, 1) - datetime.now()).total_seconds())
    bin_seconds = str(bin(seconds))[2:]

    unicornhathd.clear()
    for i in range(len(bin_seconds)):
        if bin_seconds[i] == "1":
            # x is inverted because pixel indexing is bugged
            x, y = (15 - i % u_width), (i // u_width)
            unicornhathd.set_pixel(x, y, 255, 255, 255)

    unicornhathd.show()
Exemple #29
0
def loop(event):
    """
        ループ関数
        引数にEventオブジェクトをとり、終了イベントを受け取れるように改変を加えている。
    """
    logger.debug('clock loop start.')

    unicornhathd.rotation(0)

    # ループ条件をeventオブジェクトがイベントを受け取っていないことにしている
    # eventがセットされるとループを終了する
    while not event.is_set():

        # 描写用キャンバスの新規作成
        image = Image.new("RGB", (width, height), (0, 0, 0))
        draw = ImageDraw.Draw(image)

        # 現在時刻の取得
        now = datetime.datetime.now()

        # キャンバスに時、分の描写
        draw.text((0, -1), '{0:02}'.format(now.hour), fill=COLOR, font=font)
        draw.text((0, 8), '{0:02}'.format(now.minute), fill=COLOR, font=font)

        # ここからunicornhatへキャンバス描写作業
        unicornhathd.clear()

        # x, yを指定して1ドットずつ描写する
        for x in range(width):
            for y in range(height):
                r, g, b = image.getpixel((x, y))
                # ここの部分でx軸を反転させている
                unicornhathd.set_pixel(width - x - 1, y, r, g, b)

        # コロンの代わりに2x2のドットを描写する
        if now.second % 2:
            unicornhathd.set_pixel(0, height - 1, *COLOR)
            unicornhathd.set_pixel(1, height - 1, *COLOR)
            unicornhathd.set_pixel(0, height - 2, *COLOR)
            unicornhathd.set_pixel(1, height - 2, *COLOR)

        # 画面のリフレッシュ命令
        unicornhathd.show()

        time.sleep(0.1)

    logger.debug('clock loop end.')
Exemple #30
0
def renderError():
    image = Image.new("RGB", (width, height), (0, 0, 0))
    draw = ImageDraw.Draw(image)

    draw.text((0, -1), 'ERR', fill=COLOR, font=font)
    draw.text((0, 4), 'OR', fill=COLOR, font=font)
    unicornhathd.clear()

    # x, yを指定して1ドットずつ描写する
    for x in range(width):
        for y in range(height):
            r, g, b = image.getpixel((x, y))
            # ここの部分でx軸を反転させている
            unicornhathd.set_pixel(width - x - 1, y, r, g, b)

    # 画面のリフレッシュ命令
    unicornhathd.show()
Exemple #31
0
 def drawBargraph(self):
     """Plot the most recent values on a bargraph."""
     unicornhathd.clear()
     last_values = self.values[-self.width:]
     for index, val in enumerate(last_values):
         dt, count = val
         if count > self.height - 1:
             count = self.height - 1
         for y in range(self.height):
             if y < count:
                 color = interpolate((255, 0, 0), (255, 255, 0),
                                     (y * 1.0) / self.height)
             else:
                 color = (0, 0, 0)
             r, g, b = color
             unicornhathd.set_pixel(index, y, r, g, b)
     unicornhathd.show()
     im = self.grayFont.drawString("RECENT ACTIVITY ")
     scrollImage(im, 0, 0, WIDTH + 1, -im.size[0], 0.02)