コード例 #1
0
ファイル: time.py プロジェクト: CLiu13/ProjectorOS
def showtime():
  timeimg = blankimg.copy()  	  
  draw = ImageDraw.Draw(timeimg)

  t = time.strftime('%l:%M:%S%p')
  draw.text((x,y), t, (255, 255, 255), font=font)

  timeimg=timeimg.resize((w,h), Image.ANTIALIAS)

  transimg=transfunction.project(timeimg, coeffs)
  transimg.save(loadimg_path)

  loadimg=pygame.image.load(loadimg_path)
  screen.blit(loadimg,(0,0))
  pygame.display.update()
コード例 #2
0
ファイル: main.py プロジェクト: CLiu13/ProjectorOS
from PIL import Image
from transfunction import transfunction
from screenres import screenres

w = screenres.width
h = screenres.height

oldimg = Image.open(sys.argv[1])
newimg = oldimg.resize((w, h), Image.ANTIALIAS)
newimg.save("/home/pi/ProjectorOS/tools/images/resize.jpg")

img = Image.open("/home/pi/ProjectorOS/tools/images/resize.jpg")
xc = float(sys.argv[2])
yc = float(sys.argv[3])
coeffs = transfunction.coeffs(w, h, xc, yc)
transimg = transfunction.project(img, coeffs)
transimg.save("/home/pi/ProjectorOS/tools/images/new.jpg")
time.sleep(5)

loadimg = pygame.image.load("/home/pi/ProjectorOS/tools/images/new.jpg")

pygame.init()
screen = pygame.display.set_mode((w, h))

screen.blit(loadimg, (0, 0))
pygame.display.update()

while True:
    for event in pygame.event.get():
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_q:
コード例 #3
0
ファイル: main.py プロジェクト: CLiu13/ProjectorOS
from PIL import Image
from transfunction import transfunction
from screenres import screenres

w = screenres.width
h = screenres.height

oldimg=Image.open(sys.argv[1])
newimg=oldimg.resize((w,h), Image.ANTIALIAS)
newimg.save("/home/pi/ProjectorOS/tools/images/resize.jpg")

img=Image.open("/home/pi/ProjectorOS/tools/images/resize.jpg")
xc=float(sys.argv[2])
yc=float(sys.argv[3])
coeffs=transfunction.coeffs(w, h, xc, yc)
transimg=transfunction.project(img, coeffs)
transimg.save("/home/pi/ProjectorOS/tools/images/new.jpg")
time.sleep(5)

loadimg=pygame.image.load("/home/pi/ProjectorOS/tools/images/new.jpg")

pygame.init()
screen = pygame.display.set_mode((w,h))

screen.blit(loadimg,(0,0))
pygame.display.update()

while True:
  for event in pygame.event.get():
    if event.type == pygame.KEYDOWN:
      if event.key == pygame.K_q: