mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-11 19:12:31 +02:00
379c5140f6
* (Add) Able to install only the desired profiles and not the whole lot (Suggested by: Ingo Strohmenger) * (Add) Update manager for PrusaSlicer profiles * (Add) If PrusaSlicer not installed on system it prompt for installation (By open the official website) * (Fix) Prevent profiles instalation when PrusaSlicer is not installed on system * (Fix) The "Issues" computation sometimes fails triggering an error due the use of non concurrent dictionary * (Fix) Print profiles won't install into PrusaSlicer
56 lines
1.8 KiB
C#
56 lines
1.8 KiB
C#
/*
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* Version 3, 19 November 2007
|
|
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
|
|
using System.IO;
|
|
using Emgu.CV;
|
|
using Emgu.CV.Structure;
|
|
using SixLabors.ImageSharp;
|
|
using SixLabors.ImageSharp.PixelFormats;
|
|
using UVtools.Parser;
|
|
|
|
namespace UVtools.GUI.Extensions
|
|
{
|
|
public static class ImageSharpExtensions
|
|
{
|
|
public static System.Drawing.Bitmap ToBitmap(this Image image)
|
|
{
|
|
using (var memoryStream = new MemoryStream())
|
|
{
|
|
//var imageEncoder = image.GetConfiguration().ImageFormatsManager.FindEncoder(SixLabors.ImageSharp.Formats.Bmp.BmpFormat.Instance);
|
|
Helpers.BmpEncoder.SupportTransparency = true;
|
|
image.Save(memoryStream, Helpers.BmpEncoder);
|
|
|
|
memoryStream.Seek(0, SeekOrigin.Begin);
|
|
|
|
return new System.Drawing.Bitmap(memoryStream);
|
|
}
|
|
}
|
|
|
|
public static Image<Gray, byte> ToEmguImage(this Image<L8> image)
|
|
{
|
|
return
|
|
new Image<Gray, byte>(image.Width, image.Height)
|
|
{
|
|
Bytes = Helpers.ImageL8ToBytes(image)
|
|
};
|
|
}
|
|
|
|
/*public static Image<TPixel> ToImageSharpImage<TPixel>(this System.Drawing.Bitmap bitmap) where TPixel : struct, IPixel<TPixel>
|
|
{
|
|
using (var memoryStream = new MemoryStream())
|
|
{
|
|
bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);
|
|
|
|
memoryStream.Seek(0, SeekOrigin.Begin);
|
|
|
|
return Image.Load<TPixel>(memoryStream);
|
|
}
|
|
}*/
|
|
}
|
|
}
|