------------------------------------------------------------------------------
| 960 | |
| 961 | //------------------------------------------------------------------------------ |
| 962 | bool vtkMatplotlibMathTextUtilities::RenderOneCell(vtkImageData* image, int bbox[4], |
| 963 | std::int64_t rowStart, std::int64_t colStart, vtkSmartPyObject& pythonData, |
| 964 | std::uint64_t pythonRows, std::uint64_t pythonCols, std::uint64_t cellRows, |
| 965 | std::uint64_t cellCols, vtkTextProperty* tprop, const TextColors& tcolors) |
| 966 | { |
| 967 | vtkDebugMacro("RenderOneCell start = (" |
| 968 | << rowStart << "," << colStart << "). Drawing python data of size (" << pythonRows << "," |
| 969 | << pythonCols << ") inside a cell of size (" << cellRows << "," << cellCols << ")."); |
| 970 | |
| 971 | assert(cellCols >= pythonCols); |
| 972 | assert(cellRows >= pythonRows); |
| 973 | |
| 974 | const std::int64_t rowEnd = rowStart - cellRows + 1; |
| 975 | const std::int64_t colEnd = colStart + cellCols - 1; |
| 976 | |
| 977 | // Handle cell horizontal justification |
| 978 | std::uint64_t colOffset; |
| 979 | switch (tprop->GetJustification()) |
| 980 | { |
| 981 | default: |
| 982 | case VTK_TEXT_LEFT: |
| 983 | colOffset = 0; |
| 984 | break; |
| 985 | case VTK_TEXT_CENTERED: |
| 986 | colOffset = (cellCols - pythonCols) / 2; |
| 987 | break; |
| 988 | case VTK_TEXT_RIGHT: |
| 989 | colOffset = (cellCols - pythonCols); |
| 990 | break; |
| 991 | } |
| 992 | const std::int64_t pythonColStart = colStart + colOffset; |
| 993 | const std::int64_t pythonColEnd = pythonColStart + pythonCols; |
| 994 | |
| 995 | // Handle cell vertical justification |
| 996 | std::uint64_t rowOffset; |
| 997 | switch (tprop->GetVerticalJustification()) |
| 998 | { |
| 999 | default: |
| 1000 | case VTK_TEXT_BOTTOM: |
| 1001 | rowOffset = (cellRows - pythonRows); |
| 1002 | break; |
| 1003 | case VTK_TEXT_CENTERED: |
| 1004 | rowOffset = (cellRows - pythonRows) / 2; |
| 1005 | break; |
| 1006 | case VTK_TEXT_TOP: |
| 1007 | rowOffset = 0; |
| 1008 | break; |
| 1009 | } |
| 1010 | const std::int64_t pythonRowStart = rowStart - rowOffset; |
| 1011 | const std::int64_t pythonRowEnd = pythonRowStart - pythonRows; |
| 1012 | |
| 1013 | std::uint64_t ind = 0; |
| 1014 | for (std::int64_t row = rowStart; row >= rowEnd; --row) |
| 1015 | { |
| 1016 | for (std::int64_t col = colStart; col <= colEnd; ++col) |
| 1017 | { |
| 1018 | unsigned char* ptr = static_cast<unsigned char*>(image->GetScalarPointer(col, row, 0)); |
| 1019 |
no test coverage detected