Blender V2.61 - r43446

RAS_ICanvas.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
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 Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef __RAS_ICANVAS
00033 #define __RAS_ICANVAS
00034 
00035 #ifdef WITH_CXX_GUARDEDALLOC
00036 #include "MEM_guardedalloc.h"
00037 #endif
00038 
00039 class RAS_Rect;
00040 
00044 class RAS_ICanvas
00045 {
00046 public:
00047     enum BufferType {
00048         COLOR_BUFFER=1,
00049         DEPTH_BUFFER=2
00050     };
00051 
00052     enum RAS_MouseState
00053     {
00054         MOUSE_INVISIBLE=1,
00055         MOUSE_WAIT,
00056         MOUSE_NORMAL
00057     };
00058 
00059     virtual 
00060     ~RAS_ICanvas(
00061     ) {
00062     };
00063 
00064     virtual 
00065         void 
00066     Init(
00067     ) = 0;
00068 
00069     virtual 
00070         void 
00071     BeginFrame(
00072     )=0;
00073 
00074     virtual 
00075         void 
00076     EndFrame(
00077     )=0;
00078 
00088     virtual 
00089         bool 
00090     BeginDraw(
00091     )=0;
00092 
00097     virtual 
00098         void 
00099     EndDraw(
00100     )=0;
00101 
00102 
00104     virtual 
00105         void 
00106     SwapBuffers(
00107     )=0;
00108  
00109     virtual 
00110         void 
00111     ClearBuffer(
00112         int type
00113     )=0;
00114 
00115     virtual 
00116         void 
00117     ClearColor(
00118         float r,
00119         float g,
00120         float b,
00121         float a
00122     )=0;
00123 
00124     virtual 
00125         int  
00126     GetWidth(
00127     ) const = 0;
00128 
00129     virtual 
00130         int  
00131     GetHeight(
00132     ) const = 0;
00133 
00134     virtual
00135         int
00136     GetMouseX( int x
00137     )=0;
00138 
00139     virtual
00140         int
00141     GetMouseY( int y
00142     )= 0;
00143 
00144     virtual
00145         float
00146     GetMouseNormalizedX( int x
00147     )=0;
00148 
00149     virtual
00150         float
00151     GetMouseNormalizedY( int y
00152     )= 0;
00153 
00154     virtual 
00155         const RAS_Rect &
00156     GetDisplayArea(
00157     ) const = 0;
00158 
00159     virtual
00160         void
00161     SetDisplayArea(RAS_Rect *rect
00162     ) = 0;
00163 
00167     virtual
00168         RAS_Rect &
00169     GetWindowArea(
00170     ) = 0;
00171 
00176     virtual
00177         void
00178     SetViewPort(
00179         int x1, int y1,
00180         int x2, int y2
00181     ) = 0; 
00182 
00183     virtual 
00184         void 
00185     SetMouseState(
00186         RAS_MouseState mousestate
00187     )=0;
00188 
00189     virtual 
00190         void 
00191     SetMousePosition(
00192         int x,
00193         int y
00194     )=0;
00195 
00196     virtual
00197         RAS_MouseState
00198     GetMouseState()
00199     {
00200         return m_mousestate;
00201     }
00202 
00203     virtual 
00204         void 
00205     MakeScreenShot(
00206         const char* filename
00207     )=0;
00208     
00209 protected:
00210     RAS_MouseState m_mousestate;
00211     
00212 #ifdef WITH_CXX_GUARDEDALLOC
00213 public:
00214     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_ICanvas"); }
00215     void operator delete( void *mem ) { MEM_freeN(mem); }
00216 #endif
00217 };
00218 
00219 #endif //__RAS_ICANVAS
00220