improve Makefile, update example pictures
This commit is contained in:
parent
91306135b2
commit
0ea7dcef29
13 changed files with 89 additions and 50 deletions
|
|
@ -31,15 +31,22 @@ def process_pixdata(outfile, pixdata, frameindex = 0, pix_w=640, pix_h=400):
|
|||
x += 8
|
||||
y += 1
|
||||
|
||||
def write_palette_word(outfile, r, g, b):
|
||||
r4 = r >> 4
|
||||
g4 = g >> 4
|
||||
b4 = b >> 4
|
||||
c12 = r4 << 8 | g4 << 4 | b4
|
||||
|
||||
outfile.write(c12.to_bytes(4, 'big'))
|
||||
|
||||
|
||||
def process_palette(outfile, palette):
|
||||
for r,g,b in palette:
|
||||
r4 = r >> 4
|
||||
g4 = g >> 4
|
||||
b4 = b >> 4
|
||||
c12 = r4 << 8 | g4 << 4 | b4
|
||||
|
||||
outfile.write(c12.to_bytes(4, 'big'))
|
||||
if len(palette[0]) == 4:
|
||||
for r,g,b,a in palette:
|
||||
write_palette_word(outfile, r, g, b)
|
||||
else:
|
||||
for r,g,b in palette:
|
||||
write_palette_word(outfile, r, g, b)
|
||||
|
||||
|
||||
def write_header(outfile):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue