コード例 #1
0
def main():
    epd = epd1in54c.EPD()
    epd.init()

    # clear the frame buffer
    frame_black = [0xFF] * (epd.width * epd.height / 8)
    frame_red = [0xFF] * (epd.width * epd.height / 8)

    # For simplicity, the arguments are explicit numerical coordinates
    epd.draw_rectangle(frame_black, 10, 60, 50, 110, COLORED)
    epd.draw_line(frame_black, 10, 60, 50, 110, COLORED)
    epd.draw_line(frame_black, 50, 60, 10, 110, COLORED)
    epd.draw_circle(frame_black, 100, 80, 30, COLORED)
    #    epd.draw_filled_rectangle(frame_red, 10, 130, 50, 180, COLORED)
    epd.draw_filled_rectangle(frame_red, 0, 6, 152, 26, COLORED)
    #    epd.draw_filled_circle(frame_red, 120, 150, 30, COLORED)

    # write strings to the buffer
    font = ImageFont.truetype(
        '/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf', 18)
    epd.display_string_at(frame_black, 10, 30, "e-Paper Demo", font, COLORED)
    epd.display_string_at(frame_red, 18, 10, "Hello world!", font, UNCOLORED)
    # display the frame
    epd.display_frame(frame_black, frame_red)
    time.sleep(2)
    # display images
    frame_black = epd.get_frame_buffer(Image.open('black.bmp'))
    frame_red = epd.get_frame_buffer(Image.open('yellow.bmp'))
    epd.display_frame(frame_black, frame_red)

    epd.sleep()
コード例 #2
0
#!/usr/bin/python
# -*- coding:utf-8 -*-

import epd1in54c
import time
from PIL import Image, ImageDraw, ImageFont
import traceback

try:
    epd = epd1in54c.EPD()
    epd.init(epd.lut_full_update)
    epd.Clear(0xFF)

    # Drawing on the image
    image = Image.new('1', (epd1in54.EPD_WIDTH, epd1in54.EPD_HEIGHT),
                      255)  # 255: clear the frame

    draw = ImageDraw.Draw(image)
    font = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc',
                              24)
    draw.rectangle((0, 10, 200, 34), fill=0)
    draw.text((8, 12), 'hello world', font=font, fill=255)
    draw.text((8, 36), 'e-Paper Demo', font=font, fill=0)
    draw.line((16, 60, 56, 60), fill=0)
    draw.line((56, 60, 56, 110), fill=0)
    draw.line((16, 110, 56, 110), fill=0)
    draw.line((16, 110, 16, 60), fill=0)
    draw.line((16, 60, 56, 110), fill=0)
    draw.line((56, 60, 16, 110), fill=0)
    draw.arc((90, 60, 150, 120), 0, 360, fill=0)
    draw.rectangle((16, 130, 56, 180), fill=0)
コード例 #3
0
ファイル: eink.py プロジェクト: FloppyDisck/e-ink-lib
def get_epd1in54c():
    return epd1in54c.EPD()