CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 "csextern.h"
00032  
00033 #include "csgeom/csrect.h"
00034 #include "cstool/cspixmap.h"
00035 #include "ivideo/graph2d.h"
00036 
00037 class csMouse;
00038 struct iGraphics2D;
00039 struct iObjectRegistry;
00040 
00042 #define MAX_CSWS_PIPELINE_LENGTH 16384
00043 
00044 #define MAX_SYNC_PAGES 8
00045 
00073 class CS_CSWS_EXPORT csGraphicsPipeline
00074 {
00075 private:
00077   friend class csApp;
00078 
00081   csImageArea *SyncArea [MAX_SYNC_PAGES];
00083   csRect RefreshRect;
00085   csRect PageCarry;
00087   int MaxPage;
00089   int CurPage;
00090 
00092   int DrawMode;
00094   csRect ClipRect;
00096   csRect OrigClip;
00097 
00098   // Frame width and height
00099   int FrameWidth, FrameHeight;
00100 
00101   // The 2D graphics driver
00102   csRef<iGraphics2D> G2D;
00103   // The 3D graphics driver
00104   csRef<iGraphics3D> G3D;
00105 
00106   // Do not cache the image of current frame
00107   bool DontCacheFrame;
00108 
00110   void Initialize (iObjectRegistry *object_reg);
00112   virtual ~csGraphicsPipeline ();
00113 
00115   void Sync (int CurPage, int &xmin, int &ymin, int &xmax, int &ymax);
00116 
00118   void Desync ();
00119 
00121   void Box (int xmin, int ymin, int xmax, int ymax, int color);
00122 
00124   void Line (float x1, float y1, float x2, float y2, int color);
00125 
00127   void Pixel (int x, int y, int color);
00128 
00130   void Text (int x, int y, int fg, int bg, iFont *font, const char *s);
00131 
00133   void Pixmap (csPixmap *s2d, int x, int y, int w, int h, uint8 Alpha);
00134 
00136   void TiledPixmap (csPixmap *s2d, int x, int y, int w, int h,
00137     int orgx, int orgy, uint8 Alpha);
00138 
00140   void Texture (iTextureHandle *hTex, int sx, int sy, int sw, int sh,
00141     int tx, int ty, int tw, int th, uint8 Alpha);
00142 
00144   void SaveArea (csImageArea **Area, int x, int y, int w, int h);
00145 
00147   void RestoreArea (csImageArea *Area, bool Free);
00148 
00150   void FreeArea (csImageArea *Area);
00151 
00153   void Clear (int color);
00154 
00156   void SetClipRect (int xmin, int ymin, int xmax, int ymax);
00157 
00159   void RestoreClipRect();
00160 
00162   void Polygon3D (G3DPolygonDPFX &poly, uint mode);
00163 
00165   bool ClipLine (float &x1, float &y1, float &x2, float &y2,
00166     int ClipX1, int ClipY1, int ClipX2, int ClipY2);
00167 
00169   void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB);
00170 
00172   bool SwitchMouseCursor (csMouseCursorID Shape);
00173 
00175   void ClearZbuffer ()
00176   { DrawMode |= CSDRAW_CLEARZBUFFER; }
00177 
00179   void ClearZbuffer (int x1, int y1, int x2, int y2);
00180 
00182   void SetZbufferMode (unsigned mode)
00183   { G3D->SetRenderState (G3DRENDERSTATE_ZBUFFERMODE, mode); }
00184 
00186   void StartFrame (csMouse *Mouse);
00187 
00189   void FinishFrame (csMouse *Mouse);
00190 
00192   bool BeginDraw (int iMode)
00193   { return (iMode != DrawMode) ? BeginDrawImp (iMode) : true; }
00194 
00196   void FinishDraw ();
00197 
00199   bool BeginDrawImp (int iMode);
00200 
00202   void FinishDrawImp ();
00203 
00205   void Invalidate (csRect &rect);
00206 
00208   void CanvasResize ();
00209 };
00210 
00213 #endif // __CS_CSGFXPPL_H__

Generated for Crystal Space by doxygen 1.2.18