MCPcopy Create free account
hub / github.com/HumbleUI/Skija / drawConstraints

Method drawConstraints

examples/scenes/src/FigmaScene.java:504–570  ·  view source on GitHub ↗
(Canvas canvas)

Source from the content-addressed store, hash-verified

502 }
503
504 public void drawConstraints(Canvas canvas) {
505 try (Paint fill = new Paint();
506 Paint stroke = new Paint().setMode(PaintMode.STROKE).setStrokeWidth(1);)
507 {
508 canvas.translate(0, 16);
509 canvas.save();
510 canvas.translate(16, 0);
511 fill.setColor(0xFF333333);
512 drawTextLeft(canvas, "Constraints", 0, 0, 16, uiFontBold, fill);
513 canvas.restore();
514 canvas.translate(0, 32);
515
516 canvas.save();
517 canvas.translate(16, 0);
518 stroke.setColor(0xFFE5E5E5);
519 canvas.drawRRect(RRect.makeXYWH(1.5f, 1.5f, 62, 62, 3), stroke);
520 try (var dash = PathEffect.makeDash(new float[] {3, 2}, 0)) {
521 stroke.setPathEffect(dash);
522 canvas.drawRRect(RRect.makeXYWH(20.5f, 20.5f, 24, 24, 2), stroke);
523 stroke.setPathEffect(null);
524 }
525 stroke.setColor(0xFF333333);
526 canvas.drawLine(24, 32.5f, 41, 32.5f, stroke);
527 canvas.drawLine(32.5f, 24, 32.5f, 41, stroke);
528 canvas.drawLine(49, 32.5f, 59, 32.5f, stroke);
529 canvas.drawLine(32.5f, 49, 32.5f, 59, stroke);
530 fill.setColor(0xFF18A0FB);
531 canvas.drawRect(Rect.makeXYWH(31, 6, 3, 10), fill);
532 canvas.drawRect(Rect.makeXYWH(6, 31, 10, 3), fill);
533
534 canvas.translate(80, 8);
535 canvas.save();
536 stroke.setColor(0xFFB3B3B3);
537 canvas.drawPath(icons.get("Constraints Horizontal"), stroke);
538 canvas.translate(24, 0);
539 fill.setColor(0xFF333333);
540 float w = drawTextLeft(canvas, "Left", 0, 0, 16, uiFont, fill);
541 canvas.translate(w + 6, 7);
542 canvas.drawPath(icons.get("Chevron"), stroke);
543 canvas.restore();
544
545 canvas.translate(0, 32);
546 canvas.save();
547 canvas.drawPath(icons.get("Constraints Vertical"), stroke);
548 canvas.translate(24, 0);
549 w = drawTextLeft(canvas, "Top", 0, 0, 16, uiFont, fill);
550 canvas.translate(w + 6, 7);
551 canvas.drawPath(icons.get("Chevron"), stroke);
552 canvas.restore();
553
554 canvas.restore();
555 canvas.translate(0, 80);
556
557 canvas.save();
558 canvas.translate(16, 0);
559 stroke.setColor(0xFF333333);
560 canvas.drawPath(icons.get("Unchecked"), stroke);
561 canvas.translate(24, 0);

Callers 1

drawRightMethod · 0.95

Calls 14

drawTextLeftMethod · 0.95
makeDashMethod · 0.95
setStrokeWidthMethod · 0.80
setModeMethod · 0.80
saveMethod · 0.80
restoreMethod · 0.80
drawRRectMethod · 0.80
setPathEffectMethod · 0.80
drawRectMethod · 0.80
getMethod · 0.80
translateMethod · 0.45
setColorMethod · 0.45

Tested by

no test coverage detected