VTK  9.6.1
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
17
18#ifndef vtkTextProperty_h
19#define vtkTextProperty_h
20
21#include "vtkObject.h"
22#include "vtkRenderingCoreModule.h" // For export macro
23#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24
25VTK_ABI_NAMESPACE_BEGIN
26class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextProperty : public vtkObject
27{
28public:
29 vtkTypeMacro(vtkTextProperty, vtkObject);
30 void PrintSelf(ostream& os, vtkIndent indent) override;
31
37
39
42 vtkSetVector3Macro(Color, double);
43 vtkGetVector3Macro(Color, double);
45
47
51 vtkSetClampMacro(Opacity, double, 0., 1.);
52 vtkGetMacro(Opacity, double);
54
56
59 vtkSetVector3Macro(BackgroundColor, double);
60 vtkGetVector3Macro(BackgroundColor, double);
62
64
68 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
69 vtkGetMacro(BackgroundOpacity, double);
71
73
77 void SetBackgroundRGBA(double rgba[4]);
79 void SetBackgroundRGBA(double r, double g, double b, double a);
80
85 void GetBackgroundRGBA(double rgba[4]);
87 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
89
91
94 vtkSetVector3Macro(FrameColor, double);
95 vtkGetVector3Macro(FrameColor, double);
97
99
102 vtkSetMacro(Frame, vtkTypeBool);
103 vtkGetMacro(Frame, vtkTypeBool);
104 vtkBooleanMacro(Frame, vtkTypeBool);
106
108
112 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
113 vtkGetMacro(FrameWidth, int);
115
117
123 vtkGetStringMacro(FontFamilyAsString);
124 vtkSetStringMacro(FontFamilyAsString);
125 void SetFontFamily(int t);
126 int GetFontFamily();
128 void SetFontFamilyToArial();
129 void SetFontFamilyToCourier();
130 void SetFontFamilyToTimes();
131 static int GetFontFamilyFromString(const char* f);
132 static const char* GetFontFamilyAsString(int f);
134
136
144
146
149 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
150 vtkGetMacro(FontSize, int);
152
154
157 vtkSetMacro(Bold, vtkTypeBool);
158 vtkGetMacro(Bold, vtkTypeBool);
159 vtkBooleanMacro(Bold, vtkTypeBool);
161
163
166 vtkSetMacro(Italic, vtkTypeBool);
167 vtkGetMacro(Italic, vtkTypeBool);
168 vtkBooleanMacro(Italic, vtkTypeBool);
170
172
175 vtkSetMacro(Shadow, vtkTypeBool);
176 vtkGetMacro(Shadow, vtkTypeBool);
177 vtkBooleanMacro(Shadow, vtkTypeBool);
179
181
185 vtkSetVector2Macro(ShadowOffset, int);
186 vtkGetVectorMacro(ShadowOffset, int, 2);
188
192 void GetShadowColor(double color[3]);
193
195
200 vtkGetMacro(Justification, int);
204 const char* GetJustificationAsString();
206
208
213 vtkGetMacro(VerticalJustification, int);
217 const char* GetVerticalJustificationAsString();
219
221
231
233
236 vtkSetMacro(Orientation, double);
237 vtkGetMacro(Orientation, double);
239
241
245 vtkSetMacro(LineSpacing, double);
246 vtkGetMacro(LineSpacing, double);
248
250
253 vtkSetMacro(LineOffset, double);
254 vtkGetMacro(LineOffset, double);
256
258
262 vtkSetMacro(CellOffset, double);
263 vtkGetMacro(CellOffset, double);
265
267
271 vtkSetMacro(InteriorLinesVisibility, bool);
272 vtkGetMacro(InteriorLinesVisibility, bool);
274
276
280 vtkSetMacro(InteriorLinesWidth, int);
281 vtkGetMacro(InteriorLinesWidth, int);
283
285
289 vtkSetVector3Macro(InteriorLinesColor, double);
290 vtkGetVector3Macro(InteriorLinesColor, double);
292
297
298protected:
301
302 double Color[3];
303 double Opacity;
307 double FrameColor[3];
310 char* FontFile;
325 double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
326
327private:
328 vtkTextProperty(const vtkTextProperty&) = delete;
329 void operator=(const vtkTextProperty&) = delete;
330};
331
333{
334 if (f == VTK_ARIAL)
335 {
336 return "Arial";
337 }
338 else if (f == VTK_COURIER)
339 {
340 return "Courier";
341 }
342 else if (f == VTK_TIMES)
343 {
344 return "Times";
345 }
346 else if (f == VTK_FONT_FILE)
347 {
348 return "File";
349 }
350 return "Unknown";
351}
352
354{
356}
357
362
367
372
374{
375 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
376 {
377 return VTK_ARIAL;
378 }
379 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
380 {
381 return VTK_COURIER;
382 }
383 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
384 {
385 return VTK_TIMES;
386 }
387 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
388 {
389 return VTK_FONT_FILE;
390 }
391 return VTK_UNKNOWN_FONT;
392}
393
398
400{
401 if (this->Justification == VTK_TEXT_LEFT)
402 {
403 return "Left";
404 }
405 else if (this->Justification == VTK_TEXT_CENTERED)
406 {
407 return "Centered";
408 }
409 else if (this->Justification == VTK_TEXT_RIGHT)
410 {
411 return "Right";
412 }
413 return "Unknown";
414}
415
417{
419 {
420 return "Bottom";
421 }
423 {
424 return "Centered";
425 }
426 else if (this->VerticalJustification == VTK_TEXT_TOP)
427 {
428 return "Top";
429 }
430 return "Unknown";
431}
432
433VTK_ABI_NAMESPACE_END
434#endif
a simple class to control print indentation
Definition vtkIndent.h:29
represent text properties.
void SetFontFamilyToArial()
Set/Get the font family.
virtual void SetJustification(int)
Set/Get the horizontal justification to left (default), centered, or right.
double InteriorLinesColor[3]
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 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.
double BackgroundColor[3]
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 SetFontFamilyToTimes()
Set/Get the font family.
virtual void SetVerticalJustification(int)
Set/Get the vertical justification to bottom (default), middle, or top.
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:197
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)