1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkTextSource.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 =========================================================================*/ 15 /** 16 * @class vtkTextSource 17 * @brief create polygonal text 18 * 19 * vtkTextSource converts a text string into polygons. This way you can 20 * insert text into your renderings. It uses the 9x15 font from X Windows. 21 * You can specify if you want the background to be drawn or not. The 22 * characters are formed by scan converting the raster font into 23 * quadrilaterals. Colors are assigned to the letters using scalar data. 24 * To set the color of the characters with the source's actor property, set 25 * BackingOff on the text source and ScalarVisibilityOff on the associated 26 * vtkPolyDataMapper. Then, the color can be set using the associated actor's 27 * property. 28 * 29 * vtkVectorText generates higher quality polygonal representations of 30 * characters. 31 * 32 * @sa 33 * vtkVectorText 34 */ 35 36 #ifndef vtkTextSource_h 37 #define vtkTextSource_h 38 39 #include "vtkFiltersSourcesModule.h" // For export macro 40 #include "vtkPolyDataAlgorithm.h" 41 42 class VTKFILTERSSOURCES_EXPORT vtkTextSource : public vtkPolyDataAlgorithm 43 { 44 public: 45 vtkTypeMacro(vtkTextSource, vtkPolyDataAlgorithm); 46 void PrintSelf(ostream& os, vtkIndent indent) override; 47 48 /** 49 * Construct object with no string set and backing enabled. 50 */ 51 static vtkTextSource* New(); 52 53 ///@{ 54 /** 55 * Set/Get the text to be drawn. 56 */ 57 vtkSetStringMacro(Text); 58 vtkGetStringMacro(Text); 59 ///@} 60 61 ///@{ 62 /** 63 * Controls whether or not a background is drawn with the text. 64 */ 65 vtkSetMacro(Backing, vtkTypeBool); 66 vtkGetMacro(Backing, vtkTypeBool); 67 vtkBooleanMacro(Backing, vtkTypeBool); 68 ///@} 69 70 ///@{ 71 /** 72 * Set/Get the foreground color. Default is white (1,1,1). ALpha is always 1. 73 */ 74 vtkSetVector3Macro(ForegroundColor, double); 75 vtkGetVectorMacro(ForegroundColor, double, 3); 76 ///@} 77 78 ///@{ 79 /** 80 * Set/Get the background color. Default is black (0,0,0). Alpha is always 1. 81 */ 82 vtkSetVector3Macro(BackgroundColor, double); 83 vtkGetVectorMacro(BackgroundColor, double, 3); 84 ///@} 85 86 ///@{ 87 /** 88 * Set/get the desired precision for the output points. 89 * vtkAlgorithm::SINGLE_PRECISION - Output single-precision floating point. 90 * vtkAlgorithm::DOUBLE_PRECISION - Output double-precision floating point. 91 */ 92 vtkSetMacro(OutputPointsPrecision, int); 93 vtkGetMacro(OutputPointsPrecision, int); 94 ///@} 95 96 protected: 97 vtkTextSource(); 98 ~vtkTextSource() override; 99 100 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; 101 char* Text; 102 vtkTypeBool Backing; 103 double ForegroundColor[4]; 104 double BackgroundColor[4]; 105 int OutputPointsPrecision; 106 107 private: 108 vtkTextSource(const vtkTextSource&) = delete; 109 void operator=(const vtkTextSource&) = delete; 110 }; 111 112 #endif 113