------------------------------------------------------------------------------
| 1088 | |
| 1089 | //------------------------------------------------------------------------------ |
| 1090 | void vtkOpenGLGL2PSHelperImpl::DrawPathSVG(vtkPath* path, double rasterPos[3], double windowPos[2], |
| 1091 | unsigned char rgba[4], double scale[2], double rotateAngle, float strokeWidth, |
| 1092 | const std::string& label) |
| 1093 | { |
| 1094 | vtkFloatArray* points = vtkArrayDownCast<vtkFloatArray>(path->GetPoints()->GetData()); |
| 1095 | vtkIntArray* codes = path->GetCodes(); |
| 1096 | |
| 1097 | if (points->GetNumberOfTuples() != codes->GetNumberOfTuples()) |
| 1098 | { |
| 1099 | return; |
| 1100 | } |
| 1101 | |
| 1102 | std::stringstream out; |
| 1103 | out.setf(std::ios_base::left | std::ios_base::fixed); |
| 1104 | |
| 1105 | constexpr int floatPrec = 2; |
| 1106 | constexpr int floatWidth = 6; |
| 1107 | out.precision(floatPrec); |
| 1108 | out.width(floatWidth); |
| 1109 | |
| 1110 | float curveto[3][2]; |
| 1111 | float curX = 0; |
| 1112 | float curY = 0; |
| 1113 | |
| 1114 | float* pt = points->GetPointer(0); |
| 1115 | int* code = codes->GetPointer(0); |
| 1116 | |
| 1117 | double windowHeight = static_cast<double>(this->RenderWindow->GetSize()[1]); |
| 1118 | |
| 1119 | // These are only used in an assertion, ifdef silences warning on non-debug |
| 1120 | // builds |
| 1121 | #ifndef NDEBUG |
| 1122 | float* ptBegin = pt; |
| 1123 | int* codeBegin = code; |
| 1124 | #endif |
| 1125 | |
| 1126 | if (!label.empty()) |
| 1127 | { |
| 1128 | out << "<!-- " << label << " -->" << endl; |
| 1129 | } |
| 1130 | |
| 1131 | int* codeEnd = code + codes->GetNumberOfTuples(); |
| 1132 | out << "<g transform=\"" << endl |
| 1133 | << " translate(" << windowPos[0] << " " << windowHeight - windowPos[1] << ")" << endl; |
| 1134 | if (scale) |
| 1135 | { |
| 1136 | out << " scale(" << scale[0] << " " << -scale[1] << ")" << endl; |
| 1137 | } |
| 1138 | else |
| 1139 | { |
| 1140 | out << " scale(1.0 -1.0)" << endl; |
| 1141 | } |
| 1142 | out << " rotate(" << rotateAngle << ")\"" << endl; |
| 1143 | if (strokeWidth > 1e-5) |
| 1144 | { |
| 1145 | out << " fill=\"none\"" << endl |
| 1146 | << " stroke-width=\"" << strokeWidth << "\"" << endl |
| 1147 | << " stroke=\"rgb(" << std::setprecision(0) << static_cast<int>(rgba[0]) << "," |
no test coverage detected