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

Function PolygonToShading

IO/ExportPDF/vtkPDFContextDevice2D.cxx:71–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void PolygonToShading(
72 float* points, int numPoints, unsigned char* colors, int nc_comps, HPDF_Shading shading)
73{
74 assert(numPoints >= 3);
75
76 // First triangle
77 for (int ptIdx = 0; ptIdx < 3; ++ptIdx)
78 {
79 const float* pt = points + ptIdx * 2;
80 const unsigned char* color = colors + ptIdx * nc_comps;
81 HPDF_Shading_AddVertexRGB(shading, HPDF_FREE_FORM_TRI_MESH_EDGEFLAG_NO_CONNECTION, pt[0], pt[1],
82 color[0], color[1], color[2]);
83 }
84
85 // Fan-out additional verts
86 for (int ptIdx = 3; ptIdx < numPoints; ++ptIdx)
87 {
88 const float* pt = points + ptIdx * 2;
89 const unsigned char* color = colors + ptIdx * nc_comps;
90 HPDF_Shading_AddVertexRGB(
91 shading, HPDF_FREE_FORM_TRI_MESH_EDGEFLAG_AC, pt[0], pt[1], color[0], color[1], color[2]);
92 }
93}
94
95void LineSegmentToShading(const float p1[2], const unsigned char rgb1[3], const float p2[2],
96 const unsigned char rgb2[3], float radius, HPDF_Shading shading)

Callers 3

LineSegmentToShadingFunction · 0.85
DrawColoredPolygonMethod · 0.85
DrawPolyDataMethod · 0.85

Calls 2

assertFunction · 0.50

Tested by

no test coverage detected