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

Chris Dickinson chrisad2 at highstream.net
Thu Sep 15 14:14:36 PDT 2005


Christian Walther <cwalther <at> gmx.ch> writes:

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


I apologize for referring to the SDL_Surface structure as an SDL_Rect - I was 
referring to the width and height fields of an SDL_Surface throughout my 
posting.  I do know that when I load a bitmap using IMG_Load, the values in 
the resulting surface's width and height fields are equal to zero (unless I am 
not accessing them correctly).  I will try using IMG_Load_RW and see if this 
still is a problem.  Thanks for the idea.

Chris Dickinson





More information about the SDL mailing list