Accesing pixels directly in an image

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

You want getpixel and putpixel from herE:

http://www.libsdl.org/intro.en/usingvideo.html

-bill!On Tue, Sep 12, 2006 at 10:25:20PM -0700, Alfonso Palma wrote:

Hi everyone i’m new at SDL and i would like to ask for
a solution for this problem

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 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

Getpixel? putpixel? where are those?

And

I tried to cast the pointer but i got some error
saying that it’s imposible

error C2440: ‘type cast’ : cannot convert from 'void’
to ‘unsigned int *’ Expressions of type void cannot be
converted to other types.

Anyway Thank you for the help!!!__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

check docs/html/guidevideoopengl.html
it’s all thereOn 9/13/06, Alfonso Palma wrote:

Getpixel? putpixel? where are those?

And

I tried to cast the pointer but i got some error
saying that it’s imposible

error C2440: ‘type cast’ : cannot convert from 'void’
to ‘unsigned int *’ Expressions of type void cannot be
converted to other types.

Anyway Thank you for the help!!!


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


Rodolfo Borges

also:
http://www.libsdl.org/cgi/docwiki.cgi/Pixel_20Access

this library has it, and other useful routines too:
http://www.ferzkopp.net/Software/SDL_gfx-2.0/On 9/13/06, Alfonso Palma wrote:

Getpixel? putpixel? where are those?

And

I tried to cast the pointer but i got some error
saying that it’s imposible

error C2440: ‘type cast’ : cannot convert from 'void’
to ‘unsigned int *’ Expressions of type void cannot be
converted to other types.

Anyway Thank you for the help!!!


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


Rodolfo Borges

sigh Ok, so the page I refered you to had something like the
standard putpixel example, except called DrawPixel. Sorry.

Anyway, I suggest you check out this great website that can help with these
kinds of issues:

http://66.102.7.147/

Here’s a post to the SDL list with some getpixel/putpixel examples:

http://www.libsdl.org/pipermail/sdl/2006-March/073395.htmlOn Wed, Sep 13, 2006 at 09:57:24AM -0700, Alfonso Palma wrote:

Getpixel? putpixel? where are those?


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/

Thank u for all the help__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com