VTK
vtkMathTextUtilities.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMathTextUtilities.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 #ifndef vtkMathTextUtilities_h
27 #define vtkMathTextUtilities_h
28 
29 #include "vtkRenderingFreeTypeModule.h" // For export macro
30 #include "vtkObject.h"
31 #include "vtkTextRenderer.h" // for metrics
32 
33 class vtkImageData;
34 class vtkPath;
35 class vtkTextProperty;
36 class vtkTextActor;
37 class vtkViewport;
38 
39 //----------------------------------------------------------------------------
40 // Singleton cleanup
41 
43 {
44 public:
47 
48 private:
49  vtkMathTextUtilitiesCleanup(const vtkMathTextUtilitiesCleanup& other); // no copy constructor
50  vtkMathTextUtilitiesCleanup& operator=(const vtkMathTextUtilitiesCleanup& rhs); // no copy assignment
51 };
52 
54 {
55 public:
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
65  static vtkMathTextUtilities *New();
66 
68  static vtkMathTextUtilities* GetInstance();
69 
72  static void SetInstance(vtkMathTextUtilities *instance);
73 
75 
77  virtual bool GetBoundingBox(vtkTextProperty *tprop, const char *str,
78  unsigned int dpi, int bbox[4]) = 0;
80 
82 
83  virtual bool GetMetrics(vtkTextProperty *tprop, const char *str,
84  unsigned int dpi,
85  vtkTextRenderer::Metrics &metrics) = 0;
87 
89 
94  virtual bool RenderString(const char *str, vtkImageData *data,
95  vtkTextProperty *tprop,
96  unsigned int dpi, int textDims[2] = NULL) = 0;
98 
100 
102  virtual bool StringToPath(const char *str, vtkPath *path,
103  vtkTextProperty *tprop) = 0;
105 
107 
111  virtual int GetConstrainedFontSize(const char *str,
112  vtkTextProperty *tprop,
113  int targetWidth, int targetHeight,
114  unsigned int dpi);
116 
118 
121  virtual bool GetScaleToPowerOfTwo() = 0;
122  virtual void SetScaleToPowerOfTwo(bool scale) = 0;
124 
125 protected:
127  virtual ~vtkMathTextUtilities();
128 
129 private:
130  vtkMathTextUtilities(const vtkMathTextUtilities&); // Not implemented.
131  void operator=(const vtkMathTextUtilities&); // Not implemented.
132 
134 
135  static vtkMathTextUtilities* Instance;
136  static vtkMathTextUtilitiesCleanup Cleanup;
137 };
139 
140 #endif
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
abstract base class for most VTK objects
Definition: vtkObject.h:61
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:34
abstract specification for Viewports
Definition: vtkViewport.h:46
GLenum GLenum GLenum GLenum GLenum scale
Definition: vtkgl.h:15942
#define VTKRENDERINGFREETYPE_EXPORT
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:54
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
GLsizei const GLchar ** path
Definition: vtkgl.h:13835
represent text properties.
Abstract interface to equation rendering.
static vtkObject * New()