From: <edh...@us...> - 2008-03-16 01:30:35
|
Revision: 5123 http://gemrb.svn.sourceforge.net/gemrb/?rev=5123&view=rev Author: edheldil Date: 2008-03-15 18:30:39 -0700 (Sat, 15 Mar 2008) Log Message: ----------- * fixed palette color order * added write_ppm function Modified Paths: -------------- ie_shell/branches/iesh-infinity/infinity/formats/mos.py Modified: ie_shell/branches/iesh-infinity/infinity/formats/mos.py =================================================================== --- ie_shell/branches/iesh-infinity/infinity/formats/mos.py 2008-03-15 16:44:29 UTC (rev 5122) +++ ie_shell/branches/iesh-infinity/infinity/formats/mos.py 2008-03-16 01:30:39 UTC (rev 5123) @@ -82,20 +82,20 @@ ) palette_entry_desc = ( - { 'key': 'r', + { 'key': 'b', 'type': 'BYTE', 'off': 0x0000, - 'label': 'R'}, + 'label': 'B'}, { 'key': 'g', 'type': 'BYTE', 'off': 0x0001, 'label': 'G'}, - { 'key': 'b', + { 'key': 'r', 'type': 'BYTE', 'off': 0x0002, - 'label': 'B'}, + 'label': 'R'}, { 'key': 'a', 'type': 'BYTE', @@ -202,8 +202,29 @@ ndx = ndx + 1 print print + + # FIXME: use stream instead of fh? + def write_ppm (self, fh): + fh.write ("P6\n") + fh.write ("# ie_shell\n"); + fh.write ("%d %d\n" %(self.header['width'], self.header['height'])); + fh.write ("255\n"); + for line in range (self.header['height']): + row = line / self.header['block_size'] + scanline = line % self.header['block_size'] + + for i in range (self.header['columns']): + tile = self.tile_list[(row * self.header['columns']) + i] + pal = tile['palette'] + + o = scanline * tile['width'] + for x in range (tile['width']): + pix = tile['tile_data'][o + x] + col = pal[pix] + fh.write ('%c%c%c' %(col['r'], col['g'], col['b'])) + class MOSC_Format (MOS_Format): envelope_desc = ( { 'key': 'signature', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |