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/cursor.h" 00034 00035 00036 struct iImage; 00037 struct iFontServer; 00038 struct iFont; 00039 struct iNativeWindow; 00040 struct iGraphics2D; 00041 00042 class csBox3; 00043 class csRect; 00044 class csTransform; 00045 class csVector3; 00046 00047 namespace CS { 00048 namespace Math { 00049 class Matrix4; 00050 } // namespace Math 00051 } // namespace CS 00052 00054 enum 00055 { 00060 CS_WRITE_BASELINE = (1 << 0), 00064 CS_WRITE_NOANTIALIAS = (1 << 1) 00065 }; 00066 00068 struct csPixelCoord 00069 { 00071 int x; 00073 int y; 00074 }; 00075 00096 struct iGraphics2D : public virtual iBase 00097 { 00098 SCF_INTERFACE (iGraphics2D, 4, 0, 3); 00099 00101 virtual bool Open () = 0; 00102 00104 virtual void Close () = 0; 00105 00107 virtual int GetWidth () = 0; 00108 00110 virtual int GetHeight () = 0; 00111 00113 virtual int GetColorDepth () = 0; 00114 00120 virtual int FindRGB (int r, int g, int b, int a = 255) = 0; 00121 00125 virtual void GetRGB (int color, int& r, int& g, int& b) = 0; 00129 virtual void GetRGB (int color, int& r, int& g, int& b, int& a) = 0; 00130 00136 virtual void SetClipRect (int nMinX, int nMinY, int nMaxX, int nMaxY) = 0; 00137 00139 virtual void GetClipRect(int& nMinX, int& nMinY, int& nMaxX, int& nMaxY) = 0; 00140 00145 virtual bool BeginDraw () = 0; 00146 00148 virtual void FinishDraw () = 0; 00149 00155 virtual void Print (csRect const* pArea) = 0; 00156 00158 virtual void Clear (int color) = 0; 00159 00161 virtual void ClearAll (int color) = 0; 00162 00164 virtual void DrawLine(float x1, float y1, float x2, float y2, int color) = 0; 00165 00167 virtual void DrawBox (int x, int y, int w, int h, int color) = 0; 00168 00173 virtual bool ClipLine (float& x1, float& y1, float& x2, float& y2, 00174 int xmin, int ymin, int xmax, int ymax) = 0; 00175 00177 virtual void DrawPixel (int x, int y, int color) = 0; 00178 00180 virtual void DrawPixels(csPixelCoord const* pixels, int num_pixels, 00181 int color) = 0; 00182 00184 virtual void Blit (int x, int y, int width, int height, 00185 unsigned char const* data) = 0; 00186 00188 virtual void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB) = 0; 00190 virtual void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB, 00191 uint8 &oA) = 0; 00192 00201 virtual void Write (iFont *font, int x, int y, int fg, int bg, 00202 const char *str, uint flags = 0) = 0; 00203 00204 00206 virtual void AllowResize (bool iAllow) = 0; 00207 00209 virtual bool Resize (int w, int h) = 0; 00210 00212 virtual iFontServer *GetFontServer () = 0; 00213 00221 virtual bool PerformExtension (char const* command, ...) = 0; 00222 00228 virtual bool PerformExtensionV (char const* command, va_list) = 0; 00229 00231 virtual csPtr<iImage> ScreenShot () = 0; 00232 00237 virtual iNativeWindow* GetNativeWindow () = 0; 00238 00240 virtual bool GetFullScreen () = 0; 00241 00245 virtual void SetFullScreen (bool b) = 0; 00246 00248 virtual bool SetMousePosition (int x, int y) = 0; 00249 00258 virtual bool SetMouseCursor (csMouseCursorID iShape) = 0; 00259 00278 virtual bool SetMouseCursor (iImage *image, const csRGBcolor* keycolor = 0, 00279 int hotspot_x = 0, int hotspot_y = 0, 00280 csRGBcolor fg = csRGBcolor(255,255,255), 00281 csRGBcolor bg = csRGBcolor(0,0,0)) = 0; 00282 00288 virtual bool SetGamma (float gamma) = 0; 00289 00293 virtual float GetGamma () const = 0; 00294 00298 virtual const char* GetName () const = 0; 00299 00307 virtual void Write (iFont *font, int x, int y, int fg, int bg, 00308 const wchar_t* str, uint flags = 0) = 0; 00309 00317 virtual void SetViewport (int left, int top, int width, int height) = 0; 00319 virtual void GetViewport (int& left, int& top, int& width, int& height) = 0; 00320 00322 virtual void GetFramebufferDimensions (int& width, int& height) = 0; 00323 00325 virtual const char* GetHWRenderer () = 0; 00327 virtual const char* GetHWGLVersion () = 0; 00329 virtual const char* GetHWVendor () = 0; 00330 00343 virtual void DrawLineProjected (const csVector3& v1, const csVector3& v2, 00344 float fov, int color) = 0; 00345 00354 virtual void DrawLineProjected (const csVector3& v1, const csVector3& v2, 00355 const CS::Math::Matrix4& projection, int color) = 0; 00356 00365 virtual void DrawBoxProjected (const csBox3& box, const csTransform& object2camera, 00366 const CS::Math::Matrix4& projection, int color) = 0; 00367 }; 00368 00371 #endif // __CS_IVIDEO_GRAPH2D_H__ 00372
Generated for Crystal Space 2.1 by doxygen 1.6.1
