Planeshift
pawsimagedrawable.h
Go to the documentation of this file.
1 /*
2 * pawsimagedrawable.h
3 *
4 * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5 *
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation (version 2 of the License)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 */
19 
20 #ifndef PAWS_IMAGE_DRAWABLE
21 #define PAWS_IMAGE_DRAWABLE
22 
23 #include "pawstexturemanager.h"
24 
29 class pawsImageDrawable : public scfImplementation1<pawsImageDrawable, iPawsImage>
30 {
31 private:
33  csString imageFileLocation;
34 
36  csString resourceName;
37 
38  csRef<iTextureHandle> textureHandle;
39  csRect textureRectangle;
40 
41  int width;
42  int height;
43 
45  int defaultAlphaValue;
46 
48  int defaultTransparentColourRed;
49  int defaultTransparentColourGreen;
50  int defaultTransparentColourBlue;
51 
52  bool tiled;
53  bool debugImageErrors;
54  bool isLoaded;
55 
61  csRef<iImage> image;
62 
63  bool PreparePixmap();
64 
65 public:
66  pawsImageDrawable(iDocumentNode* node);
67  pawsImageDrawable(const char* file, const char* resource, bool tiled, const csRect &textureRect, int alpha, int transR, int transG, int transB);
68  pawsImageDrawable(const char* file, const char* resource);
69 
70  virtual ~pawsImageDrawable();
71 
72  const char* GetName() const;
73 
74  void Draw(int x, int y, int alpha=-1);
75  void Draw(csRect rect, int alpha=-1);
76  void Draw(int x, int y, int newWidth, int newHeight, int alpha=-1);
77 
78  int GetWidth() const;
79  int GetHeight() const;
80  void ExpandClipRect(csRect & /*clipRect*/) {};
81 
82  int GetDefaultAlpha() const;
83 
84  bool IsLoaded() const;
85  iImage* GetImage();
86  int GetTransparentRed() const;
87  int GetTransparentGreen() const;
88  int GetTransparentBlue() const;
89 };
90 
93 #endif // PAWS_IMAGE_DRAWABLE
iImage * GetImage()
const char * GetName() const
pawsImageDrawable(iDocumentNode *node)
int GetTransparentBlue() const
int GetTransparentRed() const
void Draw(int x, int y, int alpha=-1)
int GetTransparentGreen() const
int GetDefaultAlpha() const
void ExpandClipRect(csRect &)
bool IsLoaded() const
virtual ~pawsImageDrawable()
int GetWidth() const
int GetHeight() const