CrystalSpace

Public API Reference

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

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 "csutil/leakguard.h"
00036 #include "ivideo/graph2d.h"
00037 
00038 class csMouse;
00039 struct iGraphics2D;
00040 struct iObjectRegistry;
00041 
00043 #define MAX_CSWS_PIPELINE_LENGTH 16384
00044 
00045 #define MAX_SYNC_PAGES 8
00046 
00074 class CS_CSWS_EXPORT csGraphicsPipeline
00075 {
00076 public:
00077   CS_LEAKGUARD_DECLARE (csGraphicsPipeline);
00078 
00079 private:
00081   friend class csApp;
00082 
00085   csImageArea *SyncArea [MAX_SYNC_PAGES];
00087   csRect RefreshRect;
00089   csRect PageCarry;
00091   int MaxPage;
00093   int CurPage;
00094 
00096   int DrawMode;
00098   csRect ClipRect;
00100   csRect OrigClip;
00101 
00102   // Frame width and height
00103   int FrameWidth, FrameHeight;
00104 
00105   // The 2D graphics driver
00106   csRef<iGraphics2D> G2D;
00107   // The 3D graphics driver
00108   csRef<iGraphics3D> G3D;
00109 
00110   // Do not cache the image of current frame
00111   bool DontCacheFrame;
00112 
00114   void Initialize (iObjectRegistry *object_reg);
00116   virtual ~csGraphicsPipeline ();
00117 
00119   void Sync (int CurPage, int &xmin, int &ymin, int &xmax, int &ymax);
00120 
00122   void Desync ();
00123 
00125   void Box (int xmin, int ymin, int xmax, int ymax, int color);
00126 
00128   void Line (float x1, float y1, float x2, float y2, int color);
00129 
00131   void Pixel (int x, int y, int color);
00132 
00134   void Text (int x, int y, int fg, int bg, iFont *font, const char *s);
00135 
00137   void Pixmap (csPixmap *s2d, int x, int y, int w, int h, uint8 Alpha);
00138 
00140   void TiledPixmap (csPixmap *s2d, int x, int y, int w, int h,
00141     int orgx, int orgy, uint8 Alpha);
00142 
00144   void Texture (iTextureHandle *hTex, int sx, int sy, int sw, int sh,
00145     int tx, int ty, int tw, int th, uint8 Alpha);
00146 
00148   void SaveArea (csImageArea **Area, int x, int y, int w, int h);
00149 
00151   void RestoreArea (csImageArea *Area, bool Free);
00152 
00154   void FreeArea (csImageArea *Area);
00155 
00157   void Clear (int color);
00158 
00160   void SetClipRect (int xmin, int ymin, int xmax, int ymax);
00161 
00163   void RestoreClipRect();
00164 
00166   //@@@REIMPLEMENT THIS FOR NR
00167   //void Polygon3D (G3DPolygonDPFX &poly, uint mode);
00168 
00170   bool ClipLine (float &x1, float &y1, float &x2, float &y2,
00171     int ClipX1, int ClipY1, int ClipX2, int ClipY2);
00172 
00174   void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB);
00175 
00177   bool SwitchMouseCursor (csMouseCursorID Shape);
00178 
00180   void ClearZbuffer ()
00181   { DrawMode |= CSDRAW_CLEARZBUFFER; }
00182 
00184   void ClearZbuffer (int x1, int y1, int x2, int y2);
00185 
00187   void SetZbufferMode (unsigned mode)
00188   { G3D->SetRenderState (G3DRENDERSTATE_ZBUFFERMODE, mode); }
00189 
00191   void StartFrame (csMouse *Mouse);
00192 
00194   void FinishFrame (csMouse *Mouse);
00195 
00197   bool BeginDraw (int iMode)
00198   { return (iMode != DrawMode) ? BeginDrawImp (iMode) : true; }
00199 
00201   void FinishDraw ();
00202 
00204   bool BeginDrawImp (int iMode);
00205 
00207   void FinishDrawImp ();
00208 
00210   void Invalidate (csRect &rect);
00211 
00213   void CanvasResize ();
00214 };
00215 
00218 #endif // __CS_CSGFXPPL_H__

Generated for Crystal Space by doxygen 1.3.9.1