[SDL] Accesing pixels directly in an image

Lilith Calbridge lilith at dcccd.edu
Wed Sep 13 05:24:35 PDT 2006


In that instance you want to type cast the pointer.  However, you likely
need to be aware of what the bit depth of the image is.  If your color
depth is 32 bpp you want to use a type cast of something line (int32 *).
(or is that Int32 *)?

Lilith

>>> On 9/13/2006 at 12:25 AM, in message
<20060913052520.87811.qmail at web51111.mail.yahoo.com>, Alfonso Palma
<ponchete at yahoo.com> wrote:
> Hi everyone i'm new at SDL and i would like to ask for
> a solution for this problem
> 
> I have just done something like this:
> 
> SDL_Surface *image;
> image = SDL_LoadBMP("whatever.bmp");
> 
> // Then i need to access the pixels of this bmp
> // so i would call:
> 
> math_operation = image->pixels[index];
> 
> // and whatever use i want, right?
> 
> But pixels is a *void pointer and when i try to
> compile this i get the error
> 
> error C2036: 'void *' : unknown size
> 
> and any arithmetical operation done with this pixels
> is invalid
> 
> so, any sugestions on trying to access this pixels as
> float numbers?
> 
> Any help is really apreciated
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org 
> http://www.libsdl.org/mailman/listinfo/sdl




More information about the SDL mailing list