Added OpenFromImage for ZImage<-->ZImage drawing.
This commit is contained in:
parent
4a9e49fba0
commit
dee427ac89
@ -13,7 +13,7 @@
|
||||
File: ZE_ZImage.h <br>
|
||||
Description: Header file for core ZEngine Image and Texture Object. <br>
|
||||
Author(s): James Turk, Gamer Tazar <br>
|
||||
$Id: ZE_ZImage.h,v 1.13 2003/02/10 04:40:16 cozman Exp $<br>
|
||||
$Id: ZE_ZImage.h,v 1.14 2003/02/10 04:55:48 cozman Exp $<br>
|
||||
|
||||
\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.
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
File: ZE_ZImage.cpp <br>
|
||||
Description: Implementation source file for core ZEngine Image or Texture Object. <br>
|
||||
Author(s): James Turk, Gamer Tazar <br>
|
||||
$Id: ZE_ZImage.cpp,v 1.24 2003/02/10 04:02:38 cozman Exp $<br>
|
||||
$Id: ZE_ZImage.cpp,v 1.25 2003/02/10 04:55:48 cozman Exp $<br>
|
||||
|
||||
\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];
|
||||
|
Loading…
Reference in New Issue
Block a user