Lines Matching refs:CanvasKit
18 const paint = new CanvasKit.Paint();
21 paint.setColor(CanvasKit.Color(0, 0, 0, 1.0));
22 paint.setStyle(CanvasKit.PaintStyle.Stroke);
25 const rrect = CanvasKit.RRectXY([5, 35, 45, 80], 15, 10);
28 canvas.drawOval(CanvasKit.LTRBRect(5, 35, 45, 80), paint);
30 canvas.drawArc(CanvasKit.LTRBRect(55, 35, 95, 80), 15, 270, true, paint);
32 const font = new CanvasKit.Font(null, 20);
35 const blob = CanvasKit.TextBlob.MakeFromText('Unicode chars é É ص', font);
45 const path = starPath(CanvasKit);
46 const paint = new CanvasKit.Paint();
48 const textPaint = new CanvasKit.Paint();
49 textPaint.setColor(CanvasKit.Color(40, 0, 0, 1.0));
52 const textFont = new CanvasKit.Font(null, 30);
54 const dpe = CanvasKit.PathEffect.MakeDash([15, 5, 5, 10], 1);
57 paint.setStyle(CanvasKit.PaintStyle.Stroke);
60 paint.setColor(CanvasKit.Color(66, 129, 164, 1.0));
62 canvas.clear(CanvasKit.Color(255, 255, 255, 1.0));
75 canvas.clear(CanvasKit.WHITE);
76 const path = starPath(CanvasKit, 100, 100, 100);
77 const paint = new CanvasKit.Paint();
79 const cornerEffect = CanvasKit.PathEffect.MakeCorner(10);
80 const discreteEffect = CanvasKit.PathEffect.MakeDiscrete(5, 10, 0);
83 paint.setStyle(CanvasKit.PaintStyle.Stroke);
86 paint.setColor(CanvasKit.Color(66, 129, 164, 1.0));
100 const canvas = new CanvasKit.Canvas();
119 const path = starPath(CanvasKit);
121 const paint = new CanvasKit.Paint();
123 paint.setStyle(CanvasKit.PaintStyle.Stroke);
126 paint.setColor(CanvasKit.CYAN);
128 canvas.clear(CanvasKit.WHITE);
132 paint.setStyle(CanvasKit.PaintStyle.Fill);
133 paint.setColor(CanvasKit.RED);
142 const path = starPath(CanvasKit);
144 const paint = new CanvasKit.Paint();
146 paint.setStyle(CanvasKit.PaintStyle.Stroke);
149 paint.setColor(CanvasKit.BLACK);
151 canvas.clear(CanvasKit.WHITE);
153 canvas.drawRRect(CanvasKit.RRectXY(
154 CanvasKit.LTRBRect(10, 10, 50, 50), 5, 10), paint);
156 canvas.drawRRect(CanvasKit.RRectXY(
157 CanvasKit.LTRBRect(60, 10, 110, 50), 10, 5), paint);
159 canvas.drawRRect(CanvasKit.RRectXY(
160 CanvasKit.LTRBRect(10, 60, 210, 260), 0, 30), paint);
162 canvas.drawRRect(CanvasKit.RRectXY(
163 CanvasKit.LTRBRect(50, 90, 160, 210), 30, 30), paint);
170 const path = starPath(CanvasKit);
172 const paint = new CanvasKit.Paint();
174 paint.setStyle(CanvasKit.PaintStyle.Stroke);
177 paint.setColor(CanvasKit.BLACK);
179 canvas.clear(CanvasKit.WHITE);
195 const path = starPath(CanvasKit);
197 const paint = new CanvasKit.Paint();
199 paint.setStyle(CanvasKit.PaintStyle.Stroke);
202 paint.setColor(CanvasKit.BLACK);
204 canvas.clear(CanvasKit.WHITE);
206 const rrect = CanvasKit.Malloc(Float32Array, 12);
217 CanvasKit.Free(rrect);
223 const path = starPath(CanvasKit);
225 const paint = new CanvasKit.Paint();
227 paint.setStyle(CanvasKit.PaintStyle.Fill);
230 paint.setColor(CanvasKit.BLACK);
232 canvas.clear(CanvasKit.WHITE);
234 const outer = CanvasKit.RRectXY(CanvasKit.LTRBRect(10, 60, 210, 260), 10, 5);
235 const inner = CanvasKit.RRectXY(CanvasKit.LTRBRect(50, 90, 160, 210), 30, 30);
244 const paint = new CanvasKit.Paint();
246 const blue = CanvasKit.ColorFilter.MakeBlend(
247 CanvasKit.BLUE, CanvasKit.BlendMode.SrcIn);
248 const red = CanvasKit.ColorFilter.MakeBlend(
249 CanvasKit.Color(255, 0, 0, 0.8), CanvasKit.BlendMode.SrcOver);
250 const lerp = CanvasKit.ColorFilter.MakeLerp(0.6, red, blue);
252 paint.setStyle(CanvasKit.PaintStyle.Fill);
255 canvas.clear(CanvasKit.Color(230, 230, 230));
258 canvas.drawRect(CanvasKit.LTRBRect(10, 10, 60, 60), paint);
260 canvas.drawRect(CanvasKit.LTRBRect(50, 10, 100, 60), paint);
264 const r = CanvasKit.ColorMatrix.rotated(0, .707, -.707);
265 const b = CanvasKit.ColorMatrix.rotated(2, .5, .866);
266 const s = CanvasKit.ColorMatrix.scaled(0.9, 1.5, 0.8, 0.8);
267 let cm = CanvasKit.ColorMatrix.concat(r, s);
268 cm = CanvasKit.ColorMatrix.concat(cm, b);
269 CanvasKit.ColorMatrix.postTranslate(cm, 20, 0, -10, 0);
271 const mat = CanvasKit.ColorFilter.MakeMatrix(cm);
272 const final = CanvasKit.ColorFilter.MakeCompose(mat, lerp);
275 canvas.drawRect(CanvasKit.LTRBRect(10, 70, 140, 120), paint);
285 canvas.clear(CanvasKit.WHITE);
287 const blendModeNames = Object.keys(CanvasKit.BlendMode).filter((key) => key !== 'values');
289 const PASTEL_MUSTARD_YELLOW = CanvasKit.Color(248, 213, 85, 1.0);
290 const PASTEL_SKY_BLUE = CanvasKit.Color(74, 174, 245, 1.0);
292 const shapePaint = new CanvasKit.Paint();
296 const textPaint = new CanvasKit.Paint();
299 const textFont = new CanvasKit.Font(null, 10);
311 const blendMode = CanvasKit.BlendMode[blendModeName];
312 canvas.drawOval(CanvasKit.LTRBRect(x + 5, y + 5, x + 55, y + 55), shapePaint);
324 const GREY = CanvasKit.Color(220, 220, 220, 0.5);
326 drawRectangle(x1-1, y1-1, x2+1, y2+1, CanvasKit.BLACK);
327 drawRectangle(x1, y1, x2, y2, CanvasKit.WHITE);
351 function drawRectangle(x1, y1, x2, y2, color, blendMode=CanvasKit.BlendMode.srcOver) {
353 canvas.clipRect(CanvasKit.LTRBRect(x1, y1, x2, y2), CanvasKit.ClipOp.Intersect, true);
360 const paint = new CanvasKit.Paint();
368 const colorObj = new CanvasKit.Malloc(Float32Array, 20);
374 const final = CanvasKit.ColorFilter.MakeMatrix(cm);
377 canvas.drawRect(CanvasKit.LTRBRect(10, 70, 140, 120), paint);
379 CanvasKit.Free(colorObj);
385 const path = starPath(CanvasKit);
386 const paint = new CanvasKit.Paint();
387 paint.setColor(CanvasKit.BLUE);
388 const rrect = CanvasKit.RRectXY(CanvasKit.LTRBRect(300, 300, 500, 500), 40, 40);
392 canvas.clipRRect(rrect, CanvasKit.ClipOp.Difference, true);
393 canvas.drawColorComponents(250/255, 30/255, 240/255, 0.9, CanvasKit.BlendMode.SrcOver);
397 canvas.clipPath(path, CanvasKit.ClipOp.Intersect, false);
398 canvas.drawColorInt(CanvasKit.ColorAsInt(200, 200, 200, 255), CanvasKit.BlendMode.SrcOver);
407 canvas.clear(CanvasKit.WHITE);
408 const redPaint = new CanvasKit.Paint();
409 redPaint.setColor(CanvasKit.RED);
410 const solidBluePaint = new CanvasKit.Paint();
411 solidBluePaint.setColor(CanvasKit.BLUE);
413 const thirtyBluePaint = new CanvasKit.Paint();
414 thirtyBluePaint.setColor(CanvasKit.BLUE);
417 const alpha = new CanvasKit.Paint();
421 canvas.drawRect(CanvasKit.LTRBRect(10, 10, 60, 60), redPaint);
422 canvas.drawRect(CanvasKit.LTRBRect(150, 10, 200, 60), redPaint);
423 canvas.drawRect(CanvasKit.LTRBRect(10, 70, 60, 120), redPaint);
424 canvas.drawRect(CanvasKit.LTRBRect(150, 70, 200, 120), redPaint);
429 canvas.drawRect(CanvasKit.LTRBRect(30, 10, 80, 60), solidBluePaint);
430 canvas.drawRect(CanvasKit.LTRBRect(170, 10, 220, 60), thirtyBluePaint);
439 canvas.saveLayer(alpha, CanvasKit.LTRBRect(10, 10, 220, 180));
444 canvas.drawRect(CanvasKit.LTRBRect(30, 70, 80, 120), solidBluePaint);
445 canvas.drawRect(CanvasKit.LTRBRect(170, 70, 220, 120), thirtyBluePaint);
451 canvas.drawRect(CanvasKit.LTRBRect(10, 130, 60, 180), redPaint);
452 canvas.drawRect(CanvasKit.LTRBRect(30, 130, 80, 180), solidBluePaint);
454 canvas.drawRect(CanvasKit.LTRBRect(150, 130, 200, 180), redPaint);
455 canvas.drawRect(CanvasKit.LTRBRect(170, 130, 220, 180), thirtyBluePaint);
468 canvas.clear(CanvasKit.WHITE);
469 const redPaint = new CanvasKit.Paint();
470 redPaint.setColor(CanvasKit.RED);
471 const solidBluePaint = new CanvasKit.Paint();
472 solidBluePaint.setColor(CanvasKit.BLUE);
474 const thirtyBluePaint = new CanvasKit.Paint();
475 thirtyBluePaint.setColor(CanvasKit.BLUE);
478 const alpha = new CanvasKit.Paint();
482 canvas.drawRect(CanvasKit.LTRBRect(10, 10, 60, 60), redPaint);
483 canvas.drawRect(CanvasKit.LTRBRect(150, 10, 200, 60), redPaint);
484 canvas.drawRect(CanvasKit.LTRBRect(10, 70, 60, 120), redPaint);
485 canvas.drawRect(CanvasKit.LTRBRect(150, 70, 200, 120), redPaint);
490 canvas.drawRect(CanvasKit.LTRBRect(30, 10, 80, 60), solidBluePaint);
491 canvas.drawRect(CanvasKit.LTRBRect(170, 10, 220, 60), thirtyBluePaint);
502 canvas.drawRect(CanvasKit.LTRBRect(30, 70, 80, 120), solidBluePaint);
503 canvas.drawRect(CanvasKit.LTRBRect(170, 70, 220, 120), thirtyBluePaint);
509 canvas.drawRect(CanvasKit.LTRBRect(10, 130, 60, 180), redPaint);
510 canvas.drawRect(CanvasKit.LTRBRect(30, 130, 80, 180), solidBluePaint);
512 canvas.drawRect(CanvasKit.LTRBRect(150, 130, 200, 180), redPaint);
513 canvas.drawRect(CanvasKit.LTRBRect(170, 130, 220, 180), thirtyBluePaint);
527 canvas.clear(CanvasKit.WHITE);
529 const redPaint = new CanvasKit.Paint();
530 redPaint.setColor(CanvasKit.RED);
534 const bluePaint = new CanvasKit.Paint();
535 bluePaint.setColor(CanvasKit.BLUE);
538 const blurIF = CanvasKit.ImageFilter.MakeBlur(8, 0.2, CanvasKit.TileMode.Decal, null);
552 canvas.clear(CanvasKit.WHITE);
553 const paint = new CanvasKit.Paint();
555 paint.setStyle(CanvasKit.PaintStyle.Stroke);
557 paint.setColor(CanvasKit.Color(153, 204, 162, 0.82));
561 const caps = [CanvasKit.StrokeCap.Round, CanvasKit.StrokeCap.Square,
562 CanvasKit.StrokeCap.Butt];
563 const joins = [CanvasKit.StrokeJoin.Round, CanvasKit.StrokeJoin.Miter,
564 CanvasKit.StrokeJoin.Bevel];
565 const modes = [CanvasKit.PointMode.Points, CanvasKit.PointMode.Lines,
566 CanvasKit.PointMode.Polygon];
578 const mPointsObj = CanvasKit.Malloc(Float32Array, 3*2);
583 canvas.drawPoints(CanvasKit.PointMode.Polygon, mPointsObj, paint);
585 CanvasKit.Free(mPointsObj);
592 canvas.clear(CanvasKit.WHITE);
594 const boxPaint = new CanvasKit.Paint();
595 boxPaint.setStyle(CanvasKit.PaintStyle.Stroke);
598 const paint = new CanvasKit.Paint();
599 paint.setStyle(CanvasKit.PaintStyle.Stroke);
601 paint.setStrokeCap(CanvasKit.StrokeCap.Round);
607 canvas.drawRect(CanvasKit.LTRBRect(35, 35, 165, 85), boxPaint);
608 canvas.drawPoints(CanvasKit.PointMode.Points, points, paint);
611 canvas.drawRect(CanvasKit.LTRBRect(35, 35, 165, 85), boxPaint);
612 canvas.drawPoints(CanvasKit.PointMode.Lines, points, paint);
615 canvas.drawRect(CanvasKit.LTRBRect(35, 35, 165, 85), boxPaint);
616 canvas.drawPoints(CanvasKit.PointMode.Polygon, points, paint);
620 canvas.drawRect(CanvasKit.LTRBRect(35, 35, 165, 85), boxPaint);
621 const path = new CanvasKit.Path();
635 const img = CanvasKit.MakeImageFromEncoded(fetchedByteBuffers[0]);
638 canvas.clear(CanvasKit.WHITE);
639 const paint = new CanvasKit.Paint();
641 canvas.drawImageNine(img, CanvasKit.LTRBiRect(40, 40, 400, 300),
642 CanvasKit.LTRBRect(5, 5, 300, 650), CanvasKit.FilterMode.Nearest, paint);
649 const img = CanvasKit.MakeImageFromEncoded(fetchedByteBuffers[0]);
652 canvas.clear(CanvasKit.WHITE);
653 const paint = new CanvasKit.Paint();
654 const shader = img.makeShaderCubic(CanvasKit.TileMode.Decal, CanvasKit.TileMode.Clamp,
656 CanvasKit.Matrix.rotated(0.1));
667 const img = CanvasKit.MakeImageFromEncoded(fetchedByteBuffers[0]);
671 canvas.clear(CanvasKit.WHITE);
672 const paint = new CanvasKit.Paint();
673 const shader = imgWithMipMap.makeShaderOptions(CanvasKit.TileMode.Decal,
674 CanvasKit.TileMode.Clamp,
675 CanvasKit.FilterMode.Nearest,
676 CanvasKit.MipmapMode.Linear,
677 CanvasKit.Matrix.rotated(0.1));
688 const paint = new CanvasKit.Paint();
693 const colors = [CanvasKit.RED, CanvasKit.BLUE,
694 CanvasKit.YELLOW, CanvasKit.CYAN];
695 const vertices = CanvasKit.MakeVertices(CanvasKit.VertexMode.TriangleFan,
699 expect(bounds).toEqual(CanvasKit.LTRBRect(0, 0, 250, 250));
701 canvas.drawVertices(vertices, CanvasKit.BlendMode.Src, paint);
707 const paint = new CanvasKit.Paint();
712 const colors = Float32Array.of(...CanvasKit.RED, ...CanvasKit.BLUE,
713 ...CanvasKit.YELLOW, ...CanvasKit.CYAN);
714 const vertices = CanvasKit.MakeVertices(CanvasKit.VertexMode.TriangleFan,
718 expect(bounds).toEqual(CanvasKit.LTRBRect(0, 0, 250, 250));
720 canvas.drawVertices(vertices, CanvasKit.BlendMode.Src, paint);
726 const img = CanvasKit.MakeImageFromEncoded(fetchedByteBuffers[0]);
728 const paint = new CanvasKit.Paint();
739 const vertices = CanvasKit.MakeVertices(CanvasKit.VertexMode.TrianglesStrip,
742 const shader = img.makeShaderCubic(CanvasKit.TileMode.Repeat, CanvasKit.TileMode.Mirror,
745 canvas.drawVertices(vertices, CanvasKit.BlendMode.Src, paint);
754 const canvas = new CanvasKit.Canvas();
757 expect(matr).toEqual(CanvasKit.Matrix.identity());
767 canvas.concat(CanvasKit.Matrix.rotated(Math.PI/4));
772 const expected = CanvasKit.Matrix.multiply(
773 CanvasKit.Matrix.rotated(Math.PI/4),
774 CanvasKit.Matrix.translated(20, 10)
788 const canvas = new CanvasKit.Canvas();
791 expect(matr).toEqual(CanvasKit.Matrix.identity());
821 const canvas = new CanvasKit.Canvas();
823 canvas.concat(CanvasKit.M44.rotated([0, 1, 0], Math.PI/4));
824 canvas.concat(CanvasKit.M44.rotated([1, 0, 1], Math.PI/8));
827 const expected = CanvasKit.M44.multiply(
828 CanvasKit.M44.rotated([0, 1, 0], Math.PI/4),
829 CanvasKit.M44.rotated([1, 0, 1], Math.PI/8),
836 const canvas = new CanvasKit.Canvas();
841 const canvas = new CanvasKit.Canvas();
844 expect(matr).toEqual(CanvasKit.M44.identity());
846 canvas.concat(CanvasKit.M44.rotated([0, 1, 0], Math.PI/4));
847 canvas.concat(CanvasKit.M44.rotated([1, 0, 1], Math.PI/8));
849 const expected = CanvasKit.M44.multiply(
850 CanvasKit.M44.rotated([0, 1, 0], Math.PI/4),
851 CanvasKit.M44.rotated([1, 0, 1], Math.PI/8),
860 const path = starPath(CanvasKit, CANVAS_WIDTH/2, CANVAS_HEIGHT/2);
861 const paint = new CanvasKit.Paint();
863 canvas.clear(CanvasKit.WHITE);
867 const turn = CanvasKit.M44.multiply(
868 CanvasKit.M44.translated([CANVAS_WIDTH/2, 0, 0]),
869 CanvasKit.M44.rotated([1, 0, 0], Math.PI/3),
870 CanvasKit.M44.rotated([0, 1, 0], Math.PI/4),
871 CanvasKit.M44.rotated([0, 0, 1], Math.PI/16),
872 CanvasKit.M44.translated([-CANVAS_WIDTH/2, 0, 0]),
878 paint.setColor(CanvasKit.BLACK);
880 canvas.drawRect(CanvasKit.LTRBRect(i, 0, i + stripeWidth, CANVAS_HEIGHT), paint);
883 paint.setColor(CanvasKit.YELLOW);
917 const particles = CanvasKit.MakeParticles(JSON.stringify(curveParticles));
921 const paint = new CanvasKit.Paint();
923 paint.setColor(CanvasKit.WHITE);
924 const font = new CanvasKit.Font(null, 12);
926 canvas.clear(CanvasKit.BLACK);