00001 /* 00002 $Id: cliprect.h,v 1.1 2001/03/06 15:09:10 mbn Exp $ 00003 00004 ------------------------------------------------------------------------ 00005 ClanLib, the platform independent game SDK. 00006 00007 This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE 00008 version 2. See COPYING for details. 00009 00010 For a total list of contributers see CREDITS. 00011 00012 ------------------------------------------------------------------------ 00013 */ 00014 00016 00017 #ifndef header_cliprect 00018 #define header_cliprect 00019 00020 class CL_ClipRect 00021 //: Clipping rectangle class in ClanLib. 00022 // This class is used to define clipping regions when drawing graphics to the 00023 // backbufffer. This is useful if it is too expensive to update the entire 00024 // screen each time - instead you can define a limited area where everything 00025 // outside the rectangle should be discarded. 00026 // <br> 00027 // The clipping rectangle is used together with the clipping rect functions 00028 // in CL_Display and CL_DisplayCard. 00031 { 00032 public: 00033 int m_x1; 00034 //: Min x-coordinate of the rectangle. 00035 00036 int m_y1; 00037 //: Min y-coordinate of the rectangle. 00038 00039 int m_x2; 00040 //: Max x-coordinate of the rectangle - NOT included in clipping area 00041 00042 int m_y2; 00043 //: Max y-coordinate of the rectangle - NOT included in clipping area 00044 00045 CL_ClipRect(); 00046 //: Constructs an uninitialized clip rectangle. (x1, y1) and (x2, y2) 00047 //: contain random values, and should be manually initialized before 00048 //: usage of the clip rect. 00049 00050 CL_ClipRect(const CL_ClipRect &rect); 00051 //: Copy constructor. 00052 00053 CL_ClipRect(int x1, int y1, int x2, int y2); 00054 //: Constructs a clipping rectangle from (x1,y1) to (x2,y2). 00057 00058 bool test_clipped(const CL_ClipRect &rect) const; 00059 //: Tests if the specified rectangle needs to be clipped with this clip 00060 //: rect. 00063 00064 bool test_unclipped(const CL_ClipRect &rect) const; 00065 //: Tests whether the specified rectangle is entirely contained within 00066 //: this clip rect. 00069 00070 bool test_all_clipped(const CL_ClipRect &rect) const; 00071 //: Tests whether all of the specified rectangle is outside this rectangle. 00074 00075 CL_ClipRect clip(const CL_ClipRect &rect) const; 00076 //: Clips the given rectangle and returns the result. 00079 00080 bool operator == (const CL_ClipRect &rect) const; 00081 //: Standard C++ == operator. 00083 00084 // friend ostream& operator << (ostream &os, CL_ClipRect &rect); 00085 }; 00086 00087 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001