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
33
34
| int width = 1200;
int height = 100;
SKBitmap bmp = new(width, height);
SKCanvas canvas = new(bmp);
canvas.Clear(SKColor.Parse("#fff"));
Random rand = new(0);
SKPaint paint = new()
{
Color = SKColors.White.WithAlpha(100),
IsAntialias = true ,
StrokeWidth = 4,
ColorF = SKColor.Parse("#003366"),
Style = SKPaintStyle.Stroke
};
float step=6*(width/height);
var circlDrawn = false;
for(float j=-height; j<height;j+=step)
{
for(float i=-width; i<width;i+=step)
{
var x = i+width/2;
var y = j+height/2;
canvas.DrawRect(x,y,step,step,paint);
//canvas.DrawRoundRect(i,j,step,step,5,5,paint);
i+=step;
}
j+=step;
}
SKFileWStream fs = new("rectmatrix.jpg");
bmp.Encode(fs, SKEncodedImageFormat.Jpeg, quality: 50);
bmp.Display();
|