VTK  9.0.1
vtkStringToImage.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStringToImage.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 
25 #ifndef vtkStringToImage_h
26 #define vtkStringToImage_h
27 
28 #include "vtkObject.h"
29 #include "vtkRenderingCoreModule.h" // For export macro
30 
31 class vtkStdString;
32 class vtkUnicodeString;
33 class vtkTextProperty;
34 class vtkImageData;
35 class vtkVector2i;
36 
37 class VTKRENDERINGCORE_EXPORT vtkStringToImage : public vtkObject
38 {
39 public:
40  vtkTypeMacro(vtkStringToImage, vtkObject);
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
44 
58  vtkTextProperty* property, const vtkUnicodeString& string, int dpi) = 0;
59  virtual vtkVector2i GetBounds(vtkTextProperty* property, const vtkStdString& string, int dpi) = 0;
61 
63 
70  virtual int RenderString(vtkTextProperty* property, const vtkUnicodeString& string, int dpi,
71  vtkImageData* data, int textDims[2] = nullptr) = 0;
72  virtual int RenderString(vtkTextProperty* property, const vtkStdString& string, int dpi,
73  vtkImageData* data, int text_dims[2] = nullptr) = 0;
75 
80  virtual void SetScaleToPowerOfTwo(bool scale);
81  vtkGetMacro(ScaleToPowerOfTwo, bool);
82 
83 protected:
85  ~vtkStringToImage() override;
86 
87  bool Antialias;
89 
90 private:
91  vtkStringToImage(const vtkStringToImage&) = delete;
92  void operator=(const vtkStringToImage&) = delete;
93 };
94 
95 #endif // vtkStringToImage_h
vtkStringToImage::RenderString
virtual int RenderString(vtkTextProperty *property, const vtkStdString &string, int dpi, vtkImageData *data, int text_dims[2]=nullptr)=0
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkStringToImage::ScaleToPowerOfTwo
bool ScaleToPowerOfTwo
Definition: vtkStringToImage.h:88
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:54
vtkStringToImage
base class for classes that render supplied text to an image.
Definition: vtkStringToImage.h:38
vtkStringToImage::RenderString
virtual int RenderString(vtkTextProperty *property, const vtkUnicodeString &string, int dpi, vtkImageData *data, int textDims[2]=nullptr)=0
Given a text property and a string, this function initializes the vtkImageData *data and renders it i...
vtkStringToImage::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkStringToImage::GetBounds
virtual vtkVector2i GetBounds(vtkTextProperty *property, const vtkStdString &string, int dpi)=0
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkUnicodeString
String class that stores Unicode text.
Definition: vtkUnicodeString.h:70
vtkObject.h
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:34
vtkStringToImage::~vtkStringToImage
~vtkStringToImage() override
vtkStringToImage::SetScaleToPowerOfTwo
virtual void SetScaleToPowerOfTwo(bool scale)
Should we produce images at powers of 2, makes rendering on old OpenGL hardware easier.
vtkStringToImage::GetBounds
virtual vtkVector2i GetBounds(vtkTextProperty *property, const vtkUnicodeString &string, int dpi)=0
Given a text property and a string, get the bounding box [xmin, xmax] x [ymin, ymax].
vtkVector2i
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:420
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:35
vtkStringToImage::vtkStringToImage
vtkStringToImage()
vtkStringToImage::Antialias
bool Antialias
Definition: vtkStringToImage.h:87