------------------------------------------------------------------------------
| 1172 | |
| 1173 | //------------------------------------------------------------------------------ |
| 1174 | void vtkPDFContextDevice2D::DrawEllipticArc( |
| 1175 | float x, float y, float rX, float rY, float startAngle, float stopAngle) |
| 1176 | { |
| 1177 | assert("pre: positive_rX" && rX >= 0); |
| 1178 | assert("pre: positive_rY" && rY >= 0); |
| 1179 | |
| 1180 | this->PushGraphicsState(); |
| 1181 | this->ApplyPenState(); |
| 1182 | this->ApplyBrushState(); |
| 1183 | |
| 1184 | // If we're drawing a complete ellipse, just use the built-in ellipse call: |
| 1185 | if (std::fabs(stopAngle - startAngle) >= 360.f) |
| 1186 | { |
| 1187 | HPDF_Page_Ellipse(this->Impl->Page, x, y, rX, rY); |
| 1188 | this->Fill(true); |
| 1189 | } |
| 1190 | // If we're drawing circles, use the built-in arc calls: |
| 1191 | else if (rX == rY) |
| 1192 | { |
| 1193 | // VTK uses 0 degrees = East with CCW rotation, but |
| 1194 | // Haru uses 0 degrees = North with CW rotation. Adjust for this: |
| 1195 | float hStart = -(stopAngle - 90.f); |
| 1196 | float hStop = -(startAngle - 90.f); |
| 1197 | |
| 1198 | HPDF_Page_Arc(this->Impl->Page, x, y, rX, hStart, hStop); |
| 1199 | HPDF_Page_ClosePath(this->Impl->Page); |
| 1200 | this->Fill(); |
| 1201 | HPDF_Page_Arc(this->Impl->Page, x, y, rX, hStart, hStop); |
| 1202 | this->Stroke(); |
| 1203 | } |
| 1204 | else |
| 1205 | { |
| 1206 | // Haru doesn't support drawing ellipses that have start/stop angles. |
| 1207 | // You can either do an ellipse or a circle with start/stop, but not both. |
| 1208 | // We if have to do both, we'll need to rasterize the path. |
| 1209 | this->DrawEllipticArcSegments(x, y, rX, rY, startAngle, stopAngle, true); |
| 1210 | HPDF_Page_ClosePath(this->Impl->Page); |
| 1211 | this->Fill(); |
| 1212 | this->DrawEllipticArcSegments(x, y, rX, rY, startAngle, stopAngle, true); |
| 1213 | this->Stroke(); |
| 1214 | } |
| 1215 | |
| 1216 | this->PopGraphicsState(); |
| 1217 | } |
| 1218 | |
| 1219 | //------------------------------------------------------------------------------ |
| 1220 | void vtkPDFContextDevice2D::DrawString(float* point, const vtkStdString& string) |