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

Method DrawEllipseWedge

IO/ExportPDF/vtkPDFContextDevice2D.cxx:1100–1171  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1098
1099//------------------------------------------------------------------------------
1100void vtkPDFContextDevice2D::DrawEllipseWedge(float x, float y, float outRx, float outRy, float inRx,
1101 float inRy, float startAngle, float stopAngle)
1102{
1103 assert("pre: positive_outRx" && outRx >= 0.0f);
1104 assert("pre: positive_outRy" && outRy >= 0.0f);
1105 assert("pre: positive_inRx" && inRx >= 0.0f);
1106 assert("pre: positive_inRy" && inRy >= 0.0f);
1107 assert("pre: ordered_rx" && inRx <= outRx);
1108 assert("pre: ordered_ry" && inRy <= outRy);
1109
1110 this->PushGraphicsState();
1111 this->ApplyBrushState();
1112
1113 // Register the bounds of the outer ellipse:
1114 float bounds[8] = { x - outRx, y - outRy, x - outRx, y + outRy, x + outRx, y + outRy, x + outRx,
1115 y - outRy };
1116 this->RegisterTexturePoints(bounds, 4);
1117
1118 // If we're drawing a complete ellipse, just use the built-in ellipse call:
1119 if (std::fabs(stopAngle - startAngle) >= 360.f)
1120 {
1121 HPDF_Page_Ellipse(this->Impl->Page, x, y, outRx, outRy);
1122 if (inRx > 0.f || inRy > 0.f)
1123 {
1124 HPDF_Page_Ellipse(this->Impl->Page, x, y, inRx, inRy);
1125 this->FillEvenOdd();
1126 }
1127 else
1128 {
1129 this->Fill();
1130 }
1131 }
1132 // If we're drawing circles, use the built-in arc calls:
1133 else if (inRx == inRy && outRx == outRy)
1134 {
1135 // VTK uses 0 degrees = East with CCW rotation, but
1136 // Haru uses 0 degrees = North with CW rotation. Adjust for this:
1137 float hStart = -(stopAngle - 90.f);
1138 float hStop = -(startAngle - 90.f);
1139
1140 HPDF_Page_Arc(this->Impl->Page, x, y, outRx, hStart, hStop);
1141 if (inRx > 0.f)
1142 {
1143 HPDF_Page_Arc(this->Impl->Page, x, y, inRx, hStart, hStop);
1144 this->FillEvenOdd();
1145 }
1146 else
1147 {
1148 this->Fill();
1149 }
1150 }
1151 else
1152 {
1153 // Haru doesn't support drawing ellipses that have start/stop angles.
1154 // You can either do an ellipse or a circle with start/stop, but not both.
1155 // We if have to do both, we'll need to rasterize the path.
1156 this->DrawEllipticArcSegments(x, y, outRx, outRy, startAngle, stopAngle, true);
1157 if (inRx > 0 || inRy > 0.f)

Callers 1

PaintMethod · 0.45

Calls 11

PushGraphicsStateMethod · 0.95
ApplyBrushStateMethod · 0.95
RegisterTexturePointsMethod · 0.95
FillEvenOddMethod · 0.95
FillMethod · 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