VTK  9.7.1
vtkTextActor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
29 #ifndef vtkTextActor_h
30 #define vtkTextActor_h
31 
32 #include "vtkRenderingCoreModule.h" // For export macro
33 #include "vtkTexturedActor2D.h"
34 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
35 
36 #include "vtkDeprecation.h" // For deprecation macro
37 
38 VTK_ABI_NAMESPACE_BEGIN
39 class vtkImageData;
40 class vtkPoints;
41 class vtkPolyData;
43 class vtkProperty2D;
44 class vtkTextProperty;
45 class vtkTextRenderer;
46 class vtkTransform;
47 
48 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextActor : public vtkTexturedActor2D
49 {
50 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
58  static vtkTextActor* New();
59 
64  void ShallowCopy(vtkProp* prop) override;
65 
67 
73  void SetInput(const char* inputString);
74  char* GetInput();
76 
78 
83  vtkSetVector2Macro(MinimumSize, int);
84  vtkGetVector2Macro(MinimumSize, int);
86 
88 
94  vtkSetMacro(MaximumLineHeight, float);
95  vtkGetMacro(MaximumLineHeight, float);
97 
99 
108  vtkSetClampMacro(TextScaleMode, int, TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
109  vtkGetMacro(TextScaleMode, int);
110  void SetTextScaleModeToNone() { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
111  void SetTextScaleModeToProp() { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
112  void SetTextScaleModeToViewport() { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
114 
115  enum
116  {
117  TEXT_SCALE_MODE_NONE = 0,
119  TEXT_SCALE_MODE_VIEWPORT
120  };
121 
123 
128  vtkSetMacro(UseBorderAlign, vtkTypeBool);
129  vtkGetMacro(UseBorderAlign, vtkTypeBool);
130  vtkBooleanMacro(UseBorderAlign, vtkTypeBool);
132 
134 
150  VTK_DEPRECATED_IN_9_6_0("Please use vtkTextProperty Justification instead.")
151  void SetAlignmentPoint(int point);
153  VTK_DEPRECATED_IN_9_6_0("Please use vtkTextProperty Justification instead.")
154  int GetAlignmentPoint();
156 
158 
165  void SetOrientation(float orientation);
166  vtkGetMacro(Orientation, float);
168 
170 
173  virtual void SetTextProperty(vtkTextProperty* p);
174  vtkGetObjectMacro(TextProperty, vtkTextProperty);
176 
182  virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
183 
187  virtual void GetSize(vtkViewport* vport, double size[2]);
188 
190 
195  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
196  static int SetConstrainedFontSize(vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
198 
205  static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
206  vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
207 
217  virtual void SetNonLinearFontScale(double exponent, int target);
218 
220 
223  vtkGetMacro(FontScaleExponent, double);
224  vtkSetMacro(FontScaleExponent, double);
226 
231  void SpecifiedToDisplay(double* pos, vtkViewport* vport, int specified);
232 
237  void DisplayToSpecified(double* pos, vtkViewport* vport, int specified);
238 
243  virtual void ComputeScaledFont(vtkViewport* viewport);
244 
246 
250  vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
252 
260  static float GetFontScale(vtkViewport* viewport);
261 
269  void ReleaseGraphicsResources(vtkWindow*) override;
270 
272 
277  int RenderOpaqueGeometry(vtkViewport* viewport) override;
278  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
279  int RenderOverlay(vtkViewport* viewport) override;
281 
286 
287 protected:
291  virtual bool RenderImage(vtkTextProperty* tprop, vtkViewport* viewport);
292 
296  virtual bool GetImageBoundingBox(vtkTextProperty* tprop, vtkViewport* viewport, int bbox[4]);
297 
298  vtkTextActor();
299  ~vtkTextActor() override;
300 
301  int MinimumSize[2];
305  float Orientation;
307 
313  int LastSize[2];
314  int LastOrigin[2];
315  char* Input;
319 
321 
322  // Stuff needed to display the image text as a texture map.
325 
326  virtual void ComputeRectangle(vtkViewport* viewport);
327 
341  virtual int UpdateRectangle(vtkViewport* viewport);
342 
343 private:
344  vtkTextActor(const vtkTextActor&) = delete;
345  void operator=(const vtkTextActor&) = delete;
346 };
347 
348 VTK_ABI_NAMESPACE_END
349 #endif
bool InputRendered
Definition: vtkTextActor.h:316
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
actor that draws 2D data with texture support
vtkPolyData * Rectangle
Definition: vtkTextActor.h:323
void SetTextScaleModeToViewport()
Set how text should be scaled.
Definition: vtkTextActor.h:112
abstract specification for Viewports
Definition: vtkViewport.h:46
record modification and/or execution time
Definition: vtkTimeStamp.h:24
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:324
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:320
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
vtkImageData * ImageData
Definition: vtkTextActor.h:309
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
An actor that displays text.
Definition: vtkTextActor.h:48
double FontScaleExponent
Definition: vtkTextActor.h:303
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:311
#define VTK_DEPRECATED_IN_9_6_0(reason)
vtkTransform * Transform
Definition: vtkTextActor.h:312
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
void SetTextScaleModeToProp()
Set how text should be scaled.
Definition: vtkTextActor.h:111
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
float Orientation
Definition: vtkTextActor.h:305
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:310
represent text properties.
void SetTextScaleModeToNone()
Set how text should be scaled.
Definition: vtkTextActor.h:110
#define VTK_MARSHALEXCLUDE(reason)
float MaximumLineHeight
Definition: vtkTextActor.h:302
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
Interface for generating images and path data from string data, using multiple backends.
vtkTextProperty * TextProperty
Definition: vtkTextActor.h:308
represent surface properties of a 2D image
Definition: vtkProperty2D.h:30
#define VTK_MARSHALAUTO
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
static vtkTexturedActor2D * New()
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkTexturedActor2D.
vtkTypeBool UseBorderAlign
Definition: vtkTextActor.h:306
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:30
double FormerOrientation
Definition: vtkTextActor.h:317