MCPcopy Create free account
hub / github.com/Kitware/VTK / DrawEllipticArc

Method DrawEllipticArc

IO/ExportPDF/vtkPDFContextDevice2D.cxx:1174–1217  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1172
1173//------------------------------------------------------------------------------
1174void 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//------------------------------------------------------------------------------
1220void vtkPDFContextDevice2D::DrawString(float* point, const vtkStdString& string)

Callers 1

PaintMethod · 0.45

Calls 11

PushGraphicsStateMethod · 0.95
ApplyPenStateMethod · 0.95
ApplyBrushStateMethod · 0.95
FillMethod · 0.95
StrokeMethod · 0.95
PopGraphicsStateMethod · 0.95
HPDF_Page_EllipseFunction · 0.85
HPDF_Page_ArcFunction · 0.85
HPDF_Page_ClosePathFunction · 0.85
assertFunction · 0.50

Tested by 1

PaintMethod · 0.36