00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00029 #ifndef __vtkContext2D_h
00030 #define __vtkContext2D_h
00031
00032 #include "vtkObject.h"
00033
00034 class vtkWindow;
00035
00036 class vtkStdString;
00037 class vtkTextProperty;
00038
00039 class vtkPoints2D;
00040 class vtkContextDevice2D;
00041 class vtkPen;
00042 class vtkBrush;
00043 class vtkImageData;
00044 class vtkTransform2D;
00045 class vtkContextBufferId;
00046
00047 class VTK_CHARTS_EXPORT vtkContext2D : public vtkObject
00048 {
00049 public:
00050 vtkTypeRevisionMacro(vtkContext2D, vtkObject);
00051 virtual void PrintSelf(ostream &os, vtkIndent indent);
00052
00054 static vtkContext2D *New();
00055
00059 bool Begin(vtkContextDevice2D *device);
00060
00061 vtkGetObjectMacro(Device, vtkContextDevice2D);
00062
00066 bool End();
00067
00070 bool GetBufferIdMode() const;
00071
00074 void BufferIdModeBegin(vtkContextBufferId *bufferId);
00075
00079 void BufferIdModeEnd();
00080
00082 void DrawLine(float x1, float y1, float x2, float y2);
00083
00085 void DrawLine(float p[4]);
00086
00089 void DrawLine(vtkPoints2D *points);
00090
00092 void DrawPoly(float *x, float *y, int n);
00093
00096 void DrawPoly(vtkPoints2D *points);
00097
00101 void DrawPoly(float *points, int n);
00102
00104 void DrawPoint(float x, float y);
00105
00107 void DrawPoints(float *x, float *y, int n);
00108
00111 void DrawPoints(vtkPoints2D *points);
00112
00116 void DrawPoints(float *points, int n);
00117
00121 void DrawPointSprites(vtkImageData *sprite, vtkPoints2D *points);
00122
00126 void DrawPointSprites(vtkImageData *sprite, float *points, int n);
00127
00129 void DrawRect(float x, float y, float w, float h);
00130
00132
00134 void DrawQuad(float x1, float y1, float x2, float y2,
00135 float x3, float y3, float x4, float y4);
00136 void DrawQuad(float *p);
00138
00141 void DrawEllipse(float x, float y, float rx, float ry);
00142
00144
00149 void DrawWedge(float x, float y, float outRadius,
00150 float inRadius,float startAngle,
00151 float stopAngle);
00153
00155
00161 void DrawEllipseWedge(float x, float y, float outRx, float outRy,
00162 float inRx, float inRy, float startAngle,
00163 float stopAngle);
00165
00166
00168
00171 void DrawArc(float x, float y, float r, float startAngle,
00172 float stopAngle);
00174
00176
00179 void DrawEllipticArc(float x, float y, float rX, float rY, float startAngle,
00180 float stopAngle);
00182
00183
00185 void DrawImage(float x, float y, vtkImageData *image);
00186
00187
00191 void DrawStringRect(vtkPoints2D *rect, const vtkStdString &string);
00192
00194
00195 void DrawString(vtkPoints2D *point, const vtkStdString &string);
00196 void DrawString(float x, float y, const vtkStdString &string);
00198
00199 void DrawString(vtkPoints2D *point, const char *string);
00200 void DrawString(float x, float y, const char *string);
00201
00202
00204
00209 void ComputeStringBounds(const vtkStdString &string, vtkPoints2D *bounds);
00210 void ComputeStringBounds(const vtkStdString &string, float bounds[4]);
00212
00213 void ComputeStringBounds(const char *string, float bounds[4]);
00214
00219 void ApplyPen(vtkPen *pen);
00220
00222
00225 vtkGetObjectMacro(Pen, vtkPen);
00227
00232 void ApplyBrush(vtkBrush *brush);
00233
00235
00237 vtkGetObjectMacro(Brush, vtkBrush);
00239
00243 void ApplyTextProp(vtkTextProperty *prop);
00244
00246
00247 vtkGetObjectMacro(TextProp, vtkTextProperty);
00249
00251
00254 void SetTransform(vtkTransform2D *transform);
00255 vtkGetObjectMacro(Transform, vtkTransform2D);
00257
00262 void AppendTransform(vtkTransform2D *transform);
00263
00265
00267 void PushMatrix();
00268 void PopMatrix();
00270
00272 void ApplyId(vtkIdType id);
00273
00274
00275 protected:
00276 vtkContext2D();
00277 ~vtkContext2D();
00278
00279 vtkContextDevice2D *Device;
00280 vtkPen *Pen;
00281 vtkBrush *Brush;
00282 vtkTextProperty *TextProp;
00283 vtkTransform2D *Transform;
00284
00285 vtkContextBufferId *BufferId;
00286
00287 private:
00288 vtkContext2D(const vtkContext2D &);
00289 void operator=(const vtkContext2D &);
00290
00291
00292 void ApplyPen();
00293
00294 void ApplyBrush();
00295
00296
00297 };
00298
00299 #endif //__vtkContext2D_h