VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/FreeType/vtkMathTextUtilities.h
Go to the documentation of this file.
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 #include "vtkTextRenderer.h" // for metrics
00032 
00033 class vtkImageData;
00034 class vtkPath;
00035 class vtkTextProperty;
00036 class vtkTextActor;
00037 class vtkViewport;
00038 
00039 //----------------------------------------------------------------------------
00040 // Singleton cleanup
00041 
00042 class VTKRENDERINGFREETYPE_EXPORT vtkMathTextUtilitiesCleanup
00043 {
00044 public:
00045   vtkMathTextUtilitiesCleanup();
00046   ~vtkMathTextUtilitiesCleanup();
00047 
00048 private:
00049   vtkMathTextUtilitiesCleanup(const vtkMathTextUtilitiesCleanup& other); // no copy constructor
00050   vtkMathTextUtilitiesCleanup& operator=(const vtkMathTextUtilitiesCleanup& rhs); // no copy assignment
00051 };
00052 
00053 class VTKRENDERINGFREETYPE_EXPORT vtkMathTextUtilities : public vtkObject
00054 {
00055 public:
00056   vtkTypeMacro(vtkMathTextUtilities, vtkObject);
00057   void PrintSelf(ostream& os, vtkIndent indent);
00058 
00065   static vtkMathTextUtilities *New();
00066 
00068   static vtkMathTextUtilities* GetInstance();
00069 
00072   static void SetInstance(vtkMathTextUtilities *instance);
00073 
00075 
00077   virtual bool GetBoundingBox(vtkTextProperty *tprop, const char *str,
00078                               unsigned int dpi, int bbox[4]) = 0;
00080 
00082 
00083   virtual bool GetMetrics(vtkTextProperty *tprop, const char *str,
00084                           unsigned int dpi,
00085                           vtkTextRenderer::Metrics &metrics) = 0;
00087 
00089 
00094  virtual bool RenderString(const char *str, vtkImageData *data,
00095                            vtkTextProperty *tprop,
00096                            unsigned int dpi, int textDims[2] = NULL) = 0;
00098 
00100 
00102   virtual bool StringToPath(const char *str, vtkPath *path,
00103                             vtkTextProperty *tprop) = 0;
00105 
00107 
00111   virtual int GetConstrainedFontSize(const char *str,
00112                                      vtkTextProperty *tprop,
00113                                      int targetWidth, int targetHeight,
00114                                      unsigned int dpi);
00116 
00118 
00121   virtual bool GetScaleToPowerOfTwo() = 0;
00122   virtual void SetScaleToPowerOfTwo(bool scale) = 0;
00124 
00125 protected:
00126   vtkMathTextUtilities();
00127   virtual ~vtkMathTextUtilities();
00128 
00129 private:
00130   vtkMathTextUtilities(const vtkMathTextUtilities&);  // Not implemented.
00131   void operator=(const vtkMathTextUtilities&);  // Not implemented.
00132 
00134 
00135   static vtkMathTextUtilities* Instance;
00136   static vtkMathTextUtilitiesCleanup Cleanup;
00137 };
00139 
00140 #endif