| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using Microcharts;
- using NUnit.Framework;
- using QuestPDF.Examples.Engine;
- using QuestPDF.Fluent;
- using QuestPDF.Helpers;
- using QuestPDF.Infrastructure;
- using SkiaSharp;
- namespace QuestPDF.Examples
- {
- public class CanvasExamples
- {
- [Test]
- public void BorderRadius()
- {
- RenderingTest
- .Create()
- .PageSize(175, 100)
- .ProduceImages()
- .ShowResults()
- .Render(container =>
- {
- container
- .Background(Colors.Grey.Lighten2)
- .Padding(25)
- .MinimalBox()
- .Layers(layers =>
- {
- layers.Layer().Canvas((canvas, size) =>
- {
- DrawRoundedRectangle(Colors.White, false);
- DrawRoundedRectangle(Colors.Blue.Darken2, true);
- void DrawRoundedRectangle(string color, bool isStroke)
- {
- using var paint = new SKPaint
- {
- Color = SKColor.Parse(color),
- IsStroke = isStroke,
- StrokeWidth = 2,
- IsAntialias = true
- };
-
- canvas.DrawRoundRect(0, 0, size.Width, size.Height, 20, 20, paint);
- }
- });
-
- layers
- .PrimaryLayer()
- .PaddingVertical(10)
- .PaddingHorizontal(20)
- .Text("Sample text")
- .FontSize(16)
- .FontColor(Colors.Blue.Darken2)
- .SemiBold();
- });
- });
- }
- }
- }
|