VTK  9.5.2
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
36VTK_ABI_NAMESPACE_BEGIN
37class vtkImageData;
38class vtkPoints;
39class vtkPolyData;
41class vtkProperty2D;
42class vtkTextProperty;
43class vtkTextRenderer;
44class vtkTransform;
45
46class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextActor : public vtkTexturedActor2D
47{
48public:
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
56 static vtkTextActor* New();
57
62 void ShallowCopy(vtkProp* prop) override;
63
65
71 void SetInput(const char* inputString);
72 char* GetInput();
74
76
81 vtkSetVector2Macro(MinimumSize, int);
82 vtkGetVector2Macro(MinimumSize, int);
84
86
92 vtkSetMacro(MaximumLineHeight, float);
93 vtkGetMacro(MaximumLineHeight, float);
95
97
106 vtkSetClampMacro(TextScaleMode, int, TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
107 vtkGetMacro(TextScaleMode, int);
108 void SetTextScaleModeToNone() { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
109 void SetTextScaleModeToProp() { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
110 void SetTextScaleModeToViewport() { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
112
113 enum
114 {
115 TEXT_SCALE_MODE_NONE = 0,
117 TEXT_SCALE_MODE_VIEWPORT
118 };
119
121
126 vtkSetMacro(UseBorderAlign, vtkTypeBool);
127 vtkGetMacro(UseBorderAlign, vtkTypeBool);
128 vtkBooleanMacro(UseBorderAlign, vtkTypeBool);
130
132
148 void SetAlignmentPoint(int point);
150 int GetAlignmentPoint();
152
154
161 void SetOrientation(float orientation);
162 vtkGetMacro(Orientation, float);
164
166
169 virtual void SetTextProperty(vtkTextProperty* p);
170 vtkGetObjectMacro(TextProperty, vtkTextProperty);
172
178 virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
179
183 virtual void GetSize(vtkViewport* vport, double size[2]);
184
186
191 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
192 static int SetConstrainedFontSize(vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
194
201 static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
202 vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
203
213 virtual void SetNonLinearFontScale(double exponent, int target);
214
219 void SpecifiedToDisplay(double* pos, vtkViewport* vport, int specified);
220
225 void DisplayToSpecified(double* pos, vtkViewport* vport, int specified);
226
231 virtual void ComputeScaledFont(vtkViewport* viewport);
232
234
238 vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
240
248 static float GetFontScale(vtkViewport* viewport);
249
257 void ReleaseGraphicsResources(vtkWindow*) override;
258
260
265 int RenderOpaqueGeometry(vtkViewport* viewport) override;
266 int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
267 int RenderOverlay(vtkViewport* viewport) override;
269
274
275protected:
279 virtual bool RenderImage(vtkTextProperty* tprop, vtkViewport* viewport);
280
284 virtual bool GetImageBoundingBox(vtkTextProperty* tprop, vtkViewport* viewport, int bbox[4]);
285
287 ~vtkTextActor() override;
288
289 int MinimumSize[2];
295
301 int LastSize[2];
302 int LastOrigin[2];
303 char* Input;
307
309
310 // Stuff needed to display the image text as a texture map.
313
314 virtual void ComputeRectangle(vtkViewport* viewport);
315
329 virtual int UpdateRectangle(vtkViewport* viewport);
330
331private:
332 vtkTextActor(const vtkTextActor&) = delete;
333 void operator=(const vtkTextActor&) = delete;
334};
335
336VTK_ABI_NAMESPACE_END
337#endif
topologically and geometrically regular array of data
Definition: vtkImageData.h:47
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
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:47
represent surface properties of a 2D image
Definition: vtkProperty2D.h:31
An actor that displays text.
Definition: vtkTextActor.h:47
vtkTextProperty * TextProperty
Definition: vtkTextActor.h:296
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,...
double FormerOrientation
Definition: vtkTextActor.h:305
float MaximumLineHeight
Definition: vtkTextActor.h:290
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...
virtual bool RenderImage(vtkTextProperty *tprop, vtkViewport *viewport)
Render Input to Image using the supplied font property.
vtkTransform * Transform
Definition: vtkTextActor.h:300
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:308
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.
virtual bool GetImageBoundingBox(vtkTextProperty *tprop, vtkViewport *viewport, int bbox[4])
Get the bounding box for Input using the supplied font property.
~vtkTextActor() override
vtkImageData * ImageData
Definition: vtkTextActor.h:297
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:298
vtkPolyData * Rectangle
Definition: vtkTextActor.h:311
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:299
virtual void ComputeRectangle(vtkViewport *viewport)
double FontScaleExponent
Definition: vtkTextActor.h:291
bool InputRendered
Definition: vtkTextActor.h:304
void SetTextScaleModeToProp()
Set how text should be scaled.
Definition: vtkTextActor.h:109
void SetTextScaleModeToViewport()
Set how text should be scaled.
Definition: vtkTextActor.h:110
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:312
vtkTypeBool UseBorderAlign
Definition: vtkTextActor.h:294
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
float Orientation
Definition: vtkTextActor.h:293
void SetTextScaleModeToNone()
Set how text should be scaled.
Definition: vtkTextActor.h:108
represent text properties.
Interface for generating images and path data from string data, using multiple backends.
actor that draws 2D data with texture support
record modification and/or execution time
Definition: vtkTimeStamp.h:25
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:51
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:29
@ point
Definition: vtkX3D.h:236
@ orientation
Definition: vtkX3D.h:262
@ size
Definition: vtkX3D.h:253
int vtkTypeBool
Definition: vtkABI.h:64
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)