diff --git a/include/ZE_ZImage.h b/include/ZE_ZImage.h index a5350e8..1f49fa4 100644 --- a/include/ZE_ZImage.h +++ b/include/ZE_ZImage.h @@ -13,7 +13,7 @@ File: ZE_ZImage.h
Description: Header file for core ZEngine Image and Texture Object.
Author(s): James Turk, Gamer Tazar
-$Id: ZE_ZImage.h,v 1.13 2003/02/10 04:40:16 cozman Exp $
+$Id: ZE_ZImage.h,v 1.14 2003/02/10 04:55:48 cozman Exp $
\file ZE_ZImage.h \brief Definition file for ZImage. @@ -94,7 +94,7 @@ class ZImage /*! \brief Constructor to Construct from part of an SDL_Surface*. - Constructor is same as calling ZImage::OpenFromImage. + Constructor is same as calling ZImage::OpenFromImage with an SDL_Surface*. \param img Image to take new image from. \param x X Coordinate in source of top left corner. @@ -104,6 +104,19 @@ class ZImage **/ ZImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h); + /*! + \brief Constructor to Construct from part of another ZImage. + + Constructor is same as calling ZImage::OpenFromImage with a ZImage. + + \param img Image to take new image from. + \param x X Coordinate in source of top left corner. + \param y Y Coordinate in source of top left corner. + \param w Width of new image. + \param h Height of new image. + **/ + ZImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h); + /*! \brief Destructor, frees memory. @@ -124,11 +137,11 @@ class ZImage void Open(string filename); /*! - \brief Cuts part of an existing image to create the new image. + \brief Cuts part of an existing image to create a new image. Cut part of an SDL_Surface to create a new Image. - \param img Image to take new image from. + \param img SDL_Surface* to take new image from. \param x X Coordinate in source of top left corner. \param y Y Coordinate in source of top left corner. \param w Width of new image. @@ -136,6 +149,19 @@ class ZImage **/ void OpenFromImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h); + /*! + \brief Cuts part of an existing ZImage to create a new image. + + Cut part of another ZImage to create a new Image. + + \param img ZImage to take new image from. + \param x X Coordinate in source of top left corner. + \param y Y Coordinate in source of top left corner. + \param w Width of new image. + \param h Height of new image. + **/ + void OpenFromImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h); + /*! \brief Attach an existing surface to class. diff --git a/src/ZE_ZImage.cpp b/src/ZE_ZImage.cpp index 9bc0aa5..223a9e6 100644 --- a/src/ZE_ZImage.cpp +++ b/src/ZE_ZImage.cpp @@ -13,7 +13,7 @@ File: ZE_ZImage.cpp
Description: Implementation source file for core ZEngine Image or Texture Object.
Author(s): James Turk, Gamer Tazar
-$Id: ZE_ZImage.cpp,v 1.24 2003/02/10 04:02:38 cozman Exp $
+$Id: ZE_ZImage.cpp,v 1.25 2003/02/10 04:55:48 cozman Exp $
\file ZE_ZImage.cpp \brief Source file for ZImage. @@ -66,6 +66,14 @@ ZImage::ZImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h) OpenFromImage(img,x,y,w,h); } +ZImage::ZImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h) +{ + rEngine = ZEngine::GetInstance(); + rImage = NULL; + rAlpha = 255; + OpenFromImage(img.Surface(),x,y,w,h); //call SDL_Surface* version instead of taking the long way +} + ZImage::~ZImage() { Release(); @@ -107,6 +115,11 @@ void ZImage::OpenFromImage(SDL_Surface *image, Sint16 x, Sint16 y, Sint16 w, Sin Attach(cutImg); } +void ZImage::OpenFromImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h) +{ + OpenFromImage(img.Surface(),x,y,w,h); +} + void ZImage::Attach(SDL_Surface *surface) { GLfloat coord[4];