Skip to content

Commit 1f919f3

Browse files
author
Andreas Kugel
committed
update
1 parent eedcd79 commit 1f919f3

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

src/4-colorGraphics.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def dl(x,y,len=0,dir=-1,col=128):
2020
else:
2121
print("invaid direction")
2222
return x,y
23-
23+
2424
# recursive line drawing
2525
def rdl(x,y,len=0,dir=-1,col=128):
2626
I[x,y,0] = col[0]
@@ -70,7 +70,7 @@ def rdl(x,y,len=0,dir=-1,col=128):
7070
y = x
7171
l = 20
7272
for i in range(10):
73-
x,y = dl(x,y,l,i%4,(255,0,0))
73+
x,y = dl(x,y,l,i%4,(0,0,255))
7474
l += 5
7575

7676
# drawing with recursive function
@@ -80,12 +80,12 @@ def rdl(x,y,len=0,dir=-1,col=128):
8080
for i in range(10):
8181
x,y = dl(x,y,l,i%4,(0,255,0))
8282
l += 5
83-
83+
8484

8585
# setting the climit is important!
8686
plt.imshow(I,clim=(0,255))
8787
plt.axis('off')
88-
88+
8989
##while None == plt.waitforbuttonpress(.1):
9090
## plt.draw()
9191

@@ -108,10 +108,10 @@ def rdl(x,y,len=0,dir=-1,col=128):
108108
v = 200 # default V
109109
for r in range(N):
110110
for c in range(N):
111-
I[r,c] = (r,c,v)
111+
I[r,c] = (r,c,v)
112112

113113
# convert to RGB
114-
I2 = color.hsv2rgb(I)
114+
I2 = color.hsv2rgb(I)
115115

116116
# make a scaled RGB image with color resolution RGB:565
117117
J = np.empty((N,N,3), dtype = np.uint8)
@@ -134,14 +134,10 @@ def rdl(x,y,len=0,dir=-1,col=128):
134134
p2.imshow(I2,clim=(0,255))
135135
p2.axis('off')
136136
p2.set_title("HSV Colors\nH down, S right\nV = 200")
137-
137+
138138
plt.show()
139139

140140

141141

142142
print("Done")
143143
plt.close()
144-
145-
146-
147-

0 commit comments

Comments
 (0)