VTK  9.0.1
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 "vtkOpenGLGL2PSHelper.h"
26 #include "vtkRenderingGL2PSOpenGL2Module.h" // For export macro
27 
28 class vtkMatrix4x4;
29 class vtkPoints;
30 
31 class VTKRENDERINGGL2PSOPENGL2_EXPORT vtkOpenGLGL2PSHelperImpl : public vtkOpenGLGL2PSHelper
32 {
33 public:
34  static vtkOpenGLGL2PSHelperImpl* New();
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
39  vtkTransformFeedback* tfc, vtkRenderer* ren, vtkActor* act) override;
41  vtkTransformFeedback* tfc, vtkRenderer* ren, unsigned char col[4]) override;
42  void ProcessTransformFeedback(vtkTransformFeedback* tfc, vtkRenderer* ren, float col[4]) override;
43 
44  void DrawString(const std::string& str, vtkTextProperty* tprop, double pos[3],
45  double backgroundDepth, vtkRenderer* ren) override;
46 
47  void DrawPath(vtkPath* path, double rasterPos[3], double windowPos[2], unsigned char rgba[4],
48  double scale[2] = nullptr, double rotateAngle = 0.0, float strokeWidth = -1,
49  const char* label = nullptr) override;
50 
51  void Draw3DPath(vtkPath* path, vtkMatrix4x4* actorMatrix, double rasterPos[3],
52  unsigned char actorColor[4], vtkRenderer* ren, const char* label = nullptr) override;
53 
54  void DrawImage(vtkImageData* image, double pos[3]) override;
55 
56 protected:
58  ~vtkOpenGLGL2PSHelperImpl() override;
59 
63  static const char* TextPropertyToPSFontName(vtkTextProperty* tprop);
64 
68  static int TextPropertyToGL2PSAlignment(vtkTextProperty* tprop);
69 
74  static void GetTransformParameters(vtkRenderer* ren, vtkMatrix4x4* actorMatrix,
75  vtkMatrix4x4* xform, double vpOrigin[2], double halfSize[2], double zfact[2]);
76 
78 
81  static void ProjectPoint(double point[3], vtkRenderer* ren, vtkMatrix4x4* actorMatrix = nullptr);
82  static void ProjectPoint(double point[4], vtkMatrix4x4* transformMatrix, double viewportOrigin[2],
83  double halfWidth, double halfHeight, double zfact1, double zfact2);
84  static void ProjectPoints(
85  vtkPoints* points, vtkRenderer* ren, vtkMatrix4x4* actorMatrix = nullptr);
87 
89 
93  static void UnprojectPoint(double point[4], vtkMatrix4x4* invTransformMatrix,
94  double viewportOrigin[2], double halfWidth, double halfHeight, double zfact1, double zfact2);
95  static void UnprojectPoints(
96  double* points3D, vtkIdType numPoints, vtkRenderer* ren, vtkMatrix4x4* actorMatrix = nullptr);
98 
99  void DrawPathPS(vtkPath* path, double rasterPos[3], double windowPos[2], unsigned char rgba[4],
100  double scale[2], double rotateAngle, float strokeWidth, const std::string& label);
101  void DrawPathPDF(vtkPath* path, double rasterPos[3], double windowPos[2], unsigned char rgba[4],
102  double scale[2], double rotateAngle, float strokeWidth, const std::string& label);
103  void DrawPathSVG(vtkPath* path, double rasterPos[3], double windowPos[2], unsigned char rgba[4],
104  double scale[2], double rotateAngle, float strokeWidth, const std::string& label);
105 
106 private:
108  void operator=(const vtkOpenGLGL2PSHelperImpl&) = delete;
109 };
110 
111 #endif // vtkOpenGLGL2PSHelperImpl_h
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkOpenGLGL2PSHelper::DrawImage
virtual void DrawImage(vtkImageData *image, double pos[3])=0
Draw the image at pos.
vtkOpenGLGL2PSHelper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkIdType
int vtkIdType
Definition: vtkType.h:338
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
@ image
Definition: vtkX3D.h:380
vtkPath
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:32
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
@ points
Definition: vtkX3D.h:452
vtkX3D::point
@ point
Definition: vtkX3D.h:242
vtkOpenGLGL2PSHelper.h
vtkOpenGLGL2PSHelper::New
static vtkOpenGLGL2PSHelper * New()
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
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