mirror of
https://github.com/m-lamonaca/dev-notes.git
synced 2025-05-14 23:24:46 +00:00
Rename .NET folder to DotNet
This commit is contained in:
parent
68723844c3
commit
d2148a38ee
32 changed files with 0 additions and 0 deletions
35
DotNet/Lib/SkiaSharp.md
Normal file
35
DotNet/Lib/SkiaSharp.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# SkiaSharp
|
||||
|
||||
```cs
|
||||
SKImageInfo info = new SKImageInfo(width, height);
|
||||
|
||||
using (SKSurface surface = SKSurface.Create(info))
|
||||
{
|
||||
SKCanvas canvas = surface.Canvas;
|
||||
canvas.DrawColor(SKColors.<color>);
|
||||
|
||||
using (SKPaint paint = new SKPaint())
|
||||
{
|
||||
paint.Color = SKColors.Blue;
|
||||
paint.IsAntialias = true;
|
||||
paint.StrokeWidth = 5;
|
||||
paint.Style = SKPaintStyle.Stroke;
|
||||
|
||||
// draw
|
||||
canvas.DrawLine(x0, y0, x1, y1, paint);
|
||||
|
||||
}
|
||||
|
||||
// save to file
|
||||
using (var image = surface.Snapshot())
|
||||
{
|
||||
using (var data = image.Encode(SKEncodedImageFormat.Png, 100))
|
||||
{
|
||||
using (var stream = File.OpenWrite(png_filename))
|
||||
{
|
||||
data.SaveTo(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue