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=========================================================================*/
139#ifndef vtkTextProperty_h
140#define vtkTextProperty_h
141
142#include "vtkObject.h"
143#include "vtkRenderingCoreModule.h" // For export macro
144
145class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
146{
147public:
149 void PrintSelf(ostream& os, vtkIndent indent) override;
150
156
158
161 vtkSetVector3Macro(Color, double);
162 vtkGetVector3Macro(Color, double);
164
166
170 vtkSetClampMacro(Opacity, double, 0., 1.);
171 vtkGetMacro(Opacity, double);
173
175
178 vtkSetVector3Macro(BackgroundColor, double);
179 vtkGetVector3Macro(BackgroundColor, double);
181
183
187 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
188 vtkGetMacro(BackgroundOpacity, double);
190
192
195 void SetBackgroundRGBA(double rgba[4]);
196 void SetBackgroundRGBA(double r, double g, double b, double a);
197
201 void GetBackgroundRGBA(double rgba[4]);
202 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
204
206
209 vtkSetVector3Macro(FrameColor, double);
210 vtkGetVector3Macro(FrameColor, double);
212
214
217 vtkSetMacro(Frame, vtkTypeBool);
218 vtkGetMacro(Frame, vtkTypeBool);
219 vtkBooleanMacro(Frame, vtkTypeBool);
221
223
227 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
228 vtkGetMacro(FrameWidth, int);
230
232
238 vtkGetStringMacro(FontFamilyAsString);
239 vtkSetStringMacro(FontFamilyAsString);
240 void SetFontFamily(int t);
241 int GetFontFamily();
243 void SetFontFamilyToArial();
244 void SetFontFamilyToCourier();
245 void SetFontFamilyToTimes();
246 static int GetFontFamilyFromString(const char* f);
247 static const char* GetFontFamilyAsString(int f);
249
251
259
261
264 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
265 vtkGetMacro(FontSize, int);
267
269
272 vtkSetMacro(Bold, vtkTypeBool);
273 vtkGetMacro(Bold, vtkTypeBool);
274 vtkBooleanMacro(Bold, vtkTypeBool);
276
278
281 vtkSetMacro(Italic, vtkTypeBool);
282 vtkGetMacro(Italic, vtkTypeBool);
283 vtkBooleanMacro(Italic, vtkTypeBool);
285
287
290 vtkSetMacro(Shadow, vtkTypeBool);
291 vtkGetMacro(Shadow, vtkTypeBool);
292 vtkBooleanMacro(Shadow, vtkTypeBool);
294
296
300 vtkSetVector2Macro(ShadowOffset, int);
301 vtkGetVectorMacro(ShadowOffset, int, 2);
303
307 void GetShadowColor(double color[3]);
308
310
314 vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
315 vtkGetMacro(Justification, int);
316 void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
317 void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
318 void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
319 const char* GetJustificationAsString();
321
323
327 vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
328 vtkGetMacro(VerticalJustification, int);
329 void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
330 void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
331 void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
332 const char* GetVerticalJustificationAsString();
334
336
342 vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
343 vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
344 vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
346
348
351 vtkSetMacro(Orientation, double);
352 vtkGetMacro(Orientation, double);
354
356
360 vtkSetMacro(LineSpacing, double);
361 vtkGetMacro(LineSpacing, double);
363
365
368 vtkSetMacro(LineOffset, double);
369 vtkGetMacro(LineOffset, double);
371
373
377 vtkSetMacro(CellOffset, double);
378 vtkGetMacro(CellOffset, double);
380
382
386 vtkSetMacro(InteriorLinesVisibility, bool);
387 vtkGetMacro(InteriorLinesVisibility, bool);
389
391
395 vtkSetMacro(InteriorLinesWidth, int);
396 vtkGetMacro(InteriorLinesWidth, int);
398
400
404 vtkSetVector3Macro(InteriorLinesColor, double);
405 vtkGetVector3Macro(InteriorLinesColor, double);
407
412
413protected:
416
417 double Color[3];
418 double Opacity;
419 double BackgroundColor[3];
422 double FrameColor[3];
425 char* FontFile;
430 int ShadowOffset[2];
438 bool InteriorLinesVisibility = false;
439 int InteriorLinesWidth = 1;
440 double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
441
442private:
443 vtkTextProperty(const vtkTextProperty&) = delete;
444 void operator=(const vtkTextProperty&) = delete;
445};
446
448{
449 if (f == VTK_ARIAL)
450 {
451 return "Arial";
452 }
453 else if (f == VTK_COURIER)
454 {
455 return "Courier";
456 }
457 else if (f == VTK_TIMES)
458 {
459 return "Times";
460 }
461 else if (f == VTK_FONT_FILE)
462 {
463 return "File";
464 }
465 return "Unknown";
466}
467
469{
471}
472
474{
476}
477
479{
481}
482
484{
486}
487
489{
490 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
491 {
492 return VTK_ARIAL;
493 }
494 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
495 {
496 return VTK_COURIER;
497 }
498 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
499 {
500 return VTK_TIMES;
501 }
502 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
503 {
504 return VTK_FONT_FILE;
505 }
506 return VTK_UNKNOWN_FONT;
507}
508
510{
512}
513
515{
516 if (this->Justification == VTK_TEXT_LEFT)
517 {
518 return "Left";
519 }
520 else if (this->Justification == VTK_TEXT_CENTERED)
521 {
522 return "Centered";
523 }
524 else if (this->Justification == VTK_TEXT_RIGHT)
525 {
526 return "Right";
527 }
528 return "Unknown";
529}
530
532{
534 {
535 return "Bottom";
536 }
538 {
539 return "Centered";
540 }
541 else if (this->VerticalJustification == VTK_TEXT_TOP)
542 {
543 return "Top";
544 }
545 return "Unknown";
546}
547
548#endif
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract base class for most VTK objects
Definition: vtkObject.h:82
represent text properties.
void SetFontFamilyToArial()
Set/Get the font family.
vtkTypeBool Shadow
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.
vtkTypeBool Italic
vtkTypeBool Bold
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.
vtkTypeBool Frame
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.
@ Color
Definition: vtkX3D.h:52
@ color
Definition: vtkX3D.h:227
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