00001 /*--License: 00002 Kyra Sprite Engine 00003 Copyright Lee Thomason (Grinning Lizard Software) 2001-2005 00004 www.grinninglizard.com/kyra 00005 www.sourceforge.net/projects/kyra 00006 00007 Kyra is provided under the LGPL. 00008 00009 I kindly request you display a splash screen (provided in the HTML documentation) 00010 to promote Kyra and acknowledge the software and everyone who has contributed to it, 00011 but it is not required by the license. 00012 00013 --- LGPL License -- 00014 00015 This library is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU Lesser General Public 00017 License as published by the Free Software Foundation; either 00018 version 2.1 of the License, or (at your option) any later version. 00019 00020 This library is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00023 Lesser General Public License for more details. 00024 00025 You should have received a copy of the GNU Lesser General Public 00026 License along with this library; if not, write to the Free Software 00027 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00028 00029 The full text of the license can be found in lgpl.txt 00030 */ 00031 00032 #ifndef KYRA_IMAGE_INCLUDED 00033 #define KYRA_IMAGE_INCLUDED 00034 00035 #include "imnode.h" 00036 00037 struct KrPaintInfo; 00038 class KrResource; 00039 00040 #ifdef _MSC_VER 00041 // Disables warning about using a this pointer in a constructor initialization list. 00042 #pragma warning ( disable : 4355 ) 00043 #endif 00044 00048 class KrImage : public KrImNode 00049 { 00050 public: 00051 KrImage(); 00052 virtual ~KrImage() {} 00053 00054 /* Draw to a surface 00055 @param surface Target surface. 00056 @param paintInfo Drawing information. 00057 @param clip Cliping rectangle for the surface. 00058 */ 00059 virtual void Draw( KrPaintInfo* paintInfo, const grinliz::Rectangle2I& clip, int window ) = 0; 00060 00070 virtual void QueryBoundingBox( grinliz::Rectangle2I* boundingBox, int window ) = 0; 00071 00122 bool CheckCollision( KrImage* other, int window = 0 ); 00123 00124 virtual KrResource* Resource() = 0; 00125 00126 // -- Internal: -- // 00127 virtual KrImage* ToImage() { return this; } 00128 00129 virtual void FlushInvalid( int window, bool cache ); 00130 virtual void CalcTransform( int window ) = 0; 00131 00132 virtual void AddedtoTree(); 00133 virtual void LeavingTree(); 00134 00135 protected: 00136 // Was the image visibile (IsVisible) at the last draw? 00137 // Used for dirty rectangle management. 00138 bool wasVisibleAtLastFlush[ KR_MAX_WINDOWS ]; 00139 // KrRect cacheRect[ KR_MAX_WINDOWS ]; 00140 // bool haveCacheRect[ KR_MAX_WINDOWS ]; 00141 }; 00142 00143 00144 #endif