VTK  9.6.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
28
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
38VTK_ABI_NAMESPACE_BEGIN
39class vtkImageData;
40class vtkPoints;
41class vtkPolyData;
43class vtkProperty2D;
44class vtkTextProperty;
45class vtkTextRenderer;
46class vtkTransform;
47
48class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextActor : public vtkTexturedActor2D
49{
50public:
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
109 vtkGetMacro(TextScaleMode, int);
114
115 enum
116 {
120 };
121
123
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.")
156
158
165 void SetOrientation(float orientation);
166 vtkGetMacro(Orientation, float);
168
170
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
252
260 static float GetFontScale(vtkViewport* viewport);
261
270
272
277 int RenderOpaqueGeometry(vtkViewport* viewport) override;
279 int RenderOverlay(vtkViewport* viewport) override;
281
286
287protected:
291 virtual bool RenderImage(vtkTextProperty* tprop, vtkViewport* viewport);
292
296 virtual bool GetImageBoundingBox(vtkTextProperty* tprop, vtkViewport* viewport, int bbox[4]);
297
299 ~vtkTextActor() override;
300
307
313 int LastSize[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
343private:
344 vtkTextActor(const vtkTextActor&) = delete;
345 void operator=(const vtkTextActor&) = delete;
346};
347
348VTK_ABI_NAMESPACE_END
349#endif
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
represent and manipulate 3D points
Definition vtkPoints.h:30
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
represent surface properties of a 2D image
vtkTextProperty * TextProperty
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
static vtkTextActor * New()
Instantiate object with a rectangle in normaled view coordinates of (0.2,0.85, 0.8,...
int GetAlignmentPoint()
This method is being deprecated.
double FormerOrientation
void SetOrientation(float orientation)
Counterclockwise rotation around the Alignment point.
float MaximumLineHeight
void ShallowCopy(vtkProp *prop) override
Shallow copy of this text actor.
int RenderOverlay(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
virtual bool RenderImage(vtkTextProperty *tprop, vtkViewport *viewport)
Render Input to Image using the supplied font property.
vtkTransform * Transform
vtkTextProperty * ScaledTextProperty
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
char * GetInput()
Set the text string to be displayed.
void SetInput(const char *inputString)
Set the text string to be displayed.
virtual int UpdateRectangle(vtkViewport *viewport)
Ensure that Rectangle and RectanglePoints are valid and up-to-date.
void SetAlignmentPoint(int point)
This method is being deprecated.
virtual bool GetImageBoundingBox(vtkTextProperty *tprop, vtkViewport *viewport, int bbox[4])
Get the bounding box for Input using the supplied font property.
~vtkTextActor() override
int LastOrigin[2]
vtkImageData * ImageData
vtkTextRenderer * TextRenderer
vtkPolyData * Rectangle
vtkTimeStamp BuildTime
virtual void ComputeRectangle(vtkViewport *viewport)
double FontScaleExponent
void SetTextScaleModeToProp()
Set how text should be scaled.
virtual void SetNonLinearFontScale(double exponent, int target)
Enable non-linear scaling of font sizes.
virtual void GetSize(vtkViewport *vport, double size[2])
Syntactic sugar to get the size of text instead of the entire bounding box.
void SetTextScaleModeToViewport()
Set how text should be scaled.
vtkPoints * RectanglePoints
virtual void SetTextScaleMode(int)
Set how text should be scaled.
static float GetFontScale(vtkViewport *viewport)
Provide a font scaling based on a viewport.
virtual void SetTextProperty(vtkTextProperty *p)
Set/Get the text property.
vtkTypeBool UseBorderAlign
virtual int SetConstrainedFontSize(vtkViewport *, int targetWidth, int targetHeight)
Set and return the font size required to make this mapper fit in a given target rectangle (width x he...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetTextScaleModeToNone()
Set how text should be scaled.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
static int SetMultipleConstrainedFontSize(vtkViewport *, int targetWidth, int targetHeight, vtkTextActor **actors, int nbOfActors, int *maxResultingSize)
Set and return the font size required to make each element of an array of mappers fit in a given rect...
int MinimumSize[2]
void SpecifiedToDisplay(double *pos, vtkViewport *vport, int specified)
This is just a simple coordinate conversion method used in the render process.
void DisplayToSpecified(double *pos, vtkViewport *vport, int specified)
This is just a simple coordinate conversion method used in the render process.
virtual void ComputeScaledFont(vtkViewport *viewport)
Compute the scale the font should be given the viewport.
virtual void GetBoundingBox(vtkViewport *vport, double bbox[4])
Return the bounding box coordinates of the text in pixels.
represent text properties.
Interface for generating images and path data from string data, using multiple backends.
record modification and/or execution time
describes linear transformations via a 4x4 matrix
abstract specification for Viewports
Definition vtkViewport.h:47
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_DEPRECATED_IN_9_6_0(reason)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)