Welcome to mirror list, hosted at ThFree Co, Russian Federation.

UniversalLayerExtensions.cs « PrusaSL1Viewer - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c16638f0917bcaeae1398a01e02d1ac2fa4bcea (plain)
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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using PrusaSL1Reader;
using SixLabors.ImageSharp;

namespace PrusaSL1Viewer
{
    public static class UniversalLayerExtensions
    {
        public static Bitmap ToBitmap(this UniversalLayer layer, int width, int height)
        {
            Bitmap buffer = new Bitmap(width, height);//set the size of the image
            Graphics gfx = Graphics.FromImage(buffer);//set the graphics to draw on the image

            foreach (var line in layer)
            {
                gfx.DrawRectangle(Pens.White, line.X, line.Y, line.Length, 1);
            }

            return buffer;
        }
    }
}