[SDL] Pixel byte manipulation question.

Bob Pendleton bob at pendleton.com
Tue Oct 2 16:45:34 PDT 2007


On Wed, 2007-10-03 at 00:35 +0100, Paul Duffy wrote:
> On Tue, 2007-10-02 at 13:33 -0500, matt hull wrote:
> > On Oct 2, 2007, at 10:45 AM, Paul Duffy wrote:
> 
> > i am not sure how SDL handles internal surfaces.
> > 
> > are you writing an application with SDL or trying to understand it  
> > more ?
> 
> Well, mainly I need the ability to blit arbitrary pixels, and clear by
> colorkey regardless of colour depth or platform.
> 
> > you could look at the source.
> 
> I've been doing a fair bit of prodding at pixels.c, SDL_Surface.c and
> the SDL_image files but it's quite time consuming. I've garnered a fair
> bit about how it's all put together but this last detail's a bit
> heavy-going and I may have to go through everything that does anything
> with the data to know what I can and can't expect e.g. is it permissable
> to have the masks r = 0xFF000000, g = 0x00FF0000, b = 0x0000FF00 for a
> 24 bit RGB image or do the first two bytes _have_ to be zero if no Alpha
> mask is present?

The only way I can think of that would allow you to have two bytes of
alpha is to have 64 bit pixels. SDL doesn't do anything with 64 bit
pixels.

Are you perhaps thinking that the "F"s in the mask represent bytes? If
so, they do not, they represent nybbles (4 bits) not bytes (8) bits. Or
was that just a typo? 

Anyway, it is possible to have a pixel laid out with the RGB masks you
listed. Not common, but possible.

Bob Pendleton

> 
> Maybe it'll be more enlightening to look at the screen blitting
> functions to see what they expect.
> 
> Thanks for replying anyway :o)
> 
> 
> 		
> ___________________________________________________________ 
> To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
> 
-- 
+--------------------------------------+
+ Bob Pendleton: writer and programmer +
+ email: Bob at Pendleton.com             +
+ web: www.GameProgrammer.com          +
+ www.Wise2Food.com                    +
+ nutrient info on 7,000+ common foods +
+--------------------------------------+




More information about the SDL mailing list