Post by DarkPikachu on Jan 27, 2011 21:11:17 GMT -5
I've decided to make my dev-thread for this here instead of my forum...
my forum is starting to get a bit crowded with my posts... >_>
so yea...
I've been working on this thing for some time now...
I've gotten the basic layout, but I still need to add the vertical scrollbar...
basically all it does atm is open an REFT (MiscData[2]) file and view the images stored within it...
I'll add the option to:
R-Click an image and export as tex0
R-Click the REFT and export as brres
--more ideas at the bottom--
and there's still quite a few formats that need conversion done:
(all code is in python)
I4 (4bit greyscale):
(no image)
conversion notes:
8x8 tiles
'0' = '00' = 0
'1' = '11' = 17
'F' = 'FF' = 255
greyscale = R=G=B=pixel+pixel
I8 (8bit greyscale):
conversion notes:
8x4 tiles
greyscale = R=G=B=pixel
IA4 (4bit greyscale + 4bit alpha (8bit pixels)):
-unconverted-
conversion notes:
todo...
IA8 (8bit greyscale + 8bit alpha (16bit pixels)):
-unconverted-
conversion notes:
todo...
RGB565 (16bit color):
conversion notes:
4x4 tiles
16bit: R5 G6 B5
00000000 00000000
RGB5A3 (16bit color + alpha):
-unconverted-
conversion notes:
todo...
RGBA8 (32bit pixels):
-unconverted-
conversion notes:
todo...
CI4:
CI8:
CMPR:
right now, it's only a viewer...
but I intend to add a bunch of stuff to it and make it into an editor...
ideas:
export/replace tex0 images
export/import brres
allow interchange formats and sizes
(image does not have to be format/size specific)
^be careful to watch for tile ranges though... (multiples of 4 or 8)
my forum is starting to get a bit crowded with my posts... >_>
so yea...
I've been working on this thing for some time now...
I've gotten the basic layout, but I still need to add the vertical scrollbar...
basically all it does atm is open an REFT (MiscData[2]) file and view the images stored within it...
I'll add the option to:
R-Click an image and export as tex0
R-Click the REFT and export as brres
--more ideas at the bottom--
and there's still quite a few formats that need conversion done:
(all code is in python)
I4 (4bit greyscale):
(no image)
conversion notes:
8x8 tiles
'0' = '00' = 0
'1' = '11' = 17
'F' = 'FF' = 255
greyscale = R=G=B=pixel+pixel
def I4(offset,width,height,length):
....X,Y,TX,TY = 2,2,0,0
....fr.seek(offset,0) #absolute position
....while length > 0:
........pixels = list(fr.read(1).encode('hex'))
........for pixel in pixels:
............R=G=B=pixel+pixel; color,x,y = '#'+R+G+B,TX+X,TY+Y #color and coords
............C.create_rectangle ( x, y, (x+1), (y+1), fill=color, width=0) #draw a pixel
............#positioning math:
............TX+=1
............if TX == 8:
................TY += 1
................if TY == 8 and TX == 8:
....................X += 8; TX,TY = 0,0
....................if X == width+2: Y += 8; X = 2
................if TY == 8: TY = 0
................TX = 0
........length -= 1
#this code can be redone
I8 (8bit greyscale):
conversion notes:
8x4 tiles
greyscale = R=G=B=pixel
def I8(offset,width,height,length):
....X,Y,TX,TY = 2,2,0,0; fr.seek(offset,0)
....while length > 0:
........pixel = fr.read(1).encode('hex')
........R=G=B=pixel; color,x,y = '#'+R+G+B,TX+X,TY+Y
........C.create_rectangle ( x, y, (x+1), (y+1), fill=color, width=0)
........#positioning math
........TX+=1
........if TX == 8:
............TY += 1
............if TY == 4 and TX == 8:
................X += 8; TX,TY = 0,0
................if X == width+2: Y += 4; X = 2
............if TY == 4: TY = 0
............TX = 0
........length -= 1
IA4 (4bit greyscale + 4bit alpha (8bit pixels)):
-unconverted-
conversion notes:
todo...
IA8 (8bit greyscale + 8bit alpha (16bit pixels)):
-unconverted-
conversion notes:
todo...
RGB565 (16bit color):
conversion notes:
4x4 tiles
16bit: R5 G6 B5
00000000 00000000
def RGB565(offset,width,height,length):
....X,Y,TX,TY = 2,2,0,0; fr.seek(offset,0)
....while length > 0:
........pixel = ui(fr.read(2))
........R = chr(((pixel >> 11) & 31) << 3).encode('hex')
........G = chr(((pixel >> 5) & 63) << 2).encode('hex')
........B = chr(((pixel >> 0) & 31) << 3).encode('hex')
........color,x,y = '#'+R+G+B,TX+X,TY+Y
........C.create_rectangle ( x, y, (x+1), (y+1), fill=color, width=0)
........TX+=1
........if TX == 4:
............TY += 1
............if TY == 4 and TX == 4:
................X += 4; TX,TY = 0,0
................if X == width+2: Y += 4; X = 2
............if TY == 4: TY = 0
............TX = 0
........length -= 2
#code has only ~96% color accuracy
RGB5A3 (16bit color + alpha):
-unconverted-
conversion notes:
todo...
RGBA8 (32bit pixels):
-unconverted-
conversion notes:
todo...
CI4:
CI8:
CMPR:
right now, it's only a viewer...
but I intend to add a bunch of stuff to it and make it into an editor...
ideas:
export/replace tex0 images
export/import brres
allow interchange formats and sizes
(image does not have to be format/size specific)
^be careful to watch for tile ranges though... (multiples of 4 or 8)