00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CSGFXPPL_H__
00021 #define __CSGFXPPL_H__
00022
00023 #include "csgeom/csrect.h"
00024 #include "cstool/cspixmap.h"
00025 #include "ivideo/graph2d.h"
00026
00027 class csMouse;
00028 struct iGraphics2D;
00029 struct iObjectRegistry;
00030
00031
00032 #define MAX_CSWS_PIPELINE_LENGTH 16384
00033
00034 #define MAX_SYNC_PAGES 8
00035
00063 class csGraphicsPipeline
00064 {
00065 private:
00067 friend class csApp;
00068
00071 csImageArea *SyncArea [MAX_SYNC_PAGES];
00073 csRect RefreshRect;
00075 csRect PageCarry;
00077 int MaxPage;
00079 int CurPage;
00080
00082 int DrawMode;
00084 csRect ClipRect;
00086 csRect OrigClip;
00087
00088
00089 int FrameWidth, FrameHeight;
00090
00091
00092 iGraphics2D *G2D;
00093
00094 iGraphics3D *G3D;
00095
00096
00097 bool DontCacheFrame;
00098
00100 void Initialize (iObjectRegistry *object_reg);
00102 virtual ~csGraphicsPipeline ();
00103
00105 void Sync (int CurPage, int &xmin, int &ymin, int &xmax, int &ymax);
00106
00108 void Desync ();
00109
00111 void Box (int xmin, int ymin, int xmax, int ymax, int color);
00112
00114 void Line (float x1, float y1, float x2, float y2, int color);
00115
00117 void Pixel (int x, int y, int color);
00118
00120 void Text (int x, int y, int fg, int bg, iFont *font, int fontsize, const char *s);
00121
00123 void Pixmap (csPixmap *s2d, int x, int y, int w, int h, uint8 Alpha);
00124
00126 void TiledPixmap (csPixmap *s2d, int x, int y, int w, int h,
00127 int orgx, int orgy, uint8 Alpha);
00128
00130 void Texture (iTextureHandle *hTex, int sx, int sy, int sw, int sh,
00131 int tx, int ty, int tw, int th, uint8 Alpha);
00132
00134 void SaveArea (csImageArea **Area, int x, int y, int w, int h);
00135
00137 void RestoreArea (csImageArea *Area, bool Free);
00138
00140 void FreeArea (csImageArea *Area);
00141
00143 void Clear (int color);
00144
00146 void SetClipRect (int xmin, int ymin, int xmax, int ymax);
00147
00149 void RestoreClipRect();
00150
00152 void Polygon3D (G3DPolygonDPFX &poly, UInt mode);
00153
00155 bool ClipLine (float &x1, float &y1, float &x2, float &y2,
00156 int ClipX1, int ClipY1, int ClipX2, int ClipY2);
00157
00159 void GetPixel (int x, int y, UByte &oR, UByte &oG, UByte &oB);
00160
00162 bool SwitchMouseCursor (csMouseCursorID Shape);
00163
00165 void ClearZbuffer ()
00166 { DrawMode |= CSDRAW_CLEARZBUFFER; }
00167
00169 void ClearZbuffer (int x1, int y1, int x2, int y2);
00170
00172 void SetZbufferMode (unsigned mode)
00173 { G3D->SetRenderState (G3DRENDERSTATE_ZBUFFERMODE, mode); }
00174
00176 void StartFrame (csMouse *Mouse);
00177
00179 void FinishFrame (csMouse *Mouse);
00180
00182 bool BeginDraw (int iMode)
00183 { return (iMode != DrawMode) ? BeginDrawImp (iMode) : true; }
00184
00186 void FinishDraw ();
00187
00189 bool BeginDrawImp (int iMode);
00190
00192 void FinishDrawImp ();
00193
00195 void Invalidate (csRect &rect);
00196
00198 void CanvasResize ();
00199 };
00200
00201 #endif // __CSGFXPPL_H__