本文整理汇总了C++中SkPoint::distanceToLineBetween方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPoint::distanceToLineBetween方法的具体用法?C++ SkPoint::distanceToLineBetween怎么用?C++ SkPoint::distanceToLineBetween使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPoint
的用法示例。
在下文中一共展示了SkPoint::distanceToLineBetween方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_vertices
static void create_vertices(const SegmentArray& segments,
const SkPoint& fanPt,
DrawArray* draws,
QuadVertex* verts,
uint16_t* idxs) {
Draw* draw = &draws->push_back();
// alias just to make vert/index assignments easier to read.
int* v = &draw->fVertexCnt;
int* i = &draw->fIndexCnt;
int count = segments.count();
for (int a = 0; a < count; ++a) {
const Segment& sega = segments[a];
int b = (a + 1) % count;
const Segment& segb = segments[b];
// Check whether adding the verts for this segment to the current draw would cause index
// values to overflow.
int vCount = 4;
if (Segment::kLine == segb.fType) {
vCount += 5;
} else {
vCount += 6;
}
if (draw->fVertexCnt + vCount > (1 << 16)) {
verts += *v;
idxs += *i;
draw = &draws->push_back();
v = &draw->fVertexCnt;
i = &draw->fIndexCnt;
}
// FIXME: These tris are inset in the 1 unit arc around the corner
verts[*v + 0].fPos = sega.endPt();
verts[*v + 1].fPos = verts[*v + 0].fPos + sega.endNorm();
verts[*v + 2].fPos = verts[*v + 0].fPos + segb.fMid;
verts[*v + 3].fPos = verts[*v + 0].fPos + segb.fNorms[0];
verts[*v + 0].fUV.set(0,0);
verts[*v + 1].fUV.set(0,-SK_Scalar1);
verts[*v + 2].fUV.set(0,-SK_Scalar1);
verts[*v + 3].fUV.set(0,-SK_Scalar1);
verts[*v + 0].fD0 = verts[*v + 0].fD1 = -SK_Scalar1;
verts[*v + 1].fD0 = verts[*v + 1].fD1 = -SK_Scalar1;
verts[*v + 2].fD0 = verts[*v + 2].fD1 = -SK_Scalar1;
verts[*v + 3].fD0 = verts[*v + 3].fD1 = -SK_Scalar1;
idxs[*i + 0] = *v + 0;
idxs[*i + 1] = *v + 2;
idxs[*i + 2] = *v + 1;
idxs[*i + 3] = *v + 0;
idxs[*i + 4] = *v + 3;
idxs[*i + 5] = *v + 2;
*v += 4;
*i += 6;
if (Segment::kLine == segb.fType) {
verts[*v + 0].fPos = fanPt;
verts[*v + 1].fPos = sega.endPt();
verts[*v + 2].fPos = segb.fPts[0];
verts[*v + 3].fPos = verts[*v + 1].fPos + segb.fNorms[0];
verts[*v + 4].fPos = verts[*v + 2].fPos + segb.fNorms[0];
// we draw the line edge as a degenerate quad (u is 0, v is the
// signed distance to the edge)
SkScalar dist = fanPt.distanceToLineBetween(verts[*v + 1].fPos,
verts[*v + 2].fPos);
verts[*v + 0].fUV.set(0, dist);
verts[*v + 1].fUV.set(0, 0);
verts[*v + 2].fUV.set(0, 0);
verts[*v + 3].fUV.set(0, -SK_Scalar1);
verts[*v + 4].fUV.set(0, -SK_Scalar1);
verts[*v + 0].fD0 = verts[*v + 0].fD1 = -SK_Scalar1;
verts[*v + 1].fD0 = verts[*v + 1].fD1 = -SK_Scalar1;
verts[*v + 2].fD0 = verts[*v + 2].fD1 = -SK_Scalar1;
verts[*v + 3].fD0 = verts[*v + 3].fD1 = -SK_Scalar1;
verts[*v + 4].fD0 = verts[*v + 4].fD1 = -SK_Scalar1;
idxs[*i + 0] = *v + 0;
idxs[*i + 1] = *v + 2;
idxs[*i + 2] = *v + 1;
idxs[*i + 3] = *v + 3;
idxs[*i + 4] = *v + 1;
idxs[*i + 5] = *v + 2;
idxs[*i + 6] = *v + 4;
idxs[*i + 7] = *v + 3;
idxs[*i + 8] = *v + 2;
*v += 5;
*i += 9;
} else {
SkPoint qpts[] = {sega.endPt(), segb.fPts[0], segb.fPts[1]};
SkVector midVec = segb.fNorms[0] + segb.fNorms[1];
midVec.normalize();
//.........这里部分代码省略.........