Planeshift
|
00001 /* 00002 * pawsimagedrawable.h 00003 * 00004 * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 00020 #ifndef PAWS_IMAGE_DRAWABLE 00021 #define PAWS_IMAGE_DRAWABLE 00022 00023 #include "pawstexturemanager.h" 00024 00029 class pawsImageDrawable : public scfImplementation1<pawsImageDrawable, iPawsImage> 00030 { 00031 private: 00033 csString imageFileLocation; 00034 00036 csString resourceName; 00037 00038 csRef<iTextureHandle> textureHandle; 00039 csRect textureRectangle; 00040 00041 int width; 00042 int height; 00043 00045 int defaultAlphaValue; 00046 00048 int defaultTransparentColourRed; 00049 int defaultTransparentColourGreen; 00050 int defaultTransparentColourBlue; 00051 00052 bool tiled; 00053 bool debugImageErrors; 00054 bool isLoaded; 00055 00061 csRef<iImage> image; 00062 00063 bool PreparePixmap(); 00064 00065 public: 00066 pawsImageDrawable(iDocumentNode* node); 00067 pawsImageDrawable(const char* file, const char* resource, bool tiled, const csRect &textureRect, int alpha, int transR, int transG, int transB); 00068 pawsImageDrawable(const char* file, const char* resource); 00069 00070 virtual ~pawsImageDrawable(); 00071 00072 const char* GetName() const; 00073 00074 void Draw(int x, int y, int alpha=-1); 00075 void Draw(csRect rect, int alpha=-1); 00076 void Draw(int x, int y, int newWidth, int newHeight, int alpha=-1); 00077 00078 int GetWidth() const; 00079 int GetHeight() const; 00080 void ExpandClipRect(csRect & /*clipRect*/) {}; 00081 00082 int GetDefaultAlpha() const; 00083 00084 bool IsLoaded() const; 00085 iImage* GetImage(); 00086 int GetTransparentRed() const; 00087 int GetTransparentGreen() const; 00088 int GetTransparentBlue() const; 00089 }; 00090 00093 #endif // PAWS_IMAGE_DRAWABLE