VTK  9.3.0
vtkTextProperty.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
18#ifndef vtkTextProperty_h
19#define vtkTextProperty_h
20
21#include "vtkObject.h"
22#include "vtkRenderingCoreModule.h" // For export macro
23
24VTK_ABI_NAMESPACE_BEGIN
25class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
26{
27public:
28 vtkTypeMacro(vtkTextProperty, vtkObject);
29 void PrintSelf(ostream& os, vtkIndent indent) override;
30
36
38
41 vtkSetVector3Macro(Color, double);
42 vtkGetVector3Macro(Color, double);
44
46
50 vtkSetClampMacro(Opacity, double, 0., 1.);
51 vtkGetMacro(Opacity, double);
53
55
58 vtkSetVector3Macro(BackgroundColor, double);
59 vtkGetVector3Macro(BackgroundColor, double);
61
63
67 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
68 vtkGetMacro(BackgroundOpacity, double);
70
72
75 void SetBackgroundRGBA(double rgba[4]);
76 void SetBackgroundRGBA(double r, double g, double b, double a);
77
81 void GetBackgroundRGBA(double rgba[4]);
82 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
84
86
89 vtkSetVector3Macro(FrameColor, double);
90 vtkGetVector3Macro(FrameColor, double);
92
94
97 vtkSetMacro(Frame, vtkTypeBool);
98 vtkGetMacro(Frame, vtkTypeBool);
99 vtkBooleanMacro(Frame, vtkTypeBool);
101
103
107 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
108 vtkGetMacro(FrameWidth, int);
110
112
118 vtkGetStringMacro(FontFamilyAsString);
119 vtkSetStringMacro(FontFamilyAsString);
120 void SetFontFamily(int t);
121 int GetFontFamily();
123 void SetFontFamilyToArial();
124 void SetFontFamilyToCourier();
125 void SetFontFamilyToTimes();
126 static int GetFontFamilyFromString(const char* f);
127 static const char* GetFontFamilyAsString(int f);
129
131
139
141
144 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
145 vtkGetMacro(FontSize, int);
147
149
152 vtkSetMacro(Bold, vtkTypeBool);
153 vtkGetMacro(Bold, vtkTypeBool);
154 vtkBooleanMacro(Bold, vtkTypeBool);
156
158
161 vtkSetMacro(Italic, vtkTypeBool);
162 vtkGetMacro(Italic, vtkTypeBool);
163 vtkBooleanMacro(Italic, vtkTypeBool);
165
167
170 vtkSetMacro(Shadow, vtkTypeBool);
171 vtkGetMacro(Shadow, vtkTypeBool);
172 vtkBooleanMacro(Shadow, vtkTypeBool);
174
176
180 vtkSetVector2Macro(ShadowOffset, int);
181 vtkGetVectorMacro(ShadowOffset, int, 2);
183
187 void GetShadowColor(double color[3]);
188
190
194 vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
195 vtkGetMacro(Justification, int);
196 void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
197 void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
198 void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
199 const char* GetJustificationAsString();
201
203
207 vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
208 vtkGetMacro(VerticalJustification, int);
209 void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
210 void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
211 void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
212 const char* GetVerticalJustificationAsString();
214
216
222 vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
223 vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
224 vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
226
228
231 vtkSetMacro(Orientation, double);
232 vtkGetMacro(Orientation, double);
234
236
240 vtkSetMacro(LineSpacing, double);
241 vtkGetMacro(LineSpacing, double);
243
245
248 vtkSetMacro(LineOffset, double);
249 vtkGetMacro(LineOffset, double);
251
253
257 vtkSetMacro(CellOffset, double);
258 vtkGetMacro(CellOffset, double);
260
262
266 vtkSetMacro(InteriorLinesVisibility, bool);
267 vtkGetMacro(InteriorLinesVisibility, bool);
269
271
275 vtkSetMacro(InteriorLinesWidth, int);
276 vtkGetMacro(InteriorLinesWidth, int);
278
280
284 vtkSetVector3Macro(InteriorLinesColor, double);
285 vtkGetVector3Macro(InteriorLinesColor, double);
287
292
293protected:
296
297 double Color[3];
298 double Opacity;
299 double BackgroundColor[3];
302 double FrameColor[3];
305 char* FontFile;
310 int ShadowOffset[2];
318 bool InteriorLinesVisibility = false;
319 int InteriorLinesWidth = 1;
320 double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
321
322private:
323 vtkTextProperty(const vtkTextProperty&) = delete;
324 void operator=(const vtkTextProperty&) = delete;
325};
326
328{
329 if (f == VTK_ARIAL)
330 {
331 return "Arial";
332 }
333 else if (f == VTK_COURIER)
334 {
335 return "Courier";
336 }
337 else if (f == VTK_TIMES)
338 {
339 return "Times";
340 }
341 else if (f == VTK_FONT_FILE)
342 {
343 return "File";
344 }
345 return "Unknown";
346}
347
349{
351}
352
354{
356}
357
359{
361}
362
364{
366}
367
369{
370 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
371 {
372 return VTK_ARIAL;
373 }
374 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
375 {
376 return VTK_COURIER;
377 }
378 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
379 {
380 return VTK_TIMES;
381 }
382 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
383 {
384 return VTK_FONT_FILE;
385 }
386 return VTK_UNKNOWN_FONT;
387}
388
390{
392}
393
395{
396 if (this->Justification == VTK_TEXT_LEFT)
397 {
398 return "Left";
399 }
400 else if (this->Justification == VTK_TEXT_CENTERED)
401 {
402 return "Centered";
403 }
404 else if (this->Justification == VTK_TEXT_RIGHT)
405 {
406 return "Right";
407 }
408 return "Unknown";
409}
410
412{
414 {
415 return "Bottom";
416 }
418 {
419 return "Centered";
420 }
421 else if (this->VerticalJustification == VTK_TEXT_TOP)
422 {
423 return "Top";
424 }
425 return "Unknown";
426}
427
428VTK_ABI_NAMESPACE_END
429#endif
a simple class to control print indentation
Definition vtkIndent.h:29
abstract base class for most VTK objects
Definition vtkObject.h:49
represent text properties.
void SetFontFamilyToArial()
Set/Get the font family.
void ShallowCopy(vtkTextProperty *tprop)
Shallow copy of a text property.
static vtkTextProperty * New()
Creates a new text property with font size 12, bold off, italic off, and Arial font.
static int GetFontFamilyFromString(const char *f)
Set/Get the font family.
virtual char * GetFontFamilyAsString()
Set/Get the font family.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetJustificationToCentered()
Set/Get the horizontal justification to left (default), centered, or right.
void SetFontFamilyToCourier()
Set/Get the font family.
void SetVerticalJustificationToCentered()
Set/Get the vertical justification to bottom (default), middle, or top.
void GetBackgroundRGBA(double rgba[4])
Convenience method to get the background color and the opacity at once.
int GetFontFamily()
Set/Get the font family.
void SetJustificationToLeft()
Set/Get the horizontal justification to left (default), centered, or right.
int GetFontFamilyMinValue()
Set/Get the font family.
const char * GetVerticalJustificationAsString()
Set/Get the vertical justification to bottom (default), middle, or top.
vtkGetFilePathMacro(FontFile)
The absolute filepath to a local file containing a freetype-readable font if GetFontFamily() return V...
vtkSetFilePathMacro(FontFile)
The absolute filepath to a local file containing a freetype-readable font if GetFontFamily() return V...
vtkTypeBool UseTightBoundingBox
void GetBackgroundRGBA(double &r, double &g, double &b, double &a)
Convenience method to set the background color and the opacity at once.
void SetJustificationToRight()
Set/Get the horizontal justification to left (default), centered, or right.
void SetVerticalJustificationToTop()
Set/Get the vertical justification to bottom (default), middle, or top.
~vtkTextProperty() override
void SetBackgroundRGBA(double rgba[4])
Convenience method to set the background color and the opacity at once.
void SetFontFamily(int t)
Set/Get the font family.
void GetShadowColor(double color[3])
Get the shadow color.
void SetVerticalJustificationToBottom()
Set/Get the vertical justification to bottom (default), middle, or top.
const char * GetJustificationAsString()
Set/Get the horizontal justification to left (default), centered, or right.
virtual void SetFontFamilyAsString(const char *)
Set/Get the font family.
void SetBackgroundRGBA(double r, double g, double b, double a)
Convenience method to set the background color and the opacity at once.
void SetFontFamilyToTimes()
Set/Get the font family.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_TEXT_TOP
#define VTK_TEXT_RIGHT
#define VTK_TEXT_LEFT
#define VTK_COURIER
#define VTK_TEXT_BOTTOM
#define VTK_FONT_FILE
#define VTK_ARIAL
#define VTK_TIMES
#define VTK_UNKNOWN_FONT
#define VTK_TEXT_CENTERED
#define VTK_INT_MAX
Definition vtkType.h:144