Re : SDL SURFACE QUERY

It’s not very clear what you want to do, please precise what are “pSurface” and? “m_pSurface”.
By the way, I’m not sure but the RGB masks don’t seem to be correct …
Personnally I’ve never cared about those masks and simply set:
Surface = SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32, 0, 0, 0, 0);

Instead. Did you try it ?

I may be wrong (yet it works), can someone explain what’s the use of those rmask, gmask, bmask, amask ?

Thanks

— En date de?: Mer 20.5.09, jyoti a ?crit?:de: jyoti
Objet: [SDL] SDL SURFACE QUERY
?: sdl at libsdl.org
Date: Mercredi 20 Mai 2009, 10h37

Hi

I m new to sdl. I m trying sum basic things like I wish to make a surface on a
bigger surface and change the color of the smaller surface to red.

I used following code for smaller surface:

Surface = SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h,
32,0xff000000,0xff000000,0xff000000,0xffffffff);
SDL_FillRect(Surface, NULL, SDL_MapRGB(m_pSurface->format, 255, 0,0));
SDL_Flip(pSurface);

but the color is not getting set. pls help.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

From the doc wiki:

[RGBA]mask are the bitmasks used to extract that colour from a pixel.
For instance, Rmask being FF000000 means the red data is stored in the
most significant byte. Using zeros for the RGB masks sets a default
value, based on the depth. (e.g.
SDL_CreateRGBSurface(flags,w,h,32,0,0,0,0):wink: However, using zero for
the Amask results in an Amask of 0.

MakOn Wed, May 20, 2009 at 10:57 AM, julien CLEMENT wrote:

It’s not very clear what you want to do, please precise what are "pSurface"
and? “m_pSurface”.
By the way, I’m not sure but the RGB masks don’t seem to be correct …
Personnally I’ve never cared about those masks and simply set:
Surface = SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32, 0, 0, 0,
0);

Instead. Did you try it ?

I may be wrong (yet it works), can someone explain what’s the use of those
rmask, gmask, bmask, amask ?

Thanks

— En date de?: Mer 20.5.09, jyoti a ?crit?:

De: jyoti
Objet: [SDL] SDL SURFACE QUERY
?: sdl at libsdl.org
Date: Mercredi 20 Mai 2009, 10h37

Hi

I m new to sdl. I m trying sum basic things like I wish to make a surface on
a
bigger surface and change the color of the smaller surface to red.

I used following code for smaller surface:

Surface = SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h,
32,0xff000000,0xff000000,0xff000000,0xffffffff);
SDL_FillRect(Surface, NULL, SDL_MapRGB(m_pSurface->format, 255, 0,0));
SDL_Flip(pSurface);

but the color is not getting set. pls help.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thank you Mak.

— En date de?: Mer 20.5.09, Mak Naze?i?-Andrlon a ?crit?:de: Mak Naze?i?-Andrlon
Objet: Re: [SDL] Re : SDL SURFACE QUERY
?: “A list for developers using the SDL library. (includes SDL-announce)”
Date: Mercredi 20 Mai 2009, 11h28

From the doc wiki:

[RGBA]mask are the bitmasks used to extract that colour from a pixel.
For instance, Rmask being FF000000 means the red data is stored in the
most significant byte. Using zeros for the RGB masks sets a default
value, based on the depth. (e.g.
SDL_CreateRGBSurface(flags,w,h,32,0,0,0,0):wink: However, using zero for
the Amask results in an Amask of 0.

Mak

On Wed, May 20, 2009 at 10:57 AM, julien CLEMENT <@Julien_Clement1> wrote:

It’s not very clear what you want to do, please precise what are "pSurface"
and? “m_pSurface”.
By the way, I’m not sure but the RGB masks don’t seem to be correct …
Personnally I’ve never cared about those masks and simply set:
Surface = SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32, 0, 0, 0,
0);

Instead. Did you try it ?

I may be wrong (yet it works), can someone explain what’s the use of those
rmask, gmask, bmask, amask ?

Thanks

— En date de?: Mer 20.5.09, jyoti a ?crit?:

De: jyoti
Objet: [SDL] SDL SURFACE QUERY
?: sdl at libsdl.org
Date: Mercredi 20 Mai 2009, 10h37

Hi

I m new to sdl. I m trying sum basic things like I wish to make a surface on
a
bigger surface and change the color of the smaller surface to red.

I used following code for smaller surface:

Surface = SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h,
32,0xff000000,0xff000000,0xff000000,0xffffffff);
SDL_FillRect(Surface, NULL, SDL_MapRGB(m_pSurface->format, 255, 0,0));
SDL_Flip(pSurface);

but the color is not getting set. pls help.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Try this?

#if SDL_BYTEORDER == SDL_BIG_ENDIAN
Surface = SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32,
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
#else
Surface = SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32,
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
#endif

SDL_FillRect(Surface, NULL, SDL_MapRGBA(Surface->format, 255, 0,0,
SDL_ALPHA_OPAQUE));
SDL_BlitSurface(Surface, NULL, pSurface, NULL);
SDL_Flip(pSurface);

Jonny D