VTK  9.3.20240327
vtkStringToImage.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
13 #ifndef vtkStringToImage_h
14 #define vtkStringToImage_h
15 
16 #include "vtkObject.h"
17 #include "vtkRenderingCoreModule.h" // For export macro
18 
19 VTK_ABI_NAMESPACE_BEGIN
20 class vtkStdString;
21 class vtkTextProperty;
22 class vtkImageData;
23 class vtkVector2i;
24 
25 class VTKRENDERINGCORE_EXPORT vtkStringToImage : public vtkObject
26 {
27 public:
28  vtkTypeMacro(vtkStringToImage, vtkObject);
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
32 
45  virtual vtkVector2i GetBounds(vtkTextProperty* property, const vtkStdString& string, int dpi) = 0;
47 
49 
56  virtual int RenderString(vtkTextProperty* property, const vtkStdString& string, int dpi,
57  vtkImageData* data, int text_dims[2] = nullptr) = 0;
59 
64  virtual void SetScaleToPowerOfTwo(bool scale);
65  vtkGetMacro(ScaleToPowerOfTwo, bool);
66 
67 protected:
69  ~vtkStringToImage() override;
70 
71  bool Antialias;
73 
74 private:
75  vtkStringToImage(const vtkStringToImage&) = delete;
76  void operator=(const vtkStringToImage&) = delete;
77 };
78 
79 VTK_ABI_NAMESPACE_END
80 #endif // vtkStringToImage_h
topologically and geometrically regular array of data
Definition: vtkImageData.h:155
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:161
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:78
base class for classes that render supplied text to an image.
virtual int RenderString(vtkTextProperty *property, const vtkStdString &string, int dpi, vtkImageData *data, int text_dims[2]=nullptr)=0
Given a text property and a string, this function initializes the vtkImageData *data and renders it i...
virtual void SetScaleToPowerOfTwo(bool scale)
Should we produce images at powers of 2, makes rendering on old OpenGL hardware easier.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkStringToImage() override
virtual vtkVector2i GetBounds(vtkTextProperty *property, const vtkStdString &string, int dpi)=0
Given a text property and a string, get the bounding box [xmin, xmax] x [ymin, ymax].
represent text properties.
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:470
@ scale
Definition: vtkX3D.h:229
@ data
Definition: vtkX3D.h:315