Question about surfaces with SDL_image

If I load an image using SDL_Image (or SDL SDL_LoadBMP() ), what kind of
surface de I get? I mean, is it a software surface or a hardaware one?

I suppose it?s a software surface. If I am right, how could I "convert"
it in a hardware surface?

Thanks in advance–

  Ricardo Amores Hern?ndez
ICQ: 19463735
MSN: zheo_ (at) hotmail (dot) es

See http://sdldoc.csn.ul.ie/sdlcreatergbsurface.phpOn Sunday 21 September 2003 12:39 pm, Ricardo Amores Hern?ndez wrote:

If I load an image using SDL_Image (or SDL SDL_LoadBMP() ), what kind of
surface de I get? I mean, is it a software surface or a hardaware one?

I suppose it?s a software surface. If I am right, how could I "convert"
it in a hardware surface?

Thanks in advance

Tyler Montbriand escribi?:

See http://sdldoc.csn.ul.ie/sdlcreatergbsurface.php

So I should assume that images are loaded into system memory, shouldn?t I?
I knew that I could create an empty hardware surface and blit the image
into it, but maybe there was a better way :)–

  Ricardo Amores Hern?ndez
ICQ: 19463735
MSN: zheo_ (at) hotmail (dot) es

So I should assume that images are loaded into system memory, shouldn?t I?
I knew that I could create an empty hardware surface and blit the image
into it, but maybe there was a better way :slight_smile:

If your display surface is a hardware surface (well, I assume it should be, you get no benefit on creating hardware surfaces if the display surface is software), you can use SDL_DisplayFormat to convert it to the same format. Note that it will change color depth to the same used on your display surface (which makes sense, as you want to accelerate blits from your surface to the display).

Only point is, not all video cards and OSs can give you access to hardware surfaces, so be careful about that. Better safe than sorry.

Paulo

El lun, 22-09-2003 a las 10:09, Ricardo Amores Hern?ndez escribi?:

Tyler Montbriand escribi?:

See http://sdldoc.csn.ul.ie/sdlcreatergbsurface.php

So I should assume that images are loaded into system memory, shouldn?t I?
I knew that I could create an empty hardware surface and blit the image
into it, but maybe there was a better way :slight_smile:

Ricardo, be aware of bliting to empty surfaces if you use an alpha
chanel. I’ve have this problem. My solution was to memcpy from one
surface to the other (again, be aware of the surface format).

Losky

Blitting into empty surfaces causes no problems if you do it the way SDL
wants. Unfortunately, the way SDL wants isn’t (to me, anyway) the most
obvious way. I posted some code a while ago that showed how to blit a surface
with an alpha channel into an empty surface (0,0,0,0), then blit that surface
to the screen, and have it work like you’d expect it to. I can re-post it if
you want.

-Sean RidenourOn Friday 10 October 2003 7:27 pm, Ochendrowitsch Pablo wrote:

El lun, 22-09-2003 a las 10:09, Ricardo Amores Hern?ndez escribi?:

Tyler Montbriand escribi?:

See http://sdldoc.csn.ul.ie/sdlcreatergbsurface.php

So I should assume that images are loaded into system memory, shouldn?t
I? I knew that I could create an empty hardware surface and blit the
image into it, but maybe there was a better way :slight_smile:

Ricardo, be aware of bliting to empty surfaces if you use an alpha
chanel. I’ve have this problem. My solution was to memcpy from one
surface to the other (again, be aware of the surface format).

Losky

Sean Ridenour wrote:

Blitting into empty surfaces causes no problems if you do it the way SDL
wants. Unfortunately, the way SDL wants isn’t (to me, anyway) the most
obvious way. I posted some code a while ago that showed how to blit a surface
with an alpha channel into an empty surface (0,0,0,0), then blit that surface
to the screen, and have it work like you’d expect it to. I can re-post it if
you want.

-Sean Ridenour

Actually, that method didn’t work in my program :confused: I’ve copied the
pygame functions instead.

Sebastian