VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkContext2D.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 __vtkContext2D_h 00033 #define __vtkContext2D_h 00034 00035 #include "vtkObject.h" 00036 00037 class vtkWindow; 00038 00039 class vtkStdString; 00040 class vtkTextProperty; 00041 00042 class vtkPoints2D; 00043 class vtkContextDevice2D; 00044 class vtkPen; 00045 class vtkBrush; 00046 class vtkImageData; 00047 class vtkTransform2D; 00048 class vtkAbstractContextBufferId; 00049 00050 class VTK_CHARTS_EXPORT vtkContext2D : public vtkObject 00051 { 00052 public: 00053 vtkTypeMacro(vtkContext2D, vtkObject); 00054 virtual void PrintSelf(ostream &os, vtkIndent indent); 00055 00057 static vtkContext2D *New(); 00058 00062 bool Begin(vtkContextDevice2D *device); 00063 00064 vtkGetObjectMacro(Device, vtkContextDevice2D); 00065 00069 bool End(); 00070 00073 bool GetBufferIdMode() const; 00074 00077 void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId); 00078 00082 void BufferIdModeEnd(); 00083 00085 void DrawLine(float x1, float y1, float x2, float y2); 00086 00088 void DrawLine(float p[4]); 00089 00092 void DrawLine(vtkPoints2D *points); 00093 00095 void DrawPoly(float *x, float *y, int n); 00096 00099 void DrawPoly(vtkPoints2D *points); 00100 00104 void DrawPoly(float *points, int n); 00105 00107 void DrawPoint(float x, float y); 00108 00110 void DrawPoints(float *x, float *y, int n); 00111 00114 void DrawPoints(vtkPoints2D *points); 00115 00119 void DrawPoints(float *points, int n); 00120 00124 void DrawPointSprites(vtkImageData *sprite, vtkPoints2D *points); 00125 00129 void DrawPointSprites(vtkImageData *sprite, float *points, int n); 00130 00132 void DrawRect(float x, float y, float w, float h); 00133 00135 00137 void DrawQuad(float x1, float y1, float x2, float y2, 00138 float x3, float y3, float x4, float y4); 00139 void DrawQuad(float *p); 00141 00144 void DrawEllipse(float x, float y, float rx, float ry); 00145 00147 00152 void DrawWedge(float x, float y, float outRadius, 00153 float inRadius,float startAngle, 00154 float stopAngle); 00156 00158 00164 void DrawEllipseWedge(float x, float y, float outRx, float outRy, 00165 float inRx, float inRy, float startAngle, 00166 float stopAngle); 00168 00169 00171 00174 void DrawArc(float x, float y, float r, float startAngle, 00175 float stopAngle); 00177 00179 00182 void DrawEllipticArc(float x, float y, float rX, float rY, float startAngle, 00183 float stopAngle); 00185 00186 00188 void DrawImage(float x, float y, vtkImageData *image); 00189 00190 //BTX 00194 void DrawStringRect(vtkPoints2D *rect, const vtkStdString &string); 00195 00197 00198 void DrawString(vtkPoints2D *point, const vtkStdString &string); 00199 void DrawString(float x, float y, const vtkStdString &string); 00201 //ETX 00202 void DrawString(vtkPoints2D *point, const char *string); 00203 void DrawString(float x, float y, const char *string); 00204 00205 //BTX 00207 00212 void ComputeStringBounds(const vtkStdString &string, vtkPoints2D *bounds); 00213 void ComputeStringBounds(const vtkStdString &string, float bounds[4]); 00215 //ETX 00216 void ComputeStringBounds(const char *string, float bounds[4]); 00217 00222 void ApplyPen(vtkPen *pen); 00223 00225 00228 vtkGetObjectMacro(Pen, vtkPen); 00230 00235 void ApplyBrush(vtkBrush *brush); 00236 00238 00240 vtkGetObjectMacro(Brush, vtkBrush); 00242 00246 void ApplyTextProp(vtkTextProperty *prop); 00247 00249 00250 vtkGetObjectMacro(TextProp, vtkTextProperty); 00252 00254 00257 void SetTransform(vtkTransform2D *transform); 00258 vtkGetObjectMacro(Transform, vtkTransform2D); 00260 00265 void AppendTransform(vtkTransform2D *transform); 00266 00268 00270 void PushMatrix(); 00271 void PopMatrix(); 00273 00275 void ApplyId(vtkIdType id); 00276 00277 //BTX 00278 protected: 00279 vtkContext2D(); 00280 ~vtkContext2D(); 00281 00282 vtkContextDevice2D *Device; // The underlying device 00283 vtkPen *Pen; // Outlining 00284 vtkBrush *Brush; // Fills 00285 vtkTextProperty *TextProp; // Text property 00286 vtkTransform2D *Transform; // The painter transform 00287 00288 vtkAbstractContextBufferId *BufferId; 00289 00290 private: 00291 vtkContext2D(const vtkContext2D &); // Not implemented. 00292 void operator=(const vtkContext2D &); // Not implemented. 00293 00294 // Apply the pen settings to the context 00295 void ApplyPen(); 00296 // Apply the brush settings to the context 00297 void ApplyBrush(); 00298 00299 //ETX 00300 }; 00301 00302 #endif //__vtkContext2D_h