 |
VTK
9.1.0
|
Go to the documentation of this file.
47 #ifndef vtkMatplotlibMathTextUtilities_h
48 #define vtkMatplotlibMathTextUtilities_h
51 #include "vtkRenderingMatplotlibModule.h"
57 class vtkSmartPyObject;
60 class vtkPythonInterpreter;
98 int textDims[2] =
nullptr)
override;
138 static constexpr
const char* PipeProtectString =
"VTK_PROTECT_PIPE";
173 static void RotateCorners(
double angleDeg,
double corners[4][2],
double bbox[4]);
199 static Availability CheckMPLAvailability();
205 static Availability MPLMathTextAvailable;
208 typedef std::vector<std::vector<std::string>> GridOfStrings;
216 bool ParseString(
const char* str, GridOfStrings& strGrid, std::size_t& maxNumberOfCells);
224 bool ComputeRowsAndCols(
const GridOfStrings& strGrid,
const std::size_t& maxNumberOfCells,
226 std::uint64_t& cols);
233 bool ComputeCellRowsAndCols(
const char* cellStr,
PyObject* pyFontProp,
int dpi,
234 std::uint64_t& rows, std::uint64_t& cols, vtkSmartPyObject* list);
241 bool RenderOneCell(
vtkImageData*
image,
int bbox[4],
const std::int64_t rowStart,
242 const std::int64_t colStart, vtkSmartPyObject& pythonData,
const std::uint64_t pythonRows,
243 const std::uint64_t pythonCols,
const std::uint64_t cellRows,
const std::uint64_t cellCols,
static vtkMatplotlibMathTextUtilities * New()
PyObject * GetFontProperties(vtkTextProperty *tprop)
Returns a matplotlib.font_manager.FontProperties PyObject, initialized from the vtkTextProperty tprop...
bool StringToPath(const char *str, vtkPath *path, vtkTextProperty *tprop, int dpi) override
Parse the MathText expression in str and fill path with a contour of the glyphs.
Access to MatPlotLib MathText rendering.
bool InitializeMaskParser()
~vtkMatplotlibMathTextUtilities() override
concrete dataset representing a path defined by Bezier curves.
void SetScaleToPowerOfTwo(bool val) override
Set to true if the graphics implementation requires texture image dimensions to be a power of two.
void ComputeTextColors(vtkTextProperty *tprop, TextColors &tcolors)
Compute rgba values of the foreground, background and frame of the text property.
void FindAndReplaceInString(std::string &str, const std::string &strToFind, const std::string &replacementStr)
Replace each occurence of strToFind in str by replacementStr.
Abstract interface to equation rendering.
bool GetBoundingBox(vtkTextProperty *tprop, const char *str, int dpi, int bbox[4]) override
Given a text property and a string, get the bounding box {xmin, xmax, ymin, ymax} of the rendered str...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool GetScaleToPowerOfTwo() override
Set to true if the graphics implementation requires texture image dimensions to be a power of two.
bool GetMetrics(vtkTextProperty *tprop, const char *str, int dpi, vtkTextRenderer::Metrics &metrics) override
Return the metrics for the rendered str, tprop, and dpi.
bool RenderString(const char *str, vtkImageData *image, vtkTextProperty *tprop, int dpi, int textDims[2]=nullptr) override
Render the given string str into the vtkImageData image with a resolution of dpi.
topologically and geometrically regular array of data
a simple class to control print indentation
bool SetMathTextFont(vtkTextProperty *tprop)
Modify matplotlib.rcParams to customize math text font.
bool CheckForError(PyObject *object)
PyObject * FontPropertiesClass
static void RotateCorners(double angleDeg, double corners[4][2], double bbox[4])
represent text properties.
bool InitializePathParser()
vtkMatplotlibMathTextUtilities()
bool InitializeFontPropertiesClass()
void CleanupPythonObjects()
Cleanup and destroy any python objects.
bool PrepareImageData(vtkImageData *data, int bbox[4])
vtkPythonInterpreter * Interpreter
static void GetJustifiedBBox(int rows, int cols, vtkTextProperty *tprop, int bbox[4])
bool IsAvailable() override
Returns true if mathtext rendering is available.