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 00053 static vtkContextDevice2D * New(); 00054 00056 00060 virtual void DrawPoly(float *points, int n, 00061 unsigned char *colors = 0, int nc_comps = 0) = 0; 00063 00065 00067 virtual void DrawPoints(float *points, int n, unsigned char* colors = 0, 00068 int nc_comps = 0) = 0; 00070 00072 00077 virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n, 00078 unsigned char *colors = 0, int nc_comps = 0) = 0; 00080 00082 00088 virtual void DrawMarkers(int shape, bool highlight, float *points, int n, 00089 unsigned char *colors = 0, int nc_comps = 0); 00091 00093 virtual void DrawQuad(float *, int) { ; } 00094 00096 virtual void DrawQuadStrip(float *, int) { ; } 00097 00099 virtual void DrawPolygon(float *, int) { ; } 00100 00102 00108 virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy, 00109 float inRx, float inRy, float startAngle, 00110 float stopAngle)=0; 00112 00114 00117 virtual void DrawEllipticArc(float x, float y, float rX, float rY, 00118 float startAngle, float stopAngle)=0; 00120 00122 virtual void DrawString(float *point, const vtkStdString &string) = 0; 00123 00125 00130 virtual void ComputeStringBounds(const vtkStdString &string, 00131 float bounds[4]) = 0; 00133 00135 virtual void DrawString(float *point, const vtkUnicodeString &string) = 0; 00136 00138 00143 virtual void ComputeStringBounds(const vtkUnicodeString &string, 00144 float bounds[4]) = 0; 00146 00150 virtual void DrawMathTextString(float *point, const vtkStdString &string) = 0; 00151 00153 virtual bool MathTextIsSupported(); 00154 00157 virtual void DrawImage(float p[2], float scale, vtkImageData *image) = 0; 00158 00162 virtual void DrawImage(const vtkRectf& pos, vtkImageData *image) = 0; 00163 00168 void ApplyPen(vtkPen *pen); 00169 00171 00174 vtkGetObjectMacro(Pen, vtkPen); 00176 00181 void ApplyBrush(vtkBrush *brush); 00182 00184 00186 vtkGetObjectMacro(Brush, vtkBrush); 00188 00192 void ApplyTextProp(vtkTextProperty *prop); 00193 00195 00196 vtkGetObjectMacro(TextProp, vtkTextProperty); 00198 00200 virtual void SetColor4(unsigned char color[4]) = 0; 00201 00202 enum TextureProperty { 00203 Nearest = 0x01, 00204 Linear = 0x02, 00205 Stretch = 0x04, 00206 Repeat = 0x08 00207 }; 00209 virtual void SetTexture(vtkImageData* image, int properties) = 0; 00210 00212 virtual void SetPointSize(float size) = 0; 00213 00215 virtual void SetLineWidth(float width) = 0; 00216 00218 virtual void SetLineType(int type) = 0; 00219 00221 virtual int GetWidth() { return this->Geometry[0]; } 00222 00224 virtual int GetHeight() { return this->Geometry[1]; } 00225 00227 virtual void SetMatrix(vtkMatrix3x3 *m) = 0; 00228 00230 virtual void GetMatrix(vtkMatrix3x3 *m) = 0; 00231 00233 virtual void MultiplyMatrix(vtkMatrix3x3 *m) = 0; 00234 00236 virtual void PushMatrix() = 0; 00237 00239 virtual void PopMatrix() = 0; 00240 00243 virtual void SetClipping(int *x) = 0; 00244 00247 virtual void DisableClipping() { this->EnableClipping(false); } 00248 00250 virtual void EnableClipping(bool enable) = 0; 00251 00253 virtual void Begin(vtkViewport*) { } 00254 00256 virtual void End() { } 00257 00260 virtual bool GetBufferIdMode() const; 00261 00262 //BTX 00264 00267 virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId); 00268 //ETX 00270 00274 virtual void BufferIdModeEnd(); 00275 00276 virtual void SetViewportSize(const vtkVector2i &size) 00277 { 00278 this->ViewportSize = size; 00279 } 00280 00281 virtual void SetViewportRect(const vtkRecti &rect) 00282 { 00283 this->ViewportRect = rect; 00284 } 00285 00286 //BTX 00287 protected: 00288 vtkContextDevice2D(); 00289 ~vtkContextDevice2D(); 00290 00292 int Geometry[2]; 00293 00295 vtkVector2i ViewportSize; 00296 00298 vtkRecti ViewportRect; 00299 00300 vtkAbstractContextBufferId *BufferId; 00301 00302 vtkPen *Pen; // Outlining 00303 vtkBrush *Brush; // Fills 00304 vtkTextProperty *TextProp; // Text property 00305 00306 private: 00307 vtkContextDevice2D(const vtkContextDevice2D &); // Not implemented. 00308 void operator=(const vtkContextDevice2D &); // Not implemented. 00309 00310 //ETX 00311 }; 00312 00313 #endif //vtkContextDevice2D_h