216 {
217 constexpr AddSegmentFunc gSegmentFunctions[] = {
218 AddMove,
219 AddMoveClose,
220 AddDegenLine,
221 AddMoveDegenLine,
222 AddMoveDegenLineClose,
223 AddDegenQuad,
224 AddMoveDegenQuad,
225 AddMoveDegenQuadClose,
226 AddDegenCubic,
227 AddMoveDegenCubic,
228 AddMoveDegenCubicClose,
229 AddClose,
230 AddLine,
231 AddMoveLine,
232 AddMoveLineClose,
233 AddQuad,
234 AddMoveQuad,
235 AddMoveQuadClose,
236 AddCubic,
237 AddMoveCubic,
238 AddMoveCubicClose
239 };
240 const char* gSegmentNames[] = {
241 "Move",
242 "MoveClose",
243 "DegenLine",
244 "MoveDegenLine",
245 "MoveDegenLineClose",
246 "DegenQuad",
247 "MoveDegenQuad",
248 "MoveDegenQuadClose",
249 "DegenCubic",
250 "MoveDegenCubic",
251 "MoveDegenCubicClose",
252 "Close",
253 "Line",
254 "MoveLine",
255 "MoveLineClose",
256 "Quad",
257 "MoveQuad",
258 "MoveQuadClose",
259 "Cubic",
260 "MoveCubic",
261 "MoveCubicClose"
262 };
263
264 struct FillAndName {
267 };
268 constexpr FillAndName gFills[] = {
273 };
274 struct StyleAndName {
277 };
278 constexpr StyleAndName
gStyles[] = {
282 };
283 struct CapAndName {
287 };
288 constexpr CapAndName gCaps[] = {
292 };
293
298 const char title[] = "Random Paths Drawn Into Rectangle Clips With "
299 "Indicated Style, Fill and Linecaps, "
300 "with Stroke width 6";
301 canvas->
drawString(title, 20, 20, font, titlePaint);
302
308 unsigned numSegments = std::size(gSegmentFunctions);
309 unsigned numCaps = std::size(gCaps);
310 unsigned numStyles = std::size(
gStyles);
311 unsigned numFills = std::size(gFills);
312 for (size_t row = 0; row < 6; ++row) {
313 if (0 < row) {
315 }
317 for (size_t column = 0; column < 4; ++column) {
318 if (0 < column) {
320 }
321
323 StyleAndName style =
gStyles[(rand.
nextU() >> 16) % numStyles];
324 CapAndName cap = gCaps[(rand.
nextU() >> 16) % numCaps];
325 FillAndName fill = gFills[(rand.
nextU() >> 16) % numFills];
326 unsigned s1 = (rand.
nextU() >> 16) % numSegments;
327 unsigned s2 = (rand.
nextU() >> 16) % numSegments;
328 unsigned s3 = (rand.
nextU() >> 16) % numSegments;
329 unsigned s4 = (rand.
nextU() >> 16) % numSegments;
330 unsigned s5 = (rand.
nextU() >> 16) % numSegments;
333 pt = gSegmentFunctions[s1](
path, pt);
334 pt = gSegmentFunctions[s2](
path, pt);
335 pt = gSegmentFunctions[s3](
path, pt);
336 pt = gSegmentFunctions[s4](
path, pt);
337 pt = gSegmentFunctions[s5](
path, pt);
338
339 this->drawPath(
path.detach(), canvas,
color, rect,
340 cap.fCap, cap.fJoin, style.fStyle,
342
349
354 canvas->
drawString(style.fName, 0,
rect.height() + 12, font, labelPaint);
355 canvas->
drawString(fill.fName, 0,
rect.height() + 24, font, labelPaint);
356 canvas->
drawString(cap.fName, 0,
rect.height() + 36, font, labelPaint);
357 canvas->
drawString(gSegmentNames[s1], 0,
rect.height() + 48, font, labelPaint);
358 canvas->
drawString(gSegmentNames[s2], 0,
rect.height() + 60, font, labelPaint);
359 canvas->
drawString(gSegmentNames[s3], 0,
rect.height() + 72, font, labelPaint);
360 canvas->
drawString(gSegmentNames[s4], 0,
rect.height() + 84, font, labelPaint);
361 canvas->
drawString(gSegmentNames[s5], 0,
rect.height() + 96, font, labelPaint);
362 }
364 }
367 }
SkStrokeRec::Style fStyle
constexpr SkColor SK_ColorBLACK
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
@ kButt_Cap
no stroke extension
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
@ kStrokeAndFill_Style
sets to stroke and fill geometry
@ kBevel_Join
connects outside edges
void setStrokeWidth(SkScalar width)
sk_sp< SkBlender > blender SkRect rect
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
font
Font Metadata and Metrics.
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkFontStyle gStyles[]