Preparing a surface

I was just wondering how I can go about initiallizing a surface with
certain set properties (such as res., bpp, default fill color). The
surface is not to be init’d in a window or loaded from a file.

I want to use this to create a background (actually, layers or bkgs) for
scrolling.

I thought I could use SDL_CreateRGBSurface(), but, if so, obviously I’m
using it wrong. If this is the function you use, how do you use
it? (Specifically, what are you telling it by passing the RGB and A mask
values… I thought this was a default fill color…)

Thx.–
Sam Hart http://www.physics.arizona.edu/~hart/
Web Page Highlights: Video Game History, Black Hole Simulation, & more.
OTHER WEB SITES MAINTAINED BY SAM HART
http://www.geekcomix.com/ - Geekcomix, the Daily Geek Comic Strip Site
http://www.physics.arizona.edu/~hart/gw/ - Ghostworks (Alt./Linux Computing)

I thought I could use SDL_CreateRGBSurface(), but, if so, obviously I’m
using it wrong. If this is the function you use, how do you use
it? (Specifically, what are you telling it by passing the RGB and A mask
values… I thought this was a default fill color…)
That is the right function. The Bitmasks tell SDL which bits in each
pixel represent which color components. This is used mostly for 16bpp
displays where the mode may be 565, 555A, or some other variation.
Normally you just stick the screen’s bitmasks back into these arguments
and everything works out OK. AFAIK SDL initializes surfaces to black.–
Stuart Anderson – echelon fodder follows
nuclear iraq bioweapon encryption cocaine korea terrorist NRA assassin
sarin

I was just wondering how I can go about initiallizing a surface with
certain set properties (such as res., bpp, default fill color). The
surface is not to be init’d in a window or loaded from a file.

I want to use this to create a background (actually, layers or bkgs) for
scrolling.

I thought I could use SDL_CreateRGBSurface(), but, if so, obviously I’m
using it wrong. If this is the function you use, how do you use
it? (Specifically, what are you telling it by passing the RGB and A mask
values… I thought this was a default fill color…)
To create a surface with the same properties as the screen do:

SDL_Surface *new;

new=SDL_CreateRGBSurface(0, width, height, screen->format->BitsPerPixel,
screen->format->Rmask, screen->format->Gmask, screen->format->Bmask,
screen->format->Amask);

or messier

SDL_Surface *temp, *new;
temp=SDL_CreateRGBSurface(0, width, height, 32, 0, 0, 0, 0);
new=SDL_ConvertSurface(temp, screen->format, 0);
SDL_FreeSurface(temp);

Long live the confused,
Akawaka.On Sat, 22 Apr 2000, Sam Hart wrote:

Bother! said Pooh, as he deleted C:\WINDOWS.