ivideo/graph2d.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2001 by Jorrit Tyberghein 00003 Copyright (C) 1998-2000 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 License, 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_IVIDEO_GRAPH2D_H__ 00021 #define __CS_IVIDEO_GRAPH2D_H__ 00022 00031 #include "csutil/scf.h" 00032 #include "csgfx/rgbpixel.h" 00033 #include "ivideo/canvas.h" 00034 #include "ivideo/cursor.h" 00035 #include <stdarg.h> 00036 00037 struct iImage; 00038 struct iFontServer; 00039 struct iFont; 00040 struct iNativeWindow; 00041 struct iGraphics2D; 00042 00043 class csBox3; 00044 class csRect; 00045 class csTransform; 00046 class csVector3; 00047 00048 namespace CS { 00049 namespace Math { 00050 class Matrix4; 00051 } // namespace Math 00052 } // namespace CS 00053 00055 enum 00056 { 00061 CS_WRITE_BASELINE = (1 << 0), 00065 CS_WRITE_NOANTIALIAS = (1 << 1) 00066 }; 00067 00069 struct csPixelCoord 00070 { 00072 int x; 00074 int y; 00075 }; 00076 00097 struct iGraphics2D : public virtual iGraphicsCanvas 00098 { 00099 SCF_INTERFACE (iGraphics2D, 5, 0, 0); 00100 00102 virtual bool Open () = 0; 00103 00105 virtual void Close () = 0; 00106 00108 virtual int GetWidth () = 0; 00109 00111 virtual int GetHeight () = 0; 00112 00118 virtual int FindRGB (int r, int g, int b, int a = 255) = 0; 00119 00123 virtual void GetRGB (int color, int& r, int& g, int& b) = 0; 00127 virtual void GetRGB (int color, int& r, int& g, int& b, int& a) = 0; 00128 00134 virtual void SetClipRect (int nMinX, int nMinY, int nMaxX, int nMaxY) = 0; 00135 00137 virtual void GetClipRect(int& nMinX, int& nMinY, int& nMaxX, int& nMaxY) = 0; 00138 00143 virtual bool BeginDraw () = 0; 00144 00146 virtual void FinishDraw () = 0; 00147 00149 virtual void Clear (int color) = 0; 00150 00152 virtual void ClearAll (int color) = 0; 00153 00155 virtual void DrawLine(float x1, float y1, float x2, float y2, int color) = 0; 00156 00158 virtual void DrawBox (int x, int y, int w, int h, int color) = 0; 00159 00164 virtual bool ClipLine (float& x1, float& y1, float& x2, float& y2, 00165 int xmin, int ymin, int xmax, int ymax) = 0; 00166 00168 virtual void DrawPixel (int x, int y, int color) = 0; 00169 00171 virtual void DrawPixels(csPixelCoord const* pixels, int num_pixels, 00172 int color) = 0; 00173 00175 virtual void Blit (int x, int y, int width, int height, 00176 unsigned char const* data) = 0; 00177 00179 virtual void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB) = 0; 00181 virtual void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB, 00182 uint8 &oA) = 0; 00183 00192 virtual void Write (iFont *font, int x, int y, int fg, int bg, 00193 const char *str, uint flags = 0) = 0; 00194 00195 00197 virtual bool Resize (int w, int h) = 0; 00198 00200 virtual iFontServer *GetFontServer () = 0; 00201 00209 bool PerformExtension (char const* command, ...) 00210 { 00211 va_list args; 00212 va_start(args, command); 00213 bool x = PerformExtensionV(command, args); 00214 va_end(args); 00215 return x; 00216 } 00217 00223 virtual bool PerformExtensionV (char const* command, va_list) = 0; 00224 00226 virtual csPtr<iImage> ScreenShot () = 0; 00227 00235 virtual void Write (iFont *font, int x, int y, int fg, int bg, 00236 const wchar_t* str, uint flags = 0) = 0; 00237 00245 virtual void SetViewport (int left, int top, int width, int height) = 0; 00247 virtual void GetViewport (int& left, int& top, int& width, int& height) = 0; 00248 00250 virtual const char* GetHWRenderer () = 0; 00252 virtual const char* GetHWGLVersion () = 0; 00254 virtual const char* GetHWVendor () = 0; 00255 00268 virtual void DrawLineProjected (const csVector3& v1, const csVector3& v2, 00269 float fov, int color) = 0; 00270 00279 virtual void DrawLineProjected (const csVector3& v1, const csVector3& v2, 00280 const CS::Math::Matrix4& projection, int color) = 0; 00281 00290 virtual void DrawBoxProjected (const csBox3& box, const csTransform& object2camera, 00291 const CS::Math::Matrix4& projection, int color) = 0; 00292 }; 00293 00296 #endif // __CS_IVIDEO_GRAPH2D_H__ 00297
Generated for Crystal Space 2.1 by doxygen 1.6.1
