00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00020 #ifndef __ze_zimage_h__
00021 #define __ze_zimage_h__
00022
00023 #include "ZE_ZEngine.h"
00024 #include "ZE_ZRect.h"
00025
00026 namespace ZE
00027 {
00028
00034 class ZImage
00035 {
00036 protected:
00038 ZEngine* rEngine;
00040 SDL_Surface *rImage;
00042 Uint8 rAlpha;
00043 #if (GFX_BACKEND == ZE_OGL)
00044
00045 GLfloat rTexMinX;
00047 GLfloat rTexMinY;
00049 GLfloat rTexMaxX;
00051 GLfloat rTexMaxY;
00053 unsigned int rTexID;
00055 GLfloat rWidth;
00057 GLfloat rHeight;
00058 #endif //GFX_BACKEND == OGL
00059
00060 public:
00061
00067 ZImage();
00068
00075 ZImage(const ZImage &rhs);
00076
00083 ZImage(std::string filename);
00084
00091 ZImage(SDL_Surface *surface);
00092
00104 ZImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
00105
00117 ZImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
00118
00124 virtual ~ZImage();
00125
00127
00129
00136 void Open(std::string filename);
00137
00145 void OpenFromZip(std::string zipname, std::string filename);
00146
00158 void OpenFromImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
00159
00171 void OpenFromImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
00172
00179 void Attach(SDL_Surface *surface);
00180
00186 void Reload();
00187
00193 void Release();
00194
00196
00198
00206 void SetAlpha(Uint8 alpha);
00207
00216 void SetColorKey(Uint8 red, Uint8 green, Uint8 blue);
00217
00225 void Draw(int x, int y) const;
00226
00238 void DrawClipped(int x, int y, ZRect clipRect) const;
00239
00240 #if (GFX_BACKEND == ZE_OGL)
00241
00249 void Draw(float x, float y) const;
00250
00262 void Draw(float x, float y, Uint8 vc[]) const;
00263
00272 void DrawRotated(int x, int y, float angle) const;
00273
00283 void DrawRotated(float x, float y, float angle) const;
00284
00297 void DrawRotated(float x, float y, float angle, Uint8 vc[]) const;
00298
00310 void DrawClipped(float x, float y, ZRect clipRect) const;
00311
00326 void DrawClipped(float x, float y, ZRect clipRect, Uint8 vc[]) const;
00327
00335 void Flip(bool horizontal, bool vertical);
00336
00344 void Stretch(float xFactor, float yFactor);
00345
00353 void Resize(float width, float height);
00354
00361 void Bind() const;
00362 #endif //GFX_BACKEND == OGL
00363
00365
00367
00374 bool IsLoaded() const;
00375
00381 SDL_Surface *Surface() const;
00382
00383 #if (GFX_BACKEND == ZE_OGL)
00384
00391 float Width() const;
00392
00399 float Height() const;
00400
00401 #elif (GFX_BACKEND == ZE_SDL)
00402
00408 int Width() const;
00409
00416 int Height() const;
00417 #endif //GFX_BACKEND
00418
00426 Uint8 Alpha() const;
00427 };
00428
00429 }
00430
00431 #endif