if (SkScalarNearlyEqual(startAngle, endAngle, SkGradientBaseShader::kDegenerateThreshold)) { // Degenerate gradient, which should follow default degenerate behavior unless it is // clamped and the angle is greater than 0. if (mode == SkTileMode::kClamp && endAngle > SkGradientBaseShader::kDegenerateThreshold) { // In this case, the first color is repeated from 0 to the angle, then a hardstop // switches to the last color (all other colors are compressed to the infinitely thin // interpolation region). static constexpr float clampPos[3] = {0, 1, 1};
SkSpan<const SkColor4f> srcColors = colors.colors(); const SkColor4f reColors[3] = {
srcColors.front(), srcColors.front(), srcColors.back()
};
SkGradient::Colors newColors = {
reColors, clampPos, colors.tileMode(), colors.colorSpace()
}; return SkShaders::SweepGradient(center, 0, endAngle, {newColors, interp}, lm);
} else { return SkGradientBaseShader::MakeDegenerateGradient(colors);
}
}
if (startAngle <= 0 && endAngle >= 360) { // If the t-range includes [0,1], then we can always use clamping (presumably faster).
mode = SkTileMode::kClamp;
}
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.