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]

just a little note I found on the formats:

if format = #:
0 I4 (4 bit intensity, 8x8 tiles)
1 I8 (8 bit intensity, 8x4 tiles)
2 IA4 (4 bit intensity with 4 bit alpha, 8x4 tiles)
3 IA8 (8 bit intensity with 8 bit alpha, 4x4 tiles)
4 RGB565 (4x4 tiles)
5 RGB5A3 (*) (4x4 tiles)
6 RGBA8 (4x4 tiles in two cache lines - first is AR and second is GB)
8 CI4 (4 bit color index, 8x8 tiles)
9 CI8 (8 bit color index, 8x4 tiles)
10 CI14X2 (14 bit color index, 4x4 tiles)
14 CMP (S3TC compressed, 2x2 blocks of 4x4 tiles)

so they're indexed in tiles...
hmm...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.