VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOpenGLContextDevice2D.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 00032 #ifndef __vtkOpenGLContextDevice2D_h 00033 #define __vtkOpenGLContextDevice2D_h 00034 00035 #include "vtkContextDevice2D.h" 00036 00037 class vtkWindow; 00038 class vtkViewport; 00039 class vtkRenderer; 00040 class vtkStringToImage; 00041 class vtkOpenGLRenderWindow; 00042 class vtkOpenGLExtensionManager; 00043 00044 class VTK_CHARTS_EXPORT vtkOpenGLContextDevice2D : public vtkContextDevice2D 00045 { 00046 public: 00047 vtkTypeMacro(vtkOpenGLContextDevice2D, vtkContextDevice2D); 00048 virtual void PrintSelf(ostream &os, vtkIndent indent); 00049 00051 static vtkOpenGLContextDevice2D *New(); 00052 00054 00057 virtual void DrawPoly(float *f, int n, unsigned char *colors = 0, 00058 int nc_comps = 0); 00060 00062 00065 virtual void DrawPoints(float *points, int n, unsigned char* colors = 0, 00066 int nc_comps = 0); 00068 00070 00075 virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n, 00076 unsigned char* colors = 0, int nc_comps = 0); 00078 00080 virtual void DrawQuad(float *points, int n); 00081 00083 virtual void DrawQuadStrip(float *points, int n); 00084 00086 virtual void DrawPolygon(float *, int); 00087 00089 00095 virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy, 00096 float inRx, float inRy, float startAngle, 00097 float stopAngle); 00099 00101 00104 virtual void DrawEllipticArc(float x, float y, float rX, float rY, 00105 float startAngle, float stopAngle); 00107 00108 00110 virtual void DrawString(float *point, const vtkStdString &string); 00111 00113 00118 virtual void ComputeStringBounds(const vtkStdString &string, 00119 float bounds[4]); 00121 00123 virtual void DrawString(float *point, const vtkUnicodeString &string); 00124 00126 00131 virtual void ComputeStringBounds(const vtkUnicodeString &string, 00132 float bounds[4]); 00134 00137 virtual void DrawImage(float p[2], float scale, vtkImageData *image); 00138 00142 void DrawImage(const vtkRectf& pos, vtkImageData *image); 00143 00145 virtual void SetColor4(unsigned char color[4]); 00146 00148 virtual void SetColor(unsigned char color[3]); 00149 00151 virtual void SetTexture(vtkImageData* image, int properties = 0); 00152 00154 virtual void SetPointSize(float size); 00155 00157 virtual void SetLineWidth(float width); 00158 00160 virtual void SetLineType(int type); 00161 00163 virtual void MultiplyMatrix(vtkMatrix3x3 *m); 00164 00166 virtual void SetMatrix(vtkMatrix3x3 *m); 00167 00169 virtual void GetMatrix(vtkMatrix3x3 *m); 00170 00172 virtual void PushMatrix(); 00173 00175 virtual void PopMatrix(); 00176 00179 virtual void SetClipping(int *x); 00180 00182 virtual void EnableClipping(bool enable); 00183 00185 virtual void Begin(vtkViewport* viewport); 00186 00188 virtual void End(); 00189 00193 virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId); 00194 00199 virtual void BufferIdModeEnd(); 00200 00204 bool SetStringRendererToFreeType(); 00205 00208 bool SetStringRendererToQt(); 00209 00211 bool HasGLSL(); 00212 00214 00216 vtkGetObjectMacro(RenderWindow, vtkOpenGLRenderWindow); 00218 00222 virtual void ReleaseGraphicsResources(vtkWindow *window); 00223 00224 //BTX 00225 protected: 00226 vtkOpenGLContextDevice2D(); 00227 virtual ~vtkOpenGLContextDevice2D(); 00228 00230 00234 int GetNumberOfArcIterations(float rX, 00235 float rY, 00236 float startAngle, 00237 float stopAngle); 00239 00241 int Geometry[2]; 00242 00244 vtkRenderer *Renderer; 00245 00247 vtkStringToImage *TextRenderer; 00248 00250 bool InRender; 00251 00253 00254 class Private; 00255 Private *Storage; 00257 00259 virtual bool LoadExtensions(vtkOpenGLExtensionManager *m); 00260 00262 vtkOpenGLRenderWindow* RenderWindow; 00263 00264 private: 00265 vtkOpenGLContextDevice2D(const vtkOpenGLContextDevice2D &); // Not implemented. 00266 void operator=(const vtkOpenGLContextDevice2D &); // Not implemented. 00267 00268 void AlignText(double orientation, float width, float height, float *p); 00269 00270 //ETX 00271 }; 00272 00273 #endif //__vtkOpenGLContextDevice2D_h