switch (style) { case SkPaint::kFill_Style:
fWidth = kStrokeRec_FillStyleWidth;
fStrokeAndFill = false; break; case SkPaint::kStroke_Style:
fWidth = paint.getStrokeWidth();
fStrokeAndFill = false; break; case SkPaint::kStrokeAndFill_Style: if (0 == paint.getStrokeWidth()) { // hairline+fill == fill
fWidth = kStrokeRec_FillStyleWidth;
fStrokeAndFill = false;
} else {
fWidth = paint.getStrokeWidth();
fStrokeAndFill = true;
} break; default:
SkDEBUGFAIL("unknown paint style"); // fall back on just fill
fWidth = kStrokeRec_FillStyleWidth;
fStrokeAndFill = false; break;
}
// copy these from the paint, regardless of our "style"
fMiterLimit = paint.getStrokeMiter();
fCap = paint.getStrokeCap();
fJoin = paint.getStrokeJoin();
}
SkScalar SkStrokeRec::GetInflationRadius(SkPaint::Join join, SkScalar miterLimit, SkPaint::Cap cap,
SkScalar strokeWidth) { if (strokeWidth < 0) { // fill return 0;
} elseif (0 == strokeWidth) { // FIXME: We need a "matrixScale" parameter here in order to properly handle hairlines. // Their with is determined in device space, unlike other strokes. // http://skbug.com/8157 return SK_Scalar1;
}
// since we're stroked, outset the rect by the radius (and join type, caps)
SkScalar multiplier = SK_Scalar1; if (SkPaint::kMiter_Join == join) {
multiplier = std::max(multiplier, miterLimit);
} if (SkPaint::kSquare_Cap == cap) {
multiplier = std::max(multiplier, SK_ScalarSqrt2);
} return strokeWidth/2 * multiplier;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.