ivideo/graph2d.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 csRect;
    00043 class csVector3;
    00044
    00045 namespace CS {
    00046 namespace Math {
    00047 class Matrix4;
    00048 } // namespace Math
    00049 } // namespace CS
    00050
    00052 enum
    00053 {
    00058   CS_WRITE_BASELINE    = (1 << 0),
    00062   CS_WRITE_NOANTIALIAS = (1 << 1)
    00063 };
    00064
    00066 struct csPixelCoord
    00067 {
    00069   int x;
    00071   int y;
    00072 };
    00073
    00094 struct iGraphics2D : public virtual iBase
    00095 {
    00096   SCF_INTERFACE (iGraphics2D, 4, 0, 2);
    00097
    00099   virtual bool Open () = 0;
    00100
    00102   virtual void Close () = 0;
    00103
    00105   virtual int GetWidth () = 0;
    00106
    00108   virtual int GetHeight () = 0;
    00109
    00111   virtual int GetColorDepth () = 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
    00153   virtual void Print (csRect const* pArea) = 0;
    00154
    00156   virtual void Clear (int color) = 0;
    00157
    00159   virtual void ClearAll (int color) = 0;
    00160
    00162   virtual void DrawLine(float x1, float y1, float x2, float y2, int color) = 0;
    00163
    00165   virtual void DrawBox (int x, int y, int w, int h, int color) = 0;
    00166
    00171   virtual bool ClipLine (float& x1, float& y1, float& x2, float& y2,
    00172     int xmin, int ymin, int xmax, int ymax) = 0;
    00173
    00175   virtual void DrawPixel (int x, int y, int color) = 0;
    00176
    00178   virtual void DrawPixels(csPixelCoord const* pixels, int num_pixels,
    00179      int color) = 0;
    00180
    00182   virtual void Blit (int x, int y, int width, int height,
    00183     unsigned char const* data) = 0;
    00184
    00186   virtual void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB) = 0;
    00188   virtual void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB,
    00189         uint8 &oA) = 0;
    00190
    00199   virtual void Write (iFont *font, int x, int y, int fg, int bg,
    00200     const char *str, uint flags = 0) = 0;
    00201
    00202
    00204   virtual void AllowResize (bool iAllow) = 0;
    00205
    00207   virtual bool Resize (int w, int h) = 0;
    00208
    00210   virtual iFontServer *GetFontServer () = 0;
    00211
    00219   virtual bool PerformExtension (char const* command, ...) = 0;
    00220
    00226   virtual bool PerformExtensionV (char const* command, va_list) = 0;
    00227
    00229   virtual csPtr<iImage> ScreenShot () = 0;
    00230
    00235   virtual iNativeWindow* GetNativeWindow () = 0;
    00236
    00238   virtual bool GetFullScreen () = 0;
    00239
    00243   virtual void SetFullScreen (bool b) = 0;
    00244
    00246   virtual bool SetMousePosition (int x, int y) = 0;
    00247
    00256   virtual bool SetMouseCursor (csMouseCursorID iShape) = 0;
    00257
    00276   virtual bool SetMouseCursor (iImage *image, const csRGBcolor* keycolor = 0,
    00277                                int hotspot_x = 0, int hotspot_y = 0,
    00278                                csRGBcolor fg = csRGBcolor(255,255,255),
    00279                                csRGBcolor bg = csRGBcolor(0,0,0)) = 0;
    00280
    00286   virtual bool SetGamma (float gamma) = 0;
    00287
    00291   virtual float GetGamma () const = 0;
    00292
    00296   virtual const char* GetName () const = 0;
    00297
    00305   virtual void Write (iFont *font, int x, int y, int fg, int bg,
    00306     const wchar_t* str, uint flags = 0) = 0;
    00307
    00315   virtual void SetViewport (int left, int top, int width, int height) = 0;
    00317   virtual void GetViewport (int& left, int& top, int& width, int& height) = 0;
    00318
    00320   virtual void GetFramebufferDimensions (int& width, int& height) = 0;
    00321
    00323   virtual const char* GetHWRenderer () = 0;
    00325   virtual const char* GetHWGLVersion () = 0;
    00327   virtual const char* GetHWVendor () = 0;
    00328
    00341   virtual void DrawLineProjected (const csVector3& v1, const csVector3& v2,
    00342     float fov, int color) = 0;
    00343
    00352   virtual void DrawLineProjected (const csVector3& v1, const csVector3& v2,
    00353     const CS::Math::Matrix4& projection, int color) = 0;
    00354 };
    00355
    00358 #endif // __CS_IVIDEO_GRAPH2D_H__
    00359