[SDL] Pixel byte manipulation question.

matt hull mattmatteh at mac.com
Tue Oct 2 20:33:14 PDT 2007


i suggest you use the pixel mask and not hard code it.  i tried to  
base my application on endianness and it fails when tested on a  
graphics driver that uses a different format.  sure you could specify  
that you want a certain format i think, but then SDL will internally  
convert it during run time, which my be a speed hit.

matt

On Oct 2, 2007, at 6:35 PM, 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?
>
> Maybe it'll be more enlightening to look at the screen blitting
> functions to see what they expect.



More information about the SDL mailing list