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

Method ApplyLineType

IO/ExportPDF/vtkPDFContextDevice2D.cxx:1606–1660  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1604
1605//------------------------------------------------------------------------------
1606void vtkPDFContextDevice2D::ApplyLineType(int type)
1607{
1608 // These match the OpenGL2 implementation:
1609 static const HPDF_REAL noPen[] = { 0.f, 10.f };
1610 static const HPDF_UINT noPenLen = 2;
1611
1612 static const HPDF_REAL dash[] = { 8.f };
1613 static const HPDF_UINT dashLen = 1;
1614
1615 static const HPDF_REAL dot[] = { 1.f, 7.f };
1616 static const HPDF_REAL denseDot[] = { 1.f, 3.f };
1617 static const HPDF_UINT dotLen = 2;
1618
1619 static const HPDF_REAL dashDot[] = { 4.f, 6.f, 2.f, 4.f };
1620 static const HPDF_UINT dashDotLen = 4;
1621
1622 // This is dash-dot-dash, but eh. It matches the OpenGL2 0x1C47 pattern.
1623 static const HPDF_REAL dashDotDot[] = { 3.f, 3.f, 1.f, 3.f, 3.f, 3.f };
1624 static const HPDF_UINT dashDotDotLen = 6;
1625
1626 switch (type)
1627 {
1628 default:
1629 vtkErrorMacro("Unknown line type: " << type);
1630 [[fallthrough]];
1631
1632 case vtkPen::NO_PEN:
1633 HPDF_Page_SetDash(this->Impl->Page, noPen, noPenLen, 0);
1634 break;
1635
1636 case vtkPen::SOLID_LINE:
1637 HPDF_Page_SetDash(this->Impl->Page, nullptr, 0, 0);
1638 break;
1639
1640 case vtkPen::DASH_LINE:
1641 HPDF_Page_SetDash(this->Impl->Page, dash, dashLen, 0);
1642 break;
1643
1644 case vtkPen::DOT_LINE:
1645 HPDF_Page_SetDash(this->Impl->Page, dot, dotLen, 0);
1646 break;
1647
1648 case vtkPen::DASH_DOT_LINE:
1649 HPDF_Page_SetDash(this->Impl->Page, dashDot, dashDotLen, 0);
1650 break;
1651
1652 case vtkPen::DASH_DOT_DOT_LINE:
1653 HPDF_Page_SetDash(this->Impl->Page, dashDotDot, dashDotDotLen, 0);
1654 break;
1655
1656 case vtkPen::DENSE_DOT_LINE:
1657 HPDF_Page_SetDash(this->Impl->Page, denseDot, dotLen, 0);
1658 break;
1659 }
1660}
1661
1662//------------------------------------------------------------------------------
1663void vtkPDFContextDevice2D::Stroke()

Callers 3

ApplyPenStateMethod · 0.95
DrawCrossMarkersMethod · 0.95
DrawPlusMarkersMethod · 0.95

Calls 1

HPDF_Page_SetDashFunction · 0.85

Tested by

no test coverage detected