hey...
I've been working on my first GUI for a while now,
and I just need some input on it...
first off...
the image object won't work for tex0-type formatting...
so I have to make each pixel from the data provided...
I've gotten as far as reading the 32 byte image headers,
and sending the file position to the format readers...
here's the part of the code that sends the position based on the format:
if format == 0: I4 (img[1]-32, width, height, length) #4bit no alpha
if format == 1: I8 (img[1]-32, width, height, length) #8bit no alpha
if format == 2: IA4 (img[1]-32, width, height, length) #8bit alpha
if format == 3: IA8 (img[1]-32, width, height, length) #16bit alpha
if format == 4: RGB565 (img[1]-32, width, height, length) #16bit no alpha
if format == 5: RGB5A3 (img[1]-32, width, height, length) #16bit alpha
if format == 6: RGBA8 (img[1]-32, width, height, length) #32bit alpha
if format == 7: CMPR (img[1]-32, width, height, length) #4bit alpha
if format == 8: CI4 (img[1]-32, width, height, length) #yet to be found (has pallet)
if format == 9: CI8 (img[1]-32, width, height, length) #yet to be found (has pallet)
the only format I've somewhat completed is the I8 format...
still doesn't work correctly, but it reads what's needed... and then some...
def I8(offset,width,height,length):
X,Y = 0,0
read = 1
fr.seek(offset,0) #absolute position
while read:
pixel = str(fr.read(1).encode('hex')) #read 8bit pixel
color = '#'+pixel+pixel+pixel
C.create_rectangle ( X, Y, (X+1), (Y+1), fill=color, width=0) #draw pixel
#determine pixel position for next pixel
if X != width: X += 1 #next column
if X == width and Y != height: X = 0; Y += 1 #next row
if X == width and Y == height: read = 0 #stop
note, the above code is only experimental...
I have no documentation on any of the formats but the comments above
anyways...
now that I've cover'd that,
you'll notice some of the formats have a transparency...
how would I create a transparent pixel to let the canvas BG image show through??
EDIT:
here's a shot of what the code looks like in action:
[IMG]http://lh3.ggpht.com/_IteXPmeC6ek/TSPuuVvC1bI/AAAAAAAACUM/TLQmGGYLqRY/test1.jpg[/IMG]