VTK  9.4.20241114
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
138#ifndef vtkTextActor_h
139#define vtkTextActor_h
140
141#include "vtkRenderingCoreModule.h" // For export macro
142#include "vtkTexturedActor2D.h"
143#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
144
145VTK_ABI_NAMESPACE_BEGIN
146class vtkImageData;
147class vtkPoints;
148class vtkPolyData;
150class vtkProperty2D;
151class vtkTextProperty;
152class vtkTextRenderer;
153class vtkTransform;
154
155class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextActor : public vtkTexturedActor2D
156{
157public:
159 void PrintSelf(ostream& os, vtkIndent indent) override;
160
165 static vtkTextActor* New();
166
171 void ShallowCopy(vtkProp* prop) override;
172
174
180 void SetInput(const char* inputString);
181 char* GetInput();
183
185
190 vtkSetVector2Macro(MinimumSize, int);
191 vtkGetVector2Macro(MinimumSize, int);
193
195
201 vtkSetMacro(MaximumLineHeight, float);
202 vtkGetMacro(MaximumLineHeight, float);
204
206
215 vtkSetClampMacro(TextScaleMode, int, TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
216 vtkGetMacro(TextScaleMode, int);
217 void SetTextScaleModeToNone() { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
218 void SetTextScaleModeToProp() { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
219 void SetTextScaleModeToViewport() { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
221
222 enum
223 {
224 TEXT_SCALE_MODE_NONE = 0,
226 TEXT_SCALE_MODE_VIEWPORT
227 };
228
230
235 vtkSetMacro(UseBorderAlign, vtkTypeBool);
236 vtkGetMacro(UseBorderAlign, vtkTypeBool);
237 vtkBooleanMacro(UseBorderAlign, vtkTypeBool);
239
241
257 void SetAlignmentPoint(int point);
259 int GetAlignmentPoint();
261
263
270 void SetOrientation(float orientation);
271 vtkGetMacro(Orientation, float);
273
275
278 virtual void SetTextProperty(vtkTextProperty* p);
279 vtkGetObjectMacro(TextProperty, vtkTextProperty);
281
287 virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
288
292 virtual void GetSize(vtkViewport* vport, double size[2]);
293
295
300 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
301 static int SetConstrainedFontSize(vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
303
310 static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
311 vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
312
322 virtual void SetNonLinearFontScale(double exponent, int target);
323
328 void SpecifiedToDisplay(double* pos, vtkViewport* vport, int specified);
329
334 void DisplayToSpecified(double* pos, vtkViewport* vport, int specified);
335
340 virtual void ComputeScaledFont(vtkViewport* viewport);
341
343
347 vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
349
357 static float GetFontScale(vtkViewport* viewport);
358
366 void ReleaseGraphicsResources(vtkWindow*) override;
367
369
374 int RenderOpaqueGeometry(vtkViewport* viewport) override;
375 int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
376 int RenderOverlay(vtkViewport* viewport) override;
378
383
384protected:
388 virtual bool RenderImage(vtkTextProperty* tprop, vtkViewport* viewport);
389
393 virtual bool GetImageBoundingBox(vtkTextProperty* tprop, vtkViewport* viewport, int bbox[4]);
394
396 ~vtkTextActor() override;
397
398 int MinimumSize[2];
404
410 int LastSize[2];
411 int LastOrigin[2];
412 char* Input;
416
418
419 // Stuff needed to display the image text as a texture map.
422
423 virtual void ComputeRectangle(vtkViewport* viewport);
424
438 virtual int UpdateRectangle(vtkViewport* viewport);
439
440private:
441 vtkTextActor(const vtkTextActor&) = delete;
442 void operator=(const vtkTextActor&) = delete;
443};
444
445VTK_ABI_NAMESPACE_END
446#endif
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 3D points
Definition vtkPoints.h:139
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
represent surface properties of a 2D image
An actor that displays text.
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,...
double FormerOrientation
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...
virtual bool RenderImage(vtkTextProperty *tprop, vtkViewport *viewport)
Render Input to Image using the supplied font property.
vtkTransform * Transform
vtkTextProperty * ScaledTextProperty
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
vtkTextRenderer * TextRenderer
vtkPolyData * Rectangle
vtkTimeStamp BuildTime
virtual void ComputeRectangle(vtkViewport *viewport)
double FontScaleExponent
void SetTextScaleModeToProp()
Set how text should be scaled.
void SetTextScaleModeToViewport()
Set how text should be scaled.
vtkPoints * RectanglePoints
vtkTypeBool UseBorderAlign
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.
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
describes linear transformations via a 4x4 matrix
abstract specification for Viewports
Definition vtkViewport.h:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
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)