VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkContextDevice2D.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 00025 #ifndef __vtkContextDevice2D_h 00026 #define __vtkContextDevice2D_h 00027 00028 #include "vtkRenderingContext2DModule.h" // For export macro 00029 #include "vtkObject.h" 00030 #include "vtkVector.h" // For vtkVector2i ivar 00031 #include "vtkRect.h" // For vtkRecti ivar 00032 #include "vtkRenderingCoreEnums.h" // For marker enum 00033 00034 class vtkWindow; 00035 class vtkViewport; 00036 class vtkStdString; 00037 class vtkUnicodeString; 00038 class vtkTextProperty; 00039 class vtkPoints2D; 00040 class vtkImageData; 00041 class vtkMatrix3x3; 00042 class vtkAbstractContextBufferId; 00043 class vtkPen; 00044 class vtkBrush; 00045 class vtkRectf; 00046 00047 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextDevice2D : public vtkObject 00048 { 00049 public: 00050 vtkTypeMacro(vtkContextDevice2D, vtkObject); 00051 virtual void PrintSelf(ostream &os, vtkIndent indent); 00052 00054 00058 virtual void DrawPoly(float *points, int n, 00059 unsigned char *colors = 0, int nc_comps = 0) = 0; 00061 00063 00065 virtual void DrawPoints(float *points, int n, unsigned char* colors = 0, 00066 int nc_comps = 0) = 0; 00068 00070 00075 virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n, 00076 unsigned char *colors = 0, int nc_comps = 0) = 0; 00078 00080 00086 virtual void DrawMarkers(int shape, bool highlight, float *points, int n, 00087 unsigned char *colors = 0, int nc_comps = 0); 00089 00091 virtual void DrawQuad(float *, int) { ; } 00092 00094 virtual void DrawQuadStrip(float *, int) { ; } 00095 00097 virtual void DrawPolygon(float *, int) { ; } 00098 00100 00106 virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy, 00107 float inRx, float inRy, float startAngle, 00108 float stopAngle)=0; 00110 00112 00115 virtual void DrawEllipticArc(float x, float y, float rX, float rY, 00116 float startAngle, float stopAngle)=0; 00118 00120 virtual void DrawString(float *point, const vtkStdString &string) = 0; 00121 00123 00128 virtual void ComputeStringBounds(const vtkStdString &string, 00129 float bounds[4]) = 0; 00131 00133 virtual void DrawString(float *point, const vtkUnicodeString &string) = 0; 00134 00136 00141 virtual void ComputeStringBounds(const vtkUnicodeString &string, 00142 float bounds[4]) = 0; 00144 00148 virtual void DrawMathTextString(float *point, const vtkStdString &string) = 0; 00149 00151 virtual bool MathTextIsSupported(); 00152 00155 virtual void DrawImage(float p[2], float scale, vtkImageData *image) = 0; 00156 00160 virtual void DrawImage(const vtkRectf& pos, vtkImageData *image) = 0; 00161 00166 void ApplyPen(vtkPen *pen); 00167 00169 00172 vtkGetObjectMacro(Pen, vtkPen); 00174 00179 void ApplyBrush(vtkBrush *brush); 00180 00182 00184 vtkGetObjectMacro(Brush, vtkBrush); 00186 00190 void ApplyTextProp(vtkTextProperty *prop); 00191 00193 00194 vtkGetObjectMacro(TextProp, vtkTextProperty); 00196 00198 virtual void SetColor4(unsigned char color[4]) = 0; 00199 00200 enum TextureProperty { 00201 Nearest = 0x01, 00202 Linear = 0x02, 00203 Stretch = 0x04, 00204 Repeat = 0x08 00205 }; 00207 virtual void SetTexture(vtkImageData* image, int properties) = 0; 00208 00210 virtual void SetPointSize(float size) = 0; 00211 00213 virtual void SetLineWidth(float width) = 0; 00214 00216 virtual void SetLineType(int type) = 0; 00217 00219 virtual int GetWidth() { return this->Geometry[0]; } 00220 00222 virtual int GetHeight() { return this->Geometry[1]; } 00223 00225 virtual void SetMatrix(vtkMatrix3x3 *m) = 0; 00226 00228 virtual void GetMatrix(vtkMatrix3x3 *m) = 0; 00229 00231 virtual void MultiplyMatrix(vtkMatrix3x3 *m) = 0; 00232 00234 virtual void PushMatrix() = 0; 00235 00237 virtual void PopMatrix() = 0; 00238 00241 virtual void SetClipping(int *x) = 0; 00242 00245 virtual void DisableClipping() { this->EnableClipping(false); } 00246 00248 virtual void EnableClipping(bool enable) = 0; 00249 00251 virtual void Begin(vtkViewport*) { } 00252 00254 virtual void End() { } 00255 00258 virtual bool GetBufferIdMode() const; 00259 00260 //BTX 00262 00265 virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId); 00266 //ETX 00268 00272 virtual void BufferIdModeEnd(); 00273 00274 virtual void SetViewportSize(const vtkVector2i &size) 00275 { 00276 this->ViewportSize = size; 00277 } 00278 00279 virtual void SetViewportRect(const vtkRecti &rect) 00280 { 00281 this->ViewportRect = rect; 00282 } 00283 00284 //BTX 00285 protected: 00286 vtkContextDevice2D(); 00287 ~vtkContextDevice2D(); 00288 00290 int Geometry[2]; 00291 00293 vtkVector2i ViewportSize; 00294 00296 vtkRecti ViewportRect; 00297 00298 vtkAbstractContextBufferId *BufferId; 00299 00300 vtkPen *Pen; // Outlining 00301 vtkBrush *Brush; // Fills 00302 vtkTextProperty *TextProp; // Text property 00303 00304 private: 00305 vtkContextDevice2D(const vtkContextDevice2D &); // Not implemented. 00306 void operator=(const vtkContextDevice2D &); // Not implemented. 00307 00308 //ETX 00309 }; 00310 00311 #endif //__vtkContextDevice2D_h