VTK  9.7.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
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 
25 VTK_ABI_NAMESPACE_BEGIN
26 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextProperty : public vtkObject
27 {
28 public:
29  vtkTypeMacro(vtkTextProperty, vtkObject);
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
36  static vtkTextProperty* New();
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();
127  int GetFontFamilyMinValue() { return VTK_ARIAL; }
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 
141  vtkGetFilePathMacro(FontFile);
142  vtkSetFilePathMacro(FontFile);
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 
199  vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
200  vtkGetMacro(Justification, int);
201  void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
202  void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
203  void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
204  const char* GetJustificationAsString();
206 
208 
212  vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
213  vtkGetMacro(VerticalJustification, int);
214  void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
215  void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
216  void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
217  const char* GetVerticalJustificationAsString();
219 
221 
227  vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
228  vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
229  vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
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 
296  void ShallowCopy(vtkTextProperty* tprop);
297 
298 protected:
299  vtkTextProperty();
300  ~vtkTextProperty() override;
301 
302  double Color[3];
303  double Opacity;
304  double BackgroundColor[3];
307  double FrameColor[3];
310  char* FontFile;
311  int FontSize;
315  int ShadowOffset[2];
319  double Orientation;
320  double LineOffset;
321  double LineSpacing;
322  double CellOffset;
323  bool InteriorLinesVisibility = false;
324  int InteriorLinesWidth = 1;
325  double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
326 
327 private:
328  vtkTextProperty(const vtkTextProperty&) = delete;
329  void operator=(const vtkTextProperty&) = delete;
330 };
331 
332 inline const char* vtkTextProperty::GetFontFamilyAsString(int f)
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 
359 {
360  this->SetFontFamily(VTK_ARIAL);
361 }
362 
364 {
365  this->SetFontFamily(VTK_COURIER);
366 }
367 
369 {
370  this->SetFontFamily(VTK_TIMES);
371 }
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 
395 {
397 }
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  }
422  else if (this->VerticalJustification == VTK_TEXT_CENTERED)
423  {
424  return "Centered";
425  }
426  else if (this->VerticalJustification == VTK_TEXT_TOP)
427  {
428  return "Top";
429  }
430  return "Unknown";
431 }
432 
433 VTK_ABI_NAMESPACE_END
434 #endif
void SetFontFamilyToArial()
Set/Get the font family.
#define VTK_UNKNOWN_FONT
void SetJustificationToRight()
Set/Get the horizontal justification to left (default), centered, or right.
abstract base class for most VTK objects
Definition: vtkObject.h:52
vtkTypeBool Frame
vtkTypeBool Italic
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetVerticalJustificationToTop()
Set/Get the vertical justification to bottom (default), middle, or top.
#define VTK_INT_MAX
Definition: vtkType.h:192
#define VTK_ARIAL
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_TEXT_TOP
void SetVerticalJustificationToBottom()
Set/Get the vertical justification to bottom (default), middle, or top.
vtkTypeBool Shadow
void SetVerticalJustificationToCentered()
Set/Get the vertical justification to bottom (default), middle, or top.
#define VTK_TEXT_CENTERED
virtual void SetFontFamilyAsString(const char *)
Set/Get the font family.
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_TEXT_RIGHT
#define VTK_TEXT_LEFT
#define VTK_COURIER
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_TEXT_BOTTOM
#define VTK_TIMES
int GetFontFamily()
Set/Get the font family.
void SetJustificationToLeft()
Set/Get the horizontal justification to left (default), centered, or right.
represent text properties.
void SetFontFamilyToCourier()
Set/Get the font family.
#define VTK_MARSHALEXCLUDE(reason)
vtkTypeBool Bold
vtkTypeBool UseTightBoundingBox
static int GetFontFamilyFromString(const char *f)
Set/Get the font family.
virtual char * GetFontFamilyAsString()
Set/Get the font family.
#define VTK_FONT_FILE
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
const char * GetVerticalJustificationAsString()
Set/Get the vertical justification to bottom (default), middle, or top.
void SetFontFamilyToTimes()
Set/Get the font family.
void SetJustificationToCentered()
Set/Get the horizontal justification to left (default), centered, or right.
void SetFontFamily(int t)
Set/Get the font family.
const char * GetJustificationAsString()
Set/Get the horizontal justification to left (default), centered, or right.