SDL_BlitSurface and alpha

Hello.
I am not sure SDL_BlitSurface behaviour.

  • I create 24-bit surface (CreateRGBSurface), should Amask=0xff000000 or 0 ?
    what is going on when it’s not 0?

  • I create 32-bit surface called surfaceB, Amask = 0xff000000, 32-bit video
    mode surface is surfaceA, now I BlitSurface B to A - no effect, but when I
    first Blit A to B, then change B->pixels, then blit B to A - everything is OK

I read man pages, but I don’t know what to think about it.–
Look all around
Can’t you open your eyes
Voices are calling "Master of Insanity"
Killing rain falling down from the sky - Ronnie James Dio

Hi!

I wander if there is some list of supported bit depths of the SDL surface
on several platforms and using different drivers.
Tha main point is to know what bit depth I should use as the default one.
I’d like to know if I can assume that most of the devices (drivers)
support 8bit or 16bit depth instead.
SDL is already ported on a wide variety of OSes and has even wider range
of drivers there so I need some advice here while speaking of most
compatible bit depth to use.

best regards

STan

hi,

if I have a SDL_Surface* like
SDL_Surface *s = SDL_LoadBMp(“file.bmp”);

how can I create another SDL_Surface with the same format as s
but, for example, with half of the with?

I saw on a SDL tuturial that we should lock a surface before SDL_BlitSurface
and then unlock it
why?

Pedro Santos_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

how can I create another SDL_Surface with the same format as s
but, for example, with half of the with?

man SDL_CreateRGBSurface

I saw on a SDL tuturial that we should lock a surface before SDL_BlitSurface
and then unlock it
why?

AFAIK Blit must be done when surface is not lockedOn Mon, Nov 05, 2001 at 09:46:22PM -0000, Pedro Santos wrote:


Oh I see his face! Where is your star?
Is it far, is it far, is it far?
When do we leave?
I believe, yes, I believe “Stargazer” - Ronnie James Dio

ok, i have a large .bmp the i loaded into background and i want to
just take the part of it and store it in another SDL_Surface called
tmp.
how do i do this ? I want to take coordinates starting at (0,0) to
(50,50)

thanks
mark

line72 at postmark.net

SDL_Rect rect;

rect.x = 0;
rect.y = 0;
rect.w = 50;
rect.h = 50;
SDL_BlitSurface (image, &rect, tmp, NULL);On Wed, 2002-07-17 at 23:18, Mark D’voo wrote:

ok, i have a large .bmp the i loaded into background and i want to
just take the part of it and store it in another SDL_Surface called
tmp.
how do i do this ? I want to take coordinates starting at (0,0) to
(50,50)

ok, i have a large .bmp the i loaded into background and i want to
just take the part of it and store it in another SDL_Surface called
tmp.
how do i do this ? I want to take coordinates starting at (0,0) to
(50,50)

General strategy is to create some rectangles describing what you want
to do, then blit (copy) from one surface to another.

// Rectangle describing top 50 pixels
SDL_Rect topleft50pixels {0, 0, 50, 50};

// Copy top 50 pixels from surface hugebmp to tmp
SDL_BlitSurface(hugebmp, &topleft50pixels, tmp, &topleft50pixels);

For more about smart blitting, have a look at W.Peter van Paasens
excellent “The Demo Effects Collection” found in the demo section on
libsdl.org: http://www.paassen.tmfweb.nl/retrodemo.html

DanFrom: line72@postmark.net (Mark D’voo)