VTK
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 __vtkMathTypeUtilities_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 
00048 class VTKRENDERINGFREETYPE_EXPORT vtkMathTextUtilities : public vtkObject
00049 {
00050 public:
00051   vtkTypeMacro(vtkMathTextUtilities, vtkObject);
00052   void PrintSelf(ostream& os, vtkIndent indent);
00053 
00060   static vtkMathTextUtilities *New();
00061 
00063   static vtkMathTextUtilities* GetInstance();
00064 
00067   static void SetInstance(vtkMathTextUtilities *instance);
00068 
00070 
00072   virtual bool GetBoundingBox(vtkTextProperty *tprop, const char *str,
00073                               unsigned int dpi, int bbox[4]) = 0;
00075 
00077 
00082  virtual bool RenderString(const char *str, vtkImageData *data,
00083                            vtkTextProperty *tprop,
00084                            unsigned int dpi, int textDims[2] = NULL) = 0;
00086 
00088 
00090   virtual bool StringToPath(const char *str, vtkPath *path,
00091                             vtkTextProperty *tprop) = 0;
00093 
00095 
00099   virtual int GetConstrainedFontSize(const char *str,
00100                                      vtkTextProperty *tprop,
00101                                      int targetWidth, int targetHeight,
00102                                      unsigned int dpi);
00104 
00106 
00109   virtual bool GetScaleToPowerOfTwo() = 0;
00110   virtual void SetScaleToPowerOfTwo(bool scale) = 0;
00112 
00113 protected:
00114   vtkMathTextUtilities();
00115   virtual ~vtkMathTextUtilities();
00116 
00117 private:
00118   vtkMathTextUtilities(const vtkMathTextUtilities&);  // Not implemented.
00119   void operator=(const vtkMathTextUtilities&);  // Not implemented.
00120 
00122 
00123   static vtkMathTextUtilities* Instance;
00124   static vtkMathTextUtilitiesCleanup Cleanup;
00125 };
00127 
00128 #endif