[SDL] Re: SDL_Surface->w and ->h fields not getting bitmap width and height in v1.2.8

Christian Walther cwalther at gmx.ch
Thu Sep 15 12:13:32 PDT 2005


Chris Dickinson wrote:
> Hello,
>   I have a question regarding getting the width and height of a bitmap that 
> has been loaded onto an SDL_Surface using IMG_Load in version 1.2.8.  Are the 
> width and height of the bitmap stored in the Rect's ->w and ->h variables?  I 
> have tried inspecting surfaces onto which bitmaps have been loaded, and the 
> Rect's w and h values are returned as zero (this bug is also mentioned as a 
> comment in the description of the SDL_Rect structure in the SDL doc wiki).  

I'm not sure what "Rect" you are talking about, but when I do

   surf = IMG_Load_RW(rw, 1);

then surf->w and surf->h do contain the image's dimensions afterwards, 
and I suppose it's the same with IMG_Load(). This is with SDL 1.2.8 and 
SDL_image 1.2.4 on Mac OS X, Linux, and Windows.

That comment on the SDL_Surface wiki page doesn't make much sense to me 
- SDL_Surface doesn't even have x and y fields.

Can you show us a complete test program that exhibits the behavior you 
describe?

  -Christian





More information about the SDL mailing list