VTK
vtkGL2PSContextDevice2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGL2PSContextDevice2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
29 #ifndef vtkGL2PSContextDevice2D_h
30 #define vtkGL2PSContextDevice2D_h
31 
32 #include "vtkRenderingGL2PSModule.h" // For export macro
33 #include "vtkOpenGLContextDevice2D.h"
34 
35 class vtkPath;
36 
37 class VTKRENDERINGGL2PS_EXPORT vtkGL2PSContextDevice2D
39 {
40 public:
42  void PrintSelf(ostream &os, vtkIndent indent) override;
43 
44  static vtkGL2PSContextDevice2D *New();
45 
54  void DrawPoly(float *f, int n, unsigned char *colors = 0,
55  int nc_comps = 0) override;
56 
61  void DrawPoints(float *points, int n, unsigned char* colors = 0,
62  int nc_comps = 0) override;
63 
71  void DrawPointSprites(vtkImageData *sprite, float *points, int n,
72  unsigned char *colors = 0, int nc_comps = 0) override;
73 
77  void DrawQuadStrip(float *, int) override;
78 
82  void DrawPolygon(float *, int) override;
83 
95  void DrawEllipseWedge(float x, float y, float outRx, float outRy,
96  float inRx, float inRy, float startAngle,
97  float stopAngle) override;
98 
105  void DrawEllipticArc(float x, float y, float rX, float rY,
106  float startAngle, float stopAngle) override;
107 
119  void DrawMarkers(int shape, bool highlight, float *points, int n,
120  unsigned char *colors = 0, int nc_comps = 0) override;
121 
125  void DrawQuad(float *points, int n) override;
126 
130  void DrawString(float *point, const vtkStdString &string) override;
131 
135  void DrawString(float *point, const vtkUnicodeString &string) override;
136 
141  void DrawMathTextString(float point[2], const vtkStdString &string) override;
142 
148  void ApplyPen(vtkPen *pen) override;
149 
153  void SetPointSize(float size) override;
154 
158  void SetLineWidth(float width) override;
159 
163  void SetLineType(int type) override;
164 
165 protected:
167  ~vtkGL2PSContextDevice2D() override;
168 
169 private:
171  void operator=(const vtkGL2PSContextDevice2D &) = delete;
172 
173  void DrawCrossMarkers(bool highlight, float *points, int n,
174  unsigned char *colors, int nc_comps);
175  void DrawPlusMarkers(bool highlight, float *points, int n,
176  unsigned char *colors, int nc_comps);
177  void DrawSquareMarkers(bool highlight, float *points, int n,
178  unsigned char *colors, int nc_comps);
179  void DrawCircleMarkers(bool highlight, float *points, int n,
180  unsigned char *colors, int nc_comps);
181  void DrawDiamondMarkers(bool highlight, float *points, int n,
182  unsigned char *colors, int nc_comps);
183  void AddEllipseToPath(vtkPath *path, float x, float y, float rx, float ry,
184  bool reverse);
185 
186  // Transform the path using the current modelview matrix.
187  void TransformPath(vtkPath *path) const;
188 
189  // Transform the 2D point using the current modelview matrix.
190  void TransformPoint(float &x, float &y) const;
191 
192  // Transform the width and height from pixels to data units.
193  void TransformSize(float &dx, float &dy) const;
194 };
195 
196 #endif //vtkGL2PSContextDevice2D_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
void DrawPointSprites(vtkImageData *sprite, float *points, int n, unsigned char *colors=0, int nc_comps=0) override
Draw a series of point sprites, images centred at the points supplied.
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:35
Class for drawing 2D primitives using OpenGL 1.1+.
void SetLineType(int type) override
Set the line type type (using anonymous enum in vtkPen).
void DrawPoints(float *points, int n, unsigned char *colors=0, int nc_comps=0) override
Draw a series of points - fastest code path due to memory layout of the coordinates.
void TransformSize(float &dx, float &dy) const
Transform the width and height from pixels to data units.
void DrawEllipticArc(float x, float y, float rX, float rY, float startAngle, float stopAngle) override
Draw an elliptic arc with center at x,y with radii rX and rY between angles startAngle and stopAngle ...
static vtkOpenGLContextDevice2D * New()
Creates a 2D Painter object.
void SetLineWidth(float width) override
Set the line width for glyphs/sprites.
void DrawPoly(float *f, int n, unsigned char *colors=0, int nc_comps=0) override
Draw a poly line using the points - fastest code path due to memory layout of the coordinates.
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
Class for drawing 2D primitives using GL2PS.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:39
void DrawString(float *point, const vtkStdString &string) override
Draw some text to the screen!
void DrawQuadStrip(float *points, int n) override
Draws a rectangle.
void SetPointSize(float size) override
Set the point size for glyphs/sprites.
void TransformPath(vtkPath *path) const
Transform the path using the current modelview matrix.
void DrawMarkers(int shape, bool highlight, float *points, int n, unsigned char *colors=0, int nc_comps=0) override
Draw a series of markers centered at the points supplied.
void TransformPoint(float &x, float &y) const
Transform the 2D point using the current modelview matrix.
virtual void ApplyPen(vtkPen *pen)
Apply the supplied pen which controls the outlines of shapes, as well as lines, points and related pr...
void DrawQuad(float *points, int n) override
Draws a rectangle.
void DrawEllipseWedge(float x, float y, float outRx, float outRy, float inRx, float inRy, float startAngle, float stopAngle) override
Draw an elliptic wedge with center at x, y, outer radii outRx, outRy, inner radii inRx,...
void DrawPolygon(float *, int) override
Draw a polygon using the specified number of points.
void DrawMathTextString(float point[2], const vtkStdString &string) override
Draw text using MathText markup for mathematical equations.
void AddEllipseToPath(vtkPath *path, float x, float y, float rx, float ry, bool reverse)
Add an ellipse to a vtkPath.
String class that stores Unicode text.