VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMathTextUtilities.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00026 #ifndef __vtkMathTextUtilities_h 00027 #define __vtkMathTextUtilities_h 00028 00029 #include "vtkRenderingFreeTypeModule.h" // For export macro 00030 #include "vtkObject.h" 00031 00032 class vtkImageData; 00033 class vtkPath; 00034 class vtkTextProperty; 00035 class vtkTextActor; 00036 class vtkViewport; 00037 00038 //---------------------------------------------------------------------------- 00039 // Singleton cleanup 00040 00041 class VTKRENDERINGFREETYPE_EXPORT vtkMathTextUtilitiesCleanup 00042 { 00043 public: 00044 vtkMathTextUtilitiesCleanup(); 00045 ~vtkMathTextUtilitiesCleanup(); 00046 00047 private: 00048 vtkMathTextUtilitiesCleanup(const vtkMathTextUtilitiesCleanup& other); // no copy constructor 00049 vtkMathTextUtilitiesCleanup& operator=(const vtkMathTextUtilitiesCleanup& rhs); // no copy assignment 00050 }; 00051 00052 class VTKRENDERINGFREETYPE_EXPORT vtkMathTextUtilities : public vtkObject 00053 { 00054 public: 00055 vtkTypeMacro(vtkMathTextUtilities, vtkObject); 00056 void PrintSelf(ostream& os, vtkIndent indent); 00057 00064 static vtkMathTextUtilities *New(); 00065 00067 static vtkMathTextUtilities* GetInstance(); 00068 00071 static void SetInstance(vtkMathTextUtilities *instance); 00072 00074 00076 virtual bool GetBoundingBox(vtkTextProperty *tprop, const char *str, 00077 unsigned int dpi, int bbox[4]) = 0; 00079 00081 00086 virtual bool RenderString(const char *str, vtkImageData *data, 00087 vtkTextProperty *tprop, 00088 unsigned int dpi, int textDims[2] = NULL) = 0; 00090 00092 00094 virtual bool StringToPath(const char *str, vtkPath *path, 00095 vtkTextProperty *tprop) = 0; 00097 00099 00103 virtual int GetConstrainedFontSize(const char *str, 00104 vtkTextProperty *tprop, 00105 int targetWidth, int targetHeight, 00106 unsigned int dpi); 00108 00110 00113 virtual bool GetScaleToPowerOfTwo() = 0; 00114 virtual void SetScaleToPowerOfTwo(bool scale) = 0; 00116 00117 protected: 00118 vtkMathTextUtilities(); 00119 virtual ~vtkMathTextUtilities(); 00120 00121 private: 00122 vtkMathTextUtilities(const vtkMathTextUtilities&); // Not implemented. 00123 void operator=(const vtkMathTextUtilities&); // Not implemented. 00124 00126 00127 static vtkMathTextUtilities* Instance; 00128 static vtkMathTextUtilitiesCleanup Cleanup; 00129 }; 00131 00132 #endif