GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SDLmm::Surface(3) FreeBSD Library Functions Manual SDLmm::Surface(3)

SDLmm::Surface - A graphical surface structure which is used to store graphical data.

#include <sdlmm_surface.h>

Inherits SDLmm::BaseSurface.


Surface (SDL_Surface *surface)
Constructor from an SDL_Surface*. Surface (const Surface &other)
Surface ()
Create an uninitialized surface. Surface& operator= (const Surface &other)
Implementation of operator=. Surface Duplicate () const
virtual bool SetDisplayFormat ()
Convert the surface to the display format. virtual bool SetDisplayFormatAlpha ()
Convert the surface to the display format.


Surface CreateSurface (const BaseSurface &other)
Surface CreateSurface (Uint32 flags, int w, int h, int d, Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, Uint32 Amask=0)
Allocate an empty RGB surface. Surface CreateSurface (void *pixels, int w, int h, int d, int p, Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, Uint32 Amask=0)
Create a new Surface from the provided pixel data. Surface LoadBMP (const char *file)
Loads a Windows BMP and returns it as a new Surface. Surface LoadBMP (const std::string &file)
Loads a Windows BMP and returns a new Surface.

A graphical surface structure which is used to store graphical data.

Surfaces represent areas of 'graphical' memory, memory that can be drawn to or blitted onto other Surfaces.

Todo:
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.

Author:
David Hedbor <david@hedbor.org>

Constructor from an SDL_Surface*.

This creates a new Surface 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.

Create an uninitialized surface.

Warning:
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.

Create a new Surface from the provided pixel data.

The data stored in pixels is assumed to be of the depth specified in the parameter d. The pixel data is not copied into the SDL_Surface structure me so it should no be freed until the Surface object has been destructed

Parameters:

flags
the type of surface that should be created which is OR'd combination of the values as described in the SDL documentation.
w, h
width and height of the surface to create.
d
color depth in bits per pixel to use for this surface. If zero, use the depth of the current display.
p
pitch the length (pitch) of each scanline in bytes.
RGBAmask
optional binary masks used to retrieve individual color values.

Allocate an empty RGB surface.

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

Parameters:

flags
the type of surface that should be created which is OR'd combination of the values as described in the SDL documentation.
w, h
width and height of the surface to create.
d
color depth in bits per pixel to use for this surface. If zero, use the depth of the current display.
RGBAmask
optional binary masks used to retrieve individual color values.

Loads a Windows BMP and returns a new Surface.

Parameters:

file
the file to attempt to load

Returns:
True if the loading succeeded, false otherwise.

Loads a Windows BMP and returns it as a new Surface.

If the image couldn't be loaded, the Surface will be invalid. You can check the success of the image loading using the Surface.valid() method like the example code below.

      SDLmm::Surface img(SDLmm::Surface::LoadBMP('myimage.bmp'));
      if(!img.valid()) {
        cerr << 'Loading of image myimage.bmp failed!0;
        exit(1);
      }

Parameters:

file
the file to attempt to load

Returns:
True if the loading succeeded, false otherwise.

Convert the surface to the display format.

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.

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.

Returns:
The functions returns true if the conversion succeeded or false otherwise. If the conversion failed, the BaseSurface object will not have changed.

Note:
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.

See also:
SetDisplayFormatAlpha(), SetAlpha(), SetColorKey()

Reimplemented from SDLmm::BaseSurface.

Convert the surface to the display format.

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.

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.

Returns:
The functions returns true if the conversion succeeded or false otherwise. If the conversion failed, the BaseSurface object will not have changed.

Note:
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.

See also:
SetDisplayFormat(), SetAlpha(), SetColorKey()

Reimplemented from SDLmm::BaseSurface.

Implementation of operator=.

Generated automatically by Doxygen for SDLmm from the source code.
16 Jul 2001 SDLmm

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.