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
30
31
32
| // Create an image and fill it blue
int width = 2000;
int height = 2000;
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")
};
int seperation=4;
for(var i=3;i<=15;i+=3)
{
paint.Color=listOfColor[rand.Next(0,listOfColor.Count)];
foreach(var item in GetShape(n:i,times:25, factor:0.08f, baseLength:seperation* i*i,centerX:width/2,centerY:height/2))
{
canvas.DrawLine(item.Item1,item.Item2,paint);
}
}
// Save the image to disk
SKFileWStream fs = new("multishape.jpg");
bmp.Encode(fs, SKEncodedImageFormat.Jpeg, quality: 100);
bmp.Display();
|