| 69 | } |
| 70 | |
| 71 | void 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 | |
| 95 | void 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) |
no test coverage detected