VTK
vtkOpenGLGL2PSHelperImpl.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLGL2PSHelperImpl.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 
22 #ifndef vtkOpenGLGL2PSHelperImpl_h
23 #define vtkOpenGLGL2PSHelperImpl_h
24 
25 #include "vtkRenderingGL2PSOpenGL2Module.h" // For export macro
26 #include "vtkOpenGLGL2PSHelper.h"
27 
28 class vtkMatrix4x4;
29 class vtkPoints;
30 
31 class VTKRENDERINGGL2PSOPENGL2_EXPORT vtkOpenGLGL2PSHelperImpl
32  : public vtkOpenGLGL2PSHelper
33 {
34 public:
35  static vtkOpenGLGL2PSHelperImpl *New();
37  void PrintSelf(ostream &os, vtkIndent indent) override;
38 
40  vtkRenderer *ren, vtkActor *act) override;
42  vtkRenderer *ren,
43  unsigned char col[4]) override;
45  vtkRenderer *ren,
46  float col[4]) override;
47 
48  void DrawString(const std::string &str, vtkTextProperty *tprop,
49  double pos[3], double backgroundDepth,
50  vtkRenderer *ren) override;
51 
52  void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2],
53  unsigned char rgba[4], double scale[2] = nullptr,
54  double rotateAngle = 0.0, float strokeWidth = -1,
55  const char *label = nullptr) override;
56 
57  void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix,
58  double rasterPos[3], unsigned char actorColor[4],
59  vtkRenderer *ren, const char *label = nullptr) override;
60 
61  void DrawImage(vtkImageData *image, double pos[3]) override;
62 
63 protected:
65  ~vtkOpenGLGL2PSHelperImpl() override;
66 
70  static const char* TextPropertyToPSFontName(vtkTextProperty *tprop);
71 
75  static int TextPropertyToGL2PSAlignment(vtkTextProperty *tprop);
76 
81  static void GetTransformParameters(vtkRenderer *ren,
82  vtkMatrix4x4 *actorMatrix,
83  vtkMatrix4x4 *xform, double vpOrigin[2],
84  double halfSize[2], double zfact[2]);
85 
87 
90  static void ProjectPoint(double point[3], vtkRenderer *ren,
91  vtkMatrix4x4 *actorMatrix = nullptr);
92  static void ProjectPoint(double point[4], vtkMatrix4x4 *transformMatrix,
93  double viewportOrigin[2], double halfWidth,
94  double halfHeight, double zfact1, double zfact2);
95  static void ProjectPoints(vtkPoints *points, vtkRenderer *ren,
96  vtkMatrix4x4 *actorMatrix = nullptr);
98 
100 
104  static void UnprojectPoint(double point[4], vtkMatrix4x4 *invTransformMatrix,
105  double viewportOrigin[2], double halfWidth,
106  double halfHeight, double zfact1, double zfact2);
107  static void UnprojectPoints(double *points3D, vtkIdType numPoints,
108  vtkRenderer *ren,
109  vtkMatrix4x4 *actorMatrix = nullptr);
111 
112  void DrawPathPS(vtkPath *path, double rasterPos[3], double windowPos[2],
113  unsigned char rgba[4], double scale[2], double rotateAngle,
114  float strokeWidth, const std::string &label);
115  void DrawPathPDF(vtkPath *path, double rasterPos[3], double windowPos[2],
116  unsigned char rgba[4], double scale[2], double rotateAngle,
117  float strokeWidth, const std::string &label);
118  void DrawPathSVG(vtkPath *path, double rasterPos[3], double windowPos[2],
119  unsigned char rgba[4], double scale[2], double rotateAngle,
120  float strokeWidth, const std::string &label);
121 
122 private:
124  void operator=(const vtkOpenGLGL2PSHelperImpl &) = delete;
125 };
126 
127 #endif // vtkOpenGLGL2PSHelperImpl_h
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkOpenGLGL2PSHelper::DrawImage
virtual void DrawImage(vtkImageData *image, double pos[3])=0
Draw the image at pos.
vtkX3D::scale
Definition: vtkX3D.h:229
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkOpenGLGL2PSHelper::DrawString
virtual void DrawString(const std::string &str, vtkTextProperty *tprop, double pos[3], double backgroundDepth, vtkRenderer *ren)=0
Format the text in str according to tprop and instruct GL2PS to draw it at pixel coordinate pos.
vtkX3D::image
Definition: vtkX3D.h:374
vtkPath
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:35
vtkOpenGLGL2PSHelper::ProcessTransformFeedback
virtual void ProcessTransformFeedback(vtkTransformFeedback *tfc, vtkRenderer *ren, vtkActor *act)=0
Parse the vertex information in tfc and inject primitives into GL2PS.
vtkOpenGLGL2PSHelper::Draw3DPath
virtual void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix, double rasterPos[3], unsigned char actorColor[4], vtkRenderer *ren, const char *label=nullptr)=0
Transform the path using the actor's matrix and current GL state, then draw it to GL2PS.
vtkX3D::points
Definition: vtkX3D.h:446
vtkX3D::point
Definition: vtkX3D.h:236
vtkOpenGLGL2PSHelper.h
vtkOpenGLGL2PSHelper::New
static vtkOpenGLGL2PSHelper * New()
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkX3D::string
Definition: vtkX3D.h:490
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkOpenGLGL2PSHelper
Access GL2PS functionality.
Definition: vtkOpenGLGL2PSHelper.h:43
vtkOpenGLGL2PSHelperImpl
vtkOpenGLGL2PSHelper override implementation.
Definition: vtkOpenGLGL2PSHelperImpl.h:31
vtkOpenGLGL2PSHelper::DrawPath
virtual void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2]=nullptr, double rotateAngle=0.0, float strokeWidth=-1, const char *label=nullptr)=0
Generate PS, EPS, or SVG markup from a vtkPath object, and then inject it into the output using the g...
vtkTransformFeedback
Manages a TransformFeedback buffer.
Definition: vtkTransformFeedback.h:40