csws/csgfxppl.h
Go to the documentation of this file.00001 /* 00002 Crystal Space Windowing System: Graphics Pipeline class 00003 Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the 9License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_CSGFXPPL_H__ 00021 #define __CS_CSGFXPPL_H__ 00022 00031 #include "csgeom/csrect.h" 00032 #include "cstool/cspixmap.h" 00033 #include "ivideo/graph2d.h" 00034 00035 class csMouse; 00036 struct iGraphics2D; 00037 struct iObjectRegistry; 00038 00040 #define MAX_CSWS_PIPELINE_LENGTH 16384 00041 00042 #define MAX_SYNC_PAGES 8 00043 00071 class csGraphicsPipeline 00072 { 00073 private: 00075 friend class csApp; 00076 00079 csImageArea *SyncArea [MAX_SYNC_PAGES]; 00081 csRect RefreshRect; 00083 csRect PageCarry; 00085 int MaxPage; 00087 int CurPage; 00088 00090 int DrawMode; 00092 csRect ClipRect; 00094 csRect OrigClip; 00095 00096 // Frame width and height 00097 int FrameWidth, FrameHeight; 00098 00099 // The 2D graphics driver 00100 csRef<iGraphics2D> G2D; 00101 // The 3D graphics driver 00102 csRef<iGraphics3D> G3D; 00103 00104 // Do not cache the image of current frame 00105 bool DontCacheFrame; 00106 00108 void Initialize (iObjectRegistry *object_reg); 00110 virtual ~csGraphicsPipeline (); 00111 00113 void Sync (int CurPage, int &xmin, int &ymin, int &xmax, int &ymax); 00114 00116 void Desync (); 00117 00119 void Box (int xmin, int ymin, int xmax, int ymax, int color); 00120 00122 void Line (float x1, float y1, float x2, float y2, int color); 00123 00125 void Pixel (int x, int y, int color); 00126 00128 void Text (int x, int y, int fg, int bg, iFont *font, int fontsize, const char *s); 00129 00131 void Pixmap (csPixmap *s2d, int x, int y, int w, int h, uint8 Alpha); 00132 00134 void TiledPixmap (csPixmap *s2d, int x, int y, int w, int h, 00135 int orgx, int orgy, uint8 Alpha); 00136 00138 void Texture (iTextureHandle *hTex, int sx, int sy, int sw, int sh, 00139 int tx, int ty, int tw, int th, uint8 Alpha); 00140 00142 void SaveArea (csImageArea **Area, int x, int y, int w, int h); 00143 00145 void RestoreArea (csImageArea *Area, bool Free); 00146 00148 void FreeArea (csImageArea *Area); 00149 00151 void Clear (int color); 00152 00154 void SetClipRect (int xmin, int ymin, int xmax, int ymax); 00155 00157 void RestoreClipRect(); 00158 00160 void Polygon3D (G3DPolygonDPFX &poly, uint mode); 00161 00163 bool ClipLine (float &x1, float &y1, float &x2, float &y2, 00164 int ClipX1, int ClipY1, int ClipX2, int ClipY2); 00165 00167 void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB); 00168 00170 bool SwitchMouseCursor (csMouseCursorID Shape); 00171 00173 void ClearZbuffer () 00174 { DrawMode |= CSDRAW_CLEARZBUFFER; } 00175 00177 void ClearZbuffer (int x1, int y1, int x2, int y2); 00178 00180 void SetZbufferMode (unsigned mode) 00181 { G3D->SetRenderState (G3DRENDERSTATE_ZBUFFERMODE, mode); } 00182 00184 void StartFrame (csMouse *Mouse); 00185 00187 void FinishFrame (csMouse *Mouse); 00188 00190 bool BeginDraw (int iMode) 00191 { return (iMode != DrawMode) ? BeginDrawImp (iMode) : true; } 00192 00194 void FinishDraw (); 00195 00197 bool BeginDrawImp (int iMode); 00198 00200 void FinishDrawImp (); 00201 00203 void Invalidate (csRect &rect); 00204 00206 void CanvasResize (); 00207 }; 00208 00211 #endif // __CS_CSGFXPPL_H__
Generated for Crystal Space by doxygen 1.2.18