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=========================================================================*/
30#ifndef vtkTextProperty_h
31#define vtkTextProperty_h
32
33#include "vtkObject.h"
34#include "vtkRenderingCoreModule.h" // For export macro
35
36class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
37{
38public:
39 vtkTypeMacro(vtkTextProperty, vtkObject);
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
47
49
52 vtkSetVector3Macro(Color, double);
53 vtkGetVector3Macro(Color, double);
55
57
61 vtkSetClampMacro(Opacity, double, 0., 1.);
62 vtkGetMacro(Opacity, double);
64
66
69 vtkSetVector3Macro(BackgroundColor, double);
70 vtkGetVector3Macro(BackgroundColor, double);
72
74
78 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
79 vtkGetMacro(BackgroundOpacity, double);
81
83
86 void SetBackgroundRGBA(double rgba[4]);
87 void SetBackgroundRGBA(double r, double g, double b, double a);
88
92 void GetBackgroundRGBA(double rgba[4]);
93 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
95
97
100 vtkSetVector3Macro(FrameColor, double);
101 vtkGetVector3Macro(FrameColor, double);
103
105
108 vtkSetMacro(Frame, vtkTypeBool);
109 vtkGetMacro(Frame, vtkTypeBool);
110 vtkBooleanMacro(Frame, vtkTypeBool);
112
114
118 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
119 vtkGetMacro(FrameWidth, int);
121
123
129 vtkGetStringMacro(FontFamilyAsString);
130 vtkSetStringMacro(FontFamilyAsString);
131 void SetFontFamily(int t);
132 int GetFontFamily();
134 void SetFontFamilyToArial();
135 void SetFontFamilyToCourier();
136 void SetFontFamilyToTimes();
137 static int GetFontFamilyFromString(const char* f);
138 static const char* GetFontFamilyAsString(int f);
140
142
150
152
155 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
156 vtkGetMacro(FontSize, int);
158
160
163 vtkSetMacro(Bold, vtkTypeBool);
164 vtkGetMacro(Bold, vtkTypeBool);
165 vtkBooleanMacro(Bold, vtkTypeBool);
167
169
172 vtkSetMacro(Italic, vtkTypeBool);
173 vtkGetMacro(Italic, vtkTypeBool);
174 vtkBooleanMacro(Italic, vtkTypeBool);
176
178
181 vtkSetMacro(Shadow, vtkTypeBool);
182 vtkGetMacro(Shadow, vtkTypeBool);
183 vtkBooleanMacro(Shadow, vtkTypeBool);
185
187
191 vtkSetVector2Macro(ShadowOffset, int);
192 vtkGetVectorMacro(ShadowOffset, int, 2);
194
198 void GetShadowColor(double color[3]);
199
201
205 vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
206 vtkGetMacro(Justification, int);
207 void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
208 void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
209 void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
210 const char* GetJustificationAsString();
212
214
218 vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
219 vtkGetMacro(VerticalJustification, int);
220 void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
221 void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
222 void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
223 const char* GetVerticalJustificationAsString();
225
227
233 vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
234 vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
235 vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
237
239
242 vtkSetMacro(Orientation, double);
243 vtkGetMacro(Orientation, double);
245
247
251 vtkSetMacro(LineSpacing, double);
252 vtkGetMacro(LineSpacing, double);
254
256
259 vtkSetMacro(LineOffset, double);
260 vtkGetMacro(LineOffset, double);
262
264
268 vtkSetMacro(CellOffset, double);
269 vtkGetMacro(CellOffset, double);
271
273
277 vtkSetMacro(InteriorLinesVisibility, bool);
278 vtkGetMacro(InteriorLinesVisibility, bool);
280
282
286 vtkSetMacro(InteriorLinesWidth, int);
287 vtkGetMacro(InteriorLinesWidth, int);
289
291
295 vtkSetVector3Macro(InteriorLinesColor, double);
296 vtkGetVector3Macro(InteriorLinesColor, double);
298
303
304protected:
307
308 double Color[3];
309 double Opacity;
310 double BackgroundColor[3];
313 double FrameColor[3];
316 char* FontFile;
321 int ShadowOffset[2];
329 bool InteriorLinesVisibility = false;
330 int InteriorLinesWidth = 1;
331 double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
332
333private:
334 vtkTextProperty(const vtkTextProperty&) = delete;
335 void operator=(const vtkTextProperty&) = delete;
336};
337
339{
340 if (f == VTK_ARIAL)
341 {
342 return "Arial";
343 }
344 else if (f == VTK_COURIER)
345 {
346 return "Courier";
347 }
348 else if (f == VTK_TIMES)
349 {
350 return "Times";
351 }
352 else if (f == VTK_FONT_FILE)
353 {
354 return "File";
355 }
356 return "Unknown";
357}
358
360{
362}
363
365{
367}
368
370{
372}
373
375{
377}
378
380{
381 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
382 {
383 return VTK_ARIAL;
384 }
385 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
386 {
387 return VTK_COURIER;
388 }
389 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
390 {
391 return VTK_TIMES;
392 }
393 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
394 {
395 return VTK_FONT_FILE;
396 }
397 return VTK_UNKNOWN_FONT;
398}
399
401{
403}
404
406{
407 if (this->Justification == VTK_TEXT_LEFT)
408 {
409 return "Left";
410 }
411 else if (this->Justification == VTK_TEXT_CENTERED)
412 {
413 return "Centered";
414 }
415 else if (this->Justification == VTK_TEXT_RIGHT)
416 {
417 return "Right";
418 }
419 return "Unknown";
420}
421
423{
425 {
426 return "Bottom";
427 }
429 {
430 return "Centered";
431 }
432 else if (this->VerticalJustification == VTK_TEXT_TOP)
433 {
434 return "Top";
435 }
436 return "Unknown";
437}
438
439#endif
a simple class to control print indentation
Definition vtkIndent.h:40
abstract base class for most VTK objects
Definition vtkObject.h:63
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: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