VTK  9.2.6
vtkTextProperty.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTextProperty.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
26
27#ifndef vtkTextProperty_h
28#define vtkTextProperty_h
29
30#include "vtkObject.h"
31#include "vtkRenderingCoreModule.h" // For export macro
32
33class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
34{
35public:
36 vtkTypeMacro(vtkTextProperty, vtkObject);
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
44
46
49 vtkSetVector3Macro(Color, double);
50 vtkGetVector3Macro(Color, double);
52
54
58 vtkSetClampMacro(Opacity, double, 0., 1.);
59 vtkGetMacro(Opacity, double);
61
63
66 vtkSetVector3Macro(BackgroundColor, double);
67 vtkGetVector3Macro(BackgroundColor, double);
69
71
75 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
76 vtkGetMacro(BackgroundOpacity, double);
78
80
83 void SetBackgroundRGBA(double rgba[4]);
84 void SetBackgroundRGBA(double r, double g, double b, double a);
85
89 void GetBackgroundRGBA(double rgba[4]);
90 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
92
94
97 vtkSetVector3Macro(FrameColor, double);
98 vtkGetVector3Macro(FrameColor, double);
100
102
105 vtkSetMacro(Frame, vtkTypeBool);
106 vtkGetMacro(Frame, vtkTypeBool);
107 vtkBooleanMacro(Frame, vtkTypeBool);
109
111
115 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
116 vtkGetMacro(FrameWidth, int);
118
120
126 vtkGetStringMacro(FontFamilyAsString);
127 vtkSetStringMacro(FontFamilyAsString);
128 void SetFontFamily(int t);
129 int GetFontFamily();
131 void SetFontFamilyToArial();
132 void SetFontFamilyToCourier();
133 void SetFontFamilyToTimes();
134 static int GetFontFamilyFromString(const char* f);
135 static const char* GetFontFamilyAsString(int f);
137
139
147
149
152 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
153 vtkGetMacro(FontSize, int);
155
157
160 vtkSetMacro(Bold, vtkTypeBool);
161 vtkGetMacro(Bold, vtkTypeBool);
162 vtkBooleanMacro(Bold, vtkTypeBool);
164
166
169 vtkSetMacro(Italic, vtkTypeBool);
170 vtkGetMacro(Italic, vtkTypeBool);
171 vtkBooleanMacro(Italic, vtkTypeBool);
173
175
178 vtkSetMacro(Shadow, vtkTypeBool);
179 vtkGetMacro(Shadow, vtkTypeBool);
180 vtkBooleanMacro(Shadow, vtkTypeBool);
182
184
188 vtkSetVector2Macro(ShadowOffset, int);
189 vtkGetVectorMacro(ShadowOffset, int, 2);
191
195 void GetShadowColor(double color[3]);
196
198
203 vtkGetMacro(Justification, int);
207 const char* GetJustificationAsString();
209
211
216 vtkGetMacro(VerticalJustification, int);
220 const char* GetVerticalJustificationAsString();
222
224
234
236
239 vtkSetMacro(Orientation, double);
240 vtkGetMacro(Orientation, double);
242
244
248 vtkSetMacro(LineSpacing, double);
249 vtkGetMacro(LineSpacing, double);
251
253
256 vtkSetMacro(LineOffset, double);
257 vtkGetMacro(LineOffset, double);
259
261
265 vtkSetMacro(CellOffset, double);
266 vtkGetMacro(CellOffset, double);
268
270
274 vtkSetMacro(InteriorLinesVisibility, bool);
275 vtkGetMacro(InteriorLinesVisibility, bool);
277
279
283 vtkSetMacro(InteriorLinesWidth, int);
284 vtkGetMacro(InteriorLinesWidth, int);
286
288
292 vtkSetVector3Macro(InteriorLinesColor, double);
293 vtkGetVector3Macro(InteriorLinesColor, double);
295
300
301protected:
304
305 double Color[3];
306 double Opacity;
310 double FrameColor[3];
313 char* FontFile;
328 double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
329
330private:
331 vtkTextProperty(const vtkTextProperty&) = delete;
332 void operator=(const vtkTextProperty&) = delete;
333};
334
336{
337 if (f == VTK_ARIAL)
338 {
339 return "Arial";
340 }
341 else if (f == VTK_COURIER)
342 {
343 return "Courier";
344 }
345 else if (f == VTK_TIMES)
346 {
347 return "Times";
348 }
349 else if (f == VTK_FONT_FILE)
350 {
351 return "File";
352 }
353 return "Unknown";
354}
355
357{
359}
360
365
370
375
377{
378 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
379 {
380 return VTK_ARIAL;
381 }
382 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
383 {
384 return VTK_COURIER;
385 }
386 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
387 {
388 return VTK_TIMES;
389 }
390 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
391 {
392 return VTK_FONT_FILE;
393 }
394 return VTK_UNKNOWN_FONT;
395}
396
401
403{
404 if (this->Justification == VTK_TEXT_LEFT)
405 {
406 return "Left";
407 }
408 else if (this->Justification == VTK_TEXT_CENTERED)
409 {
410 return "Centered";
411 }
412 else if (this->Justification == VTK_TEXT_RIGHT)
413 {
414 return "Right";
415 }
416 return "Unknown";
417}
418
420{
422 {
423 return "Bottom";
424 }
426 {
427 return "Centered";
428 }
429 else if (this->VerticalJustification == VTK_TEXT_TOP)
430 {
431 return "Top";
432 }
433 return "Unknown";
434}
435
436#endif
a simple class to control print indentation
Definition vtkIndent.h:34
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 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.
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 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.
virtual void SetVerticalJustification(int)
Set/Get the vertical justification to bottom (default), middle, or top.
int vtkTypeBool
Definition vtkABI.h:69
#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:155