.TH "SDLmm::Surface" 3 "16 Jul 2001" "SDLmm" \" -*- nroff -*- .ad l .nh .SH NAME SDLmm::Surface \- A graphical surface structure which is used to store graphical data. .SH SYNOPSIS .br .PP \fC#include \fP .PP Inherits \fBSDLmm::BaseSurface\fP. .PP .SS "Public Methods" .in +1c .ti -1c .RI "\fBSurface\fP (SDL_Surface *surface)" .br .RI "\fIConstructor from an SDL_Surface*.\fP" .ti -1c .RI "\fBSurface\fP (const Surface &other)" .br .ti -1c .RI "\fBSurface\fP ()" .br .RI "\fICreate an uninitialized surface.\fP" .ti -1c .RI "Surface& \fBoperator=\fP (const Surface &other)" .br .RI "\fIImplementation of operator=.\fP" .ti -1c .RI "Surface \fBDuplicate\fP () const" .br .ti -1c .RI "virtual bool \fBSetDisplayFormat\fP ()" .br .RI "\fIConvert the surface to the display format.\fP" .ti -1c .RI "virtual bool \fBSetDisplayFormatAlpha\fP ()" .br .RI "\fIConvert the surface to the display format.\fP" .in -1c .SS "Static Public Methods" .in +1c .ti -1c .RI "Surface \fBCreateSurface\fP (const \fBBaseSurface\fP &other)" .br .ti -1c .RI "Surface \fBCreateSurface\fP (Uint32 flags, int w, int h, int d, Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, Uint32 Amask=0)" .br .RI "\fIAllocate an empty RGB surface.\fP" .ti -1c .RI "Surface \fBCreateSurface\fP (void *pixels, int w, int h, int d, int p, Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, Uint32 Amask=0)" .br .RI "\fICreate a new \fBSurface\fP from the provided pixel data.\fP" .ti -1c .RI "Surface \fBLoadBMP\fP (const char *file)" .br .RI "\fILoads a Windows BMP and returns it as a new \fBSurface\fP.\fP" .ti -1c .RI "Surface \fBLoadBMP\fP (const std::string &file)" .br .RI "\fILoads a Windows BMP and returns a new \fBSurface\fP.\fP" .in -1c .SH "DETAILED DESCRIPTION" .PP A graphical surface structure which is used to store graphical data. .PP Surfaces represent areas of 'graphical' memory, memory that can be drawn to or blitted onto other Surfaces. .PP \fB\fBTodo: \fP\fP .in +1c Implement a better constructor scheme, where the first argument is a dummy class which specified what to do. This would allow a construct where a surface can be loaded from an image file without first having to create an unitialized object. .PP \fBAuthor: \fP .in +1c David Hedbor .PP .SH "CONSTRUCTOR & DESTRUCTOR DOCUMENTATION" .PP .SS "SDLmm::Surface::Surface (SDL_Surface * surface)\fC [inline, explicit]\fP" .PP Constructor from an SDL_Surface*. .PP This creates a new \fBSurface\fP object from an existing SDL_Surface. It's very important not to free the original surface since that will cause a problem when the object is destructed (SDL_Surface storage freed twice). Use with caution. .SS "SDLmm::Surface::Surface (const Surface & other)\fC [inline]\fP" .PP .SS "SDLmm::Surface::Surface ()\fC [inline]\fP" .PP Create an uninitialized surface. .PP \fBWarning: \fP .in +1c Trying to use an uninitialized surface will result in crashes. Most functions to not have any checks to see whether the surface is initialized or not. .SH "MEMBER FUNCTION DOCUMENTATION" .PP .SS "Surface SDLmm::Surface::CreateSurface (void * pixels, int w, int h, int d, int p, Uint32 Rmask = 0, Uint32 Gmask = 0, Uint32 Bmask = 0, Uint32 Amask = 0)\fC [inline, static]\fP" .PP Create a new \fBSurface\fP from the provided pixel data. .PP The data stored in \fIpixels\fP is assumed to be of the depth specified in the parameter \fId\fP. The pixel data is not copied into the SDL_Surface structure \fI\fBme\fP\fP so it should no be freed until the \fBSurface\fP object has been destructed .PP \fBParameters: \fP .in +1c .TP \fB\fIflags\fP\fP the type of surface that should be created which is OR'd combination of the values as described in the SDL documentation. .TP \fB\fIw, h\fP\fP width and height of the surface to create. .TP \fB\fId\fP\fP color depth in bits per pixel to use for this surface. If zero, use the depth of the current display. .TP \fB\fIp\fP\fP pitch the length (pitch) of each scanline in bytes. .TP \fB\fIRGBAmask\fP\fP optional binary masks used to retrieve individual color values. .SS "Surface SDLmm::Surface::CreateSurface (Uint32 flags, int w, int h, int d, Uint32 Rmask = 0, Uint32 Gmask = 0, Uint32 Bmask = 0, Uint32 Amask = 0)\fC [inline, static]\fP" .PP Allocate an empty RGB surface. .PP If depth is 8 bits an empty palette is allocated for the surface, otherwise a 'packed-pixel' SDL_PixelFormat is created using the [RGBA]mask's provided. The flags specifies .PP \fBParameters: \fP .in +1c .TP \fB\fIflags\fP\fP the type of surface that should be created which is OR'd combination of the values as described in the SDL documentation. .TP \fB\fIw, h\fP\fP width and height of the surface to create. .TP \fB\fId\fP\fP color depth in bits per pixel to use for this surface. If zero, use the depth of the current display. .TP \fB\fIRGBAmask\fP\fP optional binary masks used to retrieve individual color values. .SS "Surface SDLmm::Surface::CreateSurface (const \fBBaseSurface\fP & other)\fC [inline, static]\fP" .PP .SS "Surface SDLmm::Surface::Duplicate () const\fC [inline]\fP" .PP .SS "Surface SDLmm::Surface::LoadBMP (const std::string & file)\fC [inline, static]\fP" .PP Loads a Windows BMP and returns a new \fBSurface\fP. .PP \fBParameters: \fP .in +1c .TP \fB\fIfile\fP\fP the file to attempt to load .PP \fBReturns: \fP .in +1c True if the loading succeeded, false otherwise. .SS "Surface SDLmm::Surface::LoadBMP (const char * file)\fC [inline, static]\fP" .PP Loads a Windows BMP and returns it as a new \fBSurface\fP. .PP If the image couldn't be loaded, the \fBSurface\fP will be invalid. You can check the success of the image loading using the Surface.valid() method like the example code below. .PP .nf SDLmm::Surface img(SDLmm::Surface::LoadBMP('myimage.bmp')); if(!img.valid()) { cerr << 'Loading of image myimage.bmp failed!\n'; exit(1); } .fi .PP \fBParameters: \fP .in +1c .TP \fB\fIfile\fP\fP the file to attempt to load .PP \fBReturns: \fP .in +1c True if the loading succeeded, false otherwise. .SS "bool SDLmm::Surface::SetDisplayFormat ()\fC [virtual]\fP" .PP Convert the surface to the display format. .PP This function converts the surface to the pixel format and colors of the video framebuffer, making it suitable for fast blitting onto the display surface. .PP If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling this function. .PP \fBReturns: \fP .in +1c The functions returns true if the conversion succeeded or false otherwise. If the conversion failed, the \fBBaseSurface\fP object will not have changed. .PP \fBNote: \fP .in +1c Please note that this function doesn't return a new, modified object like the SDL_DisplayFormat() function does. Thus there is no need to manually free the old surface. .PP \fBSee also: \fP .in +1c \fBSetDisplayFormatAlpha\fP(), \fBSetAlpha\fP(), \fBSetColorKey\fP() .PP Reimplemented from \fBSDLmm::BaseSurface\fP. .SS "bool SDLmm::Surface::SetDisplayFormatAlpha ()\fC [virtual]\fP" .PP Convert the surface to the display format. .PP This function converts the surface to the pixel format and colors of the video framebuffer plus an alpha channel, making it suitable for fast blitting onto the display surface. .PP If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling this function. .PP \fBReturns: \fP .in +1c The functions returns true if the conversion succeeded or false otherwise. If the conversion failed, the \fBBaseSurface\fP object will not have changed. .PP \fBNote: \fP .in +1c Please note that this function doesn't return a new, modified object like the SDL_DisplayFormatAlpha() function does. Thus there is no need to manually free the old surface. .PP \fBSee also: \fP .in +1c \fBSetDisplayFormat\fP(), \fBSetAlpha\fP(), \fBSetColorKey\fP() .PP Reimplemented from \fBSDLmm::BaseSurface\fP. .SS "Surface & SDLmm::Surface::operator= (const Surface & other)\fC [inline]\fP" .PP Implementation of operator=. .PP .SH "AUTHOR" .PP Generated automatically by Doxygen for SDLmm from the source code.