VTK
dox/Charts/vtkContextDevice2D.h
Go to the documentation of this file.
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 "vtkObject.h"
00029 
00030 class vtkWindow;
00031 class vtkViewport;
00032 class vtkStdString;
00033 class vtkUnicodeString;
00034 class vtkTextProperty;
00035 class vtkPoints2D;
00036 class vtkImageData;
00037 class vtkMatrix3x3;
00038 class vtkAbstractContextBufferId;
00039 class vtkPen;
00040 class vtkBrush;
00041 class vtkRectf;
00042 
00043 class VTK_CHARTS_EXPORT vtkContextDevice2D : public vtkObject
00044 {
00045 public:
00046   vtkTypeMacro(vtkContextDevice2D, vtkObject);
00047   virtual void PrintSelf(ostream &os, vtkIndent indent);
00048 
00050 
00054   virtual void DrawPoly(float *points, int n,
00055                         unsigned char *colors = 0, int nc_comps = 0) = 0;
00057 
00059 
00061   virtual void DrawPoints(float *points, int n, unsigned char* colors = 0,
00062                           int nc_comps = 0) = 0;
00064 
00066 
00071   virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n,
00072                                 unsigned char *colors = 0, int nc_comps = 0) = 0;
00074 
00076   virtual void DrawQuad(float *, int) { ; }
00077 
00079   virtual void DrawQuadStrip(float *, int) { ; }
00080 
00082   virtual void DrawPolygon(float *, int) { ; }
00083 
00085 
00091   virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy,
00092                                 float inRx, float inRy, float startAngle,
00093                                 float stopAngle)=0;
00095 
00097 
00100   virtual void DrawEllipticArc(float x, float y, float rX, float rY,
00101                                float startAngle, float stopAngle)=0;
00103 
00105   virtual void DrawString(float *point, const vtkStdString &string) = 0;
00106 
00108 
00113   virtual void ComputeStringBounds(const vtkStdString &string,
00114                                    float bounds[4]) = 0;
00116 
00118   virtual void DrawString(float *point, const vtkUnicodeString &string) = 0;
00119 
00121 
00126   virtual void ComputeStringBounds(const vtkUnicodeString &string,
00127                                    float bounds[4]) = 0;
00129 
00132   virtual void DrawImage(float p[2], float scale, vtkImageData *image) = 0;
00133 
00137   virtual void DrawImage(const vtkRectf& pos, vtkImageData *image) = 0;
00138 
00143   void ApplyPen(vtkPen *pen);
00144 
00146 
00149   vtkGetObjectMacro(Pen, vtkPen);
00151 
00156   void ApplyBrush(vtkBrush *brush);
00157 
00159 
00161   vtkGetObjectMacro(Brush, vtkBrush);
00163 
00167   void ApplyTextProp(vtkTextProperty *prop);
00168 
00170 
00171   vtkGetObjectMacro(TextProp, vtkTextProperty);
00173 
00175   virtual void SetColor4(unsigned char color[4]) = 0;
00176 
00177   enum TextureProperty {
00178     Nearest = 0x01,
00179     Linear  = 0x02,
00180     Stretch = 0x04,
00181     Repeat  = 0x08
00182   };
00184   virtual void SetTexture(vtkImageData* image, int properties) = 0;
00185 
00187   virtual void SetPointSize(float size) = 0;
00188 
00190   virtual void SetLineWidth(float width) = 0;
00191 
00193   virtual void SetLineType(int type) = 0;
00194 
00196   virtual int GetWidth() { return this->Geometry[0]; }
00197 
00199   virtual int GetHeight() { return this->Geometry[1]; }
00200 
00202   virtual void SetMatrix(vtkMatrix3x3 *m) = 0;
00203 
00205   virtual void GetMatrix(vtkMatrix3x3 *m) = 0;
00206 
00208   virtual void MultiplyMatrix(vtkMatrix3x3 *m) = 0;
00209 
00211   virtual void PushMatrix() = 0;
00212 
00214   virtual void PopMatrix() = 0;
00215 
00218   virtual void SetClipping(int *x) = 0;
00219 
00222   virtual void DisableClipping() { this->EnableClipping(false); }
00223 
00225   virtual void EnableClipping(bool enable) = 0;
00226 
00228   virtual void Begin(vtkViewport*) { }
00229 
00231   virtual void End() { }
00232 
00235   virtual bool GetBufferIdMode() const;
00236 
00237 //BTX
00239 
00242   virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId);
00243 //ETX
00245 
00249   virtual void BufferIdModeEnd();
00250 
00251 //BTX
00252 protected:
00253   vtkContextDevice2D();
00254   virtual ~vtkContextDevice2D();
00255 
00257   int Geometry[2];
00258 
00259   vtkAbstractContextBufferId *BufferId;
00260 
00261   vtkPen *Pen;                // Outlining
00262   vtkBrush *Brush;            // Fills
00263   vtkTextProperty *TextProp;  // Text property
00264 
00265 private:
00266   vtkContextDevice2D(const vtkContextDevice2D &); // Not implemented.
00267   void operator=(const vtkContextDevice2D &);   // Not implemented.
00268 
00269 //ETX
00270 };
00271 
00272 #endif //__vtkContextDevice2D_h