Yukino::Surface Class Reference

Class to store an image. More...

#include <Surface.h>

Inheritance diagram for Yukino::Surface:

Yukino::Sprite List of all members.

Public Member Functions

 Surface ()
 Constructor of the Surface class.
 Surface (int w, int h, int bpp)
 Constructor of the Surface class.
 Surface (const string &file)
 Constructor of the Surface class.
 Surface (const char *file)
 Constructor of the Surface class.
 Surface (SDL_Surface *surface)
 Constructor of the Surface class.
 Surface (const Surface &obj)
 Copy constructor of the Surface class.
virtual Surfaceoperator= (Surface &obj)
 Operator = of the Surface class.
 ~Surface ()
 Destructor of the Surface class.
UINT Create (int w, int h, int bpp)
 Function to create an image in target in the Surface.
UINT SetColorKey (Uint32 color=COLOR_PINK)
 Function to put a color of transparency to the image.
UINT Transform (void)
 Function to transform the format of the image to the one of the screen.
UINT Fill (Uint32 color, Rect *rect=NULL)
 Function to fill up with a color a region of the image.
virtual UINT Load (const char *file)
 Function to load a Surface from a file.
virtual UINT Load (const string &file)
 Function to load a Surface from a file.
virtual UINT Save (const char *file)
 Function to save a Surface in a file BMP.
virtual UINT Save (const string &file)
 Function to save a Surface in a file BMP.
virtual void Free (void)
 Function to release the data of the Surface object.
UINT Copy (const Surface &objsrc, Rect *dst=NULL, Rect *src=NULL)
 Function to put in the image a region of a Surface.
UINT Copy (const Surface &objsrc, int x, int y, Rect *src=NULL)
 Function to put in the image a region of a Surface.
UINT Paste (Surface &objdst, Rect *dst=NULL, Rect *src=NULL) const
 Function to copy a region of the image in a Surface.
UINT Paste (Surface &objdst, int x, int y, Rect *src=NULL) const
 Function to copy a region of the image in a Surface.
UINT Copy (SDL_Surface *srfsrc, Rect *dst=NULL, Rect *src=NULL)
 Function to put in the image a region of a SDL_Surface.
UINT Copy (SDL_Surface *srfsrc, int x, int y, Rect *src=NULL)
 Function to put in the image a region of a SDL_Surface.
UINT Paste (SDL_Surface *srfdst, Rect *dst=NULL, Rect *src=NULL) const
 Function to copy a region of the image in a SDL_Surface.
UINT Paste (SDL_Surface *srfdst, int x, int y, Rect *src=NULL) const
 Function to copy a region of the image in a SDL_Surface.

Detailed Description

Class to store an image.

The Surface class serves to store in memory an image contained in a file BMP, PNG, TGA, JPG, PCX, GIF, TIF, PNM, XPM, XCF or LBM. Once stored we can handle it to copy regions from a Surface to another one. And to add some effects.


Constructor & Destructor Documentation

Yukino::Surface::Surface (  ) 

Constructor of the Surface class.

Constructor by defect of the Surface class.

See also:
operator=(), ~Surface().

Yukino::Surface::Surface ( int  w,
int  h,
int  bpp 
)

Constructor of the Surface class.

Constructor of the Surface class, that creates a blank image.

Parameters:
w Width of the image.
h Height of the image.
bpp Depth of color of the image.
See also:
operator=(), ~Surface().

Yukino::Surface::Surface ( const string &  file  ) 

Constructor of the Surface class.

Constructor of the Surface class, that loads a file.

Parameters:
file Path of the file.
See also:
operator=(), ~Surface().

Yukino::Surface::Surface ( const char *  file  ) 

Constructor of the Surface class.

Constructor of the Surface class, that loads a file.

Parameters:
file Path of the file.
See also:
operator=(), ~Surface().

Yukino::Surface::Surface ( SDL_Surface *  surface  ) 

Constructor of the Surface class.

Constructor of the Surface class, that receives an image.

Parameters:
surface The image.
See also:
operator=(), ~Surface().

Yukino::Surface::Surface ( const Surface obj  ) 

Copy constructor of the Surface class.

Parameters:
obj Surface object to copy.
See also:
operator=(), ~Surface().

Yukino::Surface::~Surface (  ) 

Destructor of the Surface class.

See also:
Surface(), operator=().


Member Function Documentation

UINT Yukino::Surface::Copy ( SDL_Surface *  srfsrc,
int  x,
int  y,
Rect src = NULL 
)

Function to put in the image a region of a SDL_Surface.

This function serves to put a region determined of an image origin, in a coordinates of the image.

Parameters:
srfsrc Source image.
x Coordinate x.
y Coordinate y.
src Source area.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_COPY.

UINT Yukino::Surface::Copy ( SDL_Surface *  srfsrc,
Rect dst = NULL,
Rect src = NULL 
)

Function to put in the image a region of a SDL_Surface.

This function serves to put a region determined of an image origin, in a region also determined of the image.

Parameters:
srfsrc Source image.
dst Destination area.
src Source area.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_COPY.

UINT Yukino::Surface::Copy ( const Surface objsrc,
int  x,
int  y,
Rect src = NULL 
)

Function to put in the image a region of a Surface.

This function serves to put a region determined of an image origin, in a coordinates of the image.

Parameters:
objsrc Source image.
x Coordinate x.
y Coordinate y.
src Source area.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_COPY.

UINT Yukino::Surface::Copy ( const Surface objsrc,
Rect dst = NULL,
Rect src = NULL 
)

Function to put in the image a region of a Surface.

This function serves to put a region determined of an image origin, in a region also determined of the image.

Parameters:
objsrc Source image.
dst Destination area.
src Source area.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_COPY.

UINT Yukino::Surface::Create ( int  w,
int  h,
int  bpp 
)

Function to create an image in target in the Surface.

This function serves to create a blank image in the Surface.

Parameters:
w Width of the image.
h Height of the image.
bpp Depth of color of the image.
See also:
Load(), Save(), Free().
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_CREATESURF.

UINT Yukino::Surface::Fill ( Uint32  color,
Rect rect = NULL 
)

Function to fill up with a color a region of the image.

This function serves to fill up a region of the image, with a color.

Parameters:
color Fill color.
rect Destination area to fill.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_FILLRECT.

void Yukino::Surface::Free ( void   )  [virtual]

Function to release the data of the Surface object.

This function serves to release the content of the Surface object.

See also:
Create(), Load(), Save().

Reimplemented in Yukino::Sprite.

virtual UINT Yukino::Surface::Load ( const string &  file  )  [inline, virtual]

Function to load a Surface from a file.

This function serves to load a Surface from a file.

Parameters:
file Path of the file.
See also:
Create(), Save(), Free().
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_RWFROMFILE, SURFACE_ERROR_UNKOWNFORMAT, SURFACE_ERROR_LOADINGFILE.

Reimplemented in Yukino::Sprite.

UINT Yukino::Surface::Load ( const char *  file  )  [virtual]

Function to load a Surface from a file.

This function serves to load a Surface from a file.

Parameters:
file Path of the file.
See also:
Create(), Save(), Free().
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_RWFROMFILE, SURFACE_ERROR_UNKOWNFORMAT, SURFACE_ERROR_LOADINGFILE.

Reimplemented in Yukino::Sprite.

Surface & Yukino::Surface::operator= ( Surface obj  )  [virtual]

Operator = of the Surface class.

The obj object is copied in the actual object, and this is given back.

See also:
Surface(), ~Surface().

UINT Yukino::Surface::Paste ( SDL_Surface *  srfdst,
int  x,
int  y,
Rect src = NULL 
) const

Function to copy a region of the image in a SDL_Surface.

This function serves to copy a determined area of the image, in a coordinates of a destination image.

Parameters:
srfdst Destination image.
x Coordinate x.
y Coordinate y.
src Source area.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_PASTE.

UINT Yukino::Surface::Paste ( SDL_Surface *  srfdst,
Rect dst = NULL,
Rect src = NULL 
) const

Function to copy a region of the image in a SDL_Surface.

This function serves to copy a determined area of the image, in a region also determined of a destination image.

Parameters:
srfdst Destination image.
dst Destination area.
src Source area.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_PASTE.

UINT Yukino::Surface::Paste ( Surface objdst,
int  x,
int  y,
Rect src = NULL 
) const

Function to copy a region of the image in a Surface.

This function serves to copy a determined area of the image, in a coordinates of a destination image.

Parameters:
objdst Destination image.
x Coordinate x.
y Coordinate y.
src Source area.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_PASTE.

UINT Yukino::Surface::Paste ( Surface objdst,
Rect dst = NULL,
Rect src = NULL 
) const

Function to copy a region of the image in a Surface.

This function serves to copy a determined area of the image, in a region also determined of a destination image.

Parameters:
objdst Destination image.
dst Destination area.
src Source area.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_PASTE.

virtual UINT Yukino::Surface::Save ( const string &  file  )  [inline, virtual]

Function to save a Surface in a file BMP.

This function serves to save the Surface in a file BMP.

Parameters:
file Path of the file.
See also:
Create(), Load(), Free().
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_SAVINGFILE.

UINT Yukino::Surface::Save ( const char *  file  )  [virtual]

Function to save a Surface in a file BMP.

This function serves to save the Surface in a file BMP.

Parameters:
file Path of the file.
See also:
Create(), Load(), Free().
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_SAVINGFILE.

UINT Yukino::Surface::SetColorKey ( Uint32  color = COLOR_PINK  ) 

Function to put a color of transparency to the image.

This function serves so that the image can have transparency.

Parameters:
color Key color.
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_SETCOLORKEY.

UINT Yukino::Surface::Transform ( void   ) 

Function to transform the format of the image to the one of the screen.

This function serves to transform the format of the stored image into the Surface, to the same format that has the screen buffer.

Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_DISPLAYFORMAT.


The documentation for this class was generated from the following files:
Generated on Sun Jun 25 03:43:36 2006 for Yukino by  doxygen 1.4.7