Index:
[thread]
[date]
[subject]
[author]
From: Marcus Sundberg <mackan@stacken.kth.se>
To : ggi-develop@eskimo.com
Date: Mon, 29 Mar 1999 16:44:44 +0000
Re: FW: Visuals 'n stuff
Jim Kjellin wrote:
> I found something rather intresting/annoying when messing around with
> memory visuals.
>
> if you do a ggiGetPixelFormat on the visual (this is after the main visual
> for the screen
> has been created btw) which is in 32-bit mode, i got the following:
> red_mask 0x00ff000000
> green_mask 0x0000ff00
> blue_mask 0x000000ff
> red_shift 8
> green_shift 16
> blue_shift 24
>
> now this looks screwed since this is wrong for my endianesss (intel type),
No, this is perfectly correct.
> what is even
> more screwed is if I make it a 24-bit visual (packed mode) I get the
> _exact_ same values.
This is also correct.
> Now shifting 24 times in a 24-bit environment is not healthy for you
> little bits, they tend
> to run home if you try it.
>
> This was what was messing my code up and when hard-coding (BAD (tm)) the
> shift values it works.
If you look at ggi/ggi.h you'll see that the shifts tells you how
much you should shift _down_ a 32-bit (or rather
sizeof(ggi_pixel)*8-bit)
color component.
Note that LibGGI color functions still use 16-bit color components,
the reason for assuming 32-bit values in the pixelformat is that
we then get only positive shift values.
//Marcus
--
-------------------------------+------------------------------------
Marcus Sundberg | http://www.stacken.kth.se/~mackan/
Royal Institute of Technology | Phone: +46 707 295404
Stockholm, Sweden | E-Mail: mackan@stacken.kth.se
Index:
[thread]
[date]
[subject]
[author]