-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblend.py
executable file
·55 lines (39 loc) · 1.34 KB
/
blend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
#SURFACES - BLENDING
import pygame as pg
pg.init()
screen = pg.display.set_mode((640, 480))
alive=True
position=(0,0)
image=pg.image.load('refimg.jpg')
while alive:
events=pg.event.get()
for e in events:
if e.type==pg.KEYDOWN:
if e.unicode:
print "KEY PRESSED:", e.unicode
if e.unicode=='q':
print "Quit"
alive=False
if e.unicode=='f':
print "Fill the screen"
screen.fill( (255,0,0))
if e.unicode=='p':
print "Paste image"
screen.blit(image,position)
if e.unicode=='a':
print "Blend image: ADD"
screen.blit(image,position,special_flags=pg.BLEND_ADD)
if e.unicode=='m':
print "Blend image: MULTIPLY"
screen.blit(image,position,special_flags=pg.BLEND_MULT)
if e.unicode=='b':
print "Blit image 2 on image 1"
image2=pg.image.load('refimg2.png')
image.blit(image2,(94,90))
screen.blit(image,position)
if e.unicode=='l':
print "Reload original image"
image=pg.image.load('refimg.jpg')
screen.blit(image,position)
pg.display.flip()