1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| // Create an image and fill it blue
int width = 1200;
int height = 700;
int step =50;
SKBitmap bmp = new(width, height);
SKCanvas canvas = new(bmp);
canvas.Clear(SKColor.Parse("#fff"));
Random rand = new();
SKPaint paint = new()
{
Color = SKColors.White.WithAlpha(100),
IsAntialias = true ,
StrokeWidth = 2,
ColorF = SKColor.Parse("#003366")
};
foreach(var item in GetTrianglePoints(10,.2f,700))
{
//paint.ColorF = listOfColor[rand.Next(0,listOfColor.Count)];
canvas.DrawLine(item.A,item.B,paint);
canvas.DrawLine(item.B,item.C,paint);
canvas.DrawLine(item.C,item.A,paint);
}
SKFileWStream fs = new("triangleillusion.jpg");
bmp.Encode(fs, SKEncodedImageFormat.Jpeg, quality: 50);
bmp.Display();
|