File:Screen Shot.jpg: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
import struct, array | |||
width = 320 | |||
height = 240 | |||
filename="original.tga" | |||
datafile = open(filename, "wb") | |||
header = struct.pack("<BBBHHBHHHHBB", 0, 0, 2, 0, 0, 8, 0, 0, width, height, 24, 1 << 5) | |||
datafile.write(header) | |||
data = '' | |||
for y in xrange(50): | |||
for x in xrange(50): | |||
r, g, b = 5, 0, 205 | |||
#achtergrond | |||
if x > 10 and x < 10: | |||
#middenstuk eerste cf breedte ervoor 2de breedte ding zelf | |||
g = 255 | |||
if y < 20: | |||
#hoogte bovenste kolom | |||
r = 255 | |||
if y > 120: | |||
b = 128 | |||
for x in xrange(50): | |||
for y in xrange(50): | |||
if y > 10 and x < 10: | |||
#middenstuk eerste cf breedte ervoor 2de breedte ding zelf | |||
g = 255 | |||
if y < 20: | |||
#hoogte bovenste kolom | |||
r = 255 | |||
if y > 120: | |||
b = 128 | |||
data += struct.pack('B', b) | |||
data += struct.pack('B', g) | |||
data += struct.pack('B', r) | |||
datafile.write(data) | |||
datafile.close() | |||
Hoe teken je een schuine lijn? | |||
Hoe gebruik je loops? | |||
[[File:Sound|thumbnail]] |
Latest revision as of 16:30, 11 October 2013
import struct, array
width = 320 height = 240
filename="original.tga" datafile = open(filename, "wb")
header = struct.pack("<BBBHHBHHHHBB", 0, 0, 2, 0, 0, 8, 0, 0, width, height, 24, 1 << 5) datafile.write(header)
data =
for y in xrange(50):
for x in xrange(50): r, g, b = 5, 0, 205 #achtergrond
if x > 10 and x < 10: #middenstuk eerste cf breedte ervoor 2de breedte ding zelf g = 255 if y < 20: #hoogte bovenste kolom r = 255 if y > 120: b = 128
for x in xrange(50):
for y in xrange(50):
if y > 10 and x < 10: #middenstuk eerste cf breedte ervoor 2de breedte ding zelf g = 255 if y < 20: #hoogte bovenste kolom r = 255 if y > 120: b = 128
data += struct.pack('B', b) data += struct.pack('B', g) data += struct.pack('B', r)
datafile.write(data) datafile.close()
Hoe teken je een schuine lijn? Hoe gebruik je loops?
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 16:27, 11 October 2013 | 1,440 × 900 (662 KB) | Elleke Hageman (talk | contribs) |
You cannot overwrite this file.
File usage
The following page uses this file: