34 #ifndef vtkMatplotlibMathTextUtilities_h
35 #define vtkMatplotlibMathTextUtilities_h
38 #include "vtkRenderingMatplotlibModule.h"
46 VTK_ABI_NAMESPACE_BEGIN
49 class vtkPythonInterpreter;
50 class vtkSmartPyObject;
88 int textDims[2] =
nullptr)
override;
113 bool InitializeMaskParser();
114 bool InitializePathParser();
115 bool InitializeFontPropertiesClass();
117 bool CheckForError();
118 bool CheckForError(
PyObject*
object);
125 void FindAndReplaceInString(
128 static constexpr
const char* PipeProtectString =
"VTK_PROTECT_PIPE";
152 void CleanupPythonObjects();
159 static void GetJustifiedBBox(
int rows,
int cols,
vtkTextProperty* tprop,
int bbox[4]);
163 static void RotateCorners(
double angleDeg,
double corners[4][2],
double bbox[4]);
192 static Availability CheckMPLAvailability();
198 static Availability MPLMathTextAvailable;
201 typedef std::vector<std::vector<std::string>> GridOfStrings;
209 bool ParseString(
const char* str, GridOfStrings& strGrid, std::size_t& maxNumberOfCells);
217 bool ComputeRowsAndCols(
const GridOfStrings& strGrid,
const std::size_t& maxNumberOfCells,
219 std::uint64_t& cols);
226 bool ComputeCellRowsAndCols(
const char* cellStr,
PyObject* pyFontProp,
int dpi,
227 std::uint64_t& rows, std::uint64_t& cols, vtkSmartPyObject* list);
234 bool RenderOneCell(
vtkImageData*
image,
int bbox[4], std::int64_t rowStart, std::int64_t colStart,
235 vtkSmartPyObject& pythonData, std::uint64_t pythonRows, std::uint64_t pythonCols,
236 std::uint64_t cellRows, std::uint64_t cellCols,
vtkTextProperty* tprop,
237 const TextColors& tcolors);
245 VTK_ABI_NAMESPACE_END
std::vector< int > HorizontalLinesPosition
virtual bool IsAvailable()
Returns true if mathtext rendering is available.
concrete dataset representing a path defined by Bezier curves.
virtual bool GetMetrics(vtkTextProperty *tprop, const char *str, int dpi, vtkTextRenderer::Metrics &metrics)=0
Return the metrics for the rendered str, tprop, and dpi.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Access to MatPlotLib MathText rendering.
virtual bool StringToPath(const char *str, vtkPath *path, vtkTextProperty *tprop, int dpi)=0
Parse the MathText expression in str and fill path with a contour of the glyphs.
virtual bool GetBoundingBox(vtkTextProperty *tprop, const char *str, int dpi, int bbox[4])=0
Determine the dimensions of the image that RenderString will produce for a given str, tprop, and dpi.
a simple class to control print indentation
topologically and geometrically regular array of data
represent text properties.
virtual bool RenderString(const char *str, vtkImageData *data, vtkTextProperty *tprop, int dpi, int textDims[2]=nullptr)=0
Render the given string str into the vtkImageData data with a resolution of dpi.
virtual bool GetScaleToPowerOfTwo()=0
Set to true if the graphics implementation requires texture image dimensions to be a power of two...
Abstract interface to equation rendering.
static vtkMathTextUtilities * New()
This is a singleton pattern New.
virtual void SetScaleToPowerOfTwo(bool scale)=0
Set to true if the graphics implementation requires texture image dimensions to be a power of two...
PyObject * FontPropertiesClass
std::vector< int > VerticalLinesPosition
vtkPythonInterpreter * Interpreter