mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-10 18:42:33 +02:00
4dae750e83
* **File formats:** * Add Voxeldance Tango (VDT) * Add Makerbase MKS-DLP (MDLPv1) * Add GR1 Workshop (GR1) * Add Creality CXDLP (CXDLP) * When decoding a file and have a empty resolution (Width: 0 or Height: 0) it will auto fix it by get and set the first layer image resolution to the file * Fix when decoding a file it was already set to require a full encode, preventing fast saves on print parameters edits * **GUI:** * When file resolution dismatch from layer resolution, it is now possible to auto fix it by set the layer resolution to the file * When loading a file with auto scan for issues disabled it will force auto scan for issues types that are instant to check (print height and empty layers), if any exists it will auto select issues tab * **(Add) PrusaSlicer printers:** * Creality HALOT-SKY CL-89 * Creality HALOT-SKY CL-60 * (Improvement) Tool - Adjust layer height: Improve the performance when multiplying layers / go with higher layer height * (Fix) PrusaSlicer Printer - Wanhao D7: Change the auto convertion format from .zip to .xml.cws
122 lines
3.5 KiB
C#
122 lines
3.5 KiB
C#
using System;
|
|
using Emgu.CV;
|
|
using Emgu.CV.CvEnum;
|
|
using UVtools.Core.Operations;
|
|
using Size = System.Drawing.Size;
|
|
|
|
namespace UVtools.Core.FileFormats
|
|
{
|
|
public class ImageFile : FileFormat
|
|
{
|
|
public override FileFormatType FileType { get; } = FileFormatType.Binary;
|
|
|
|
public override FileExtension[] FileExtensions { get; } =
|
|
{
|
|
new ("jpg", "JPG"),
|
|
new ("jpeg", "JPEG"),
|
|
new ("png", "PNG"),
|
|
new ("bmp", "BMP"),
|
|
new ("gif", "GIF"),
|
|
new ("tga", "TGA"),
|
|
};
|
|
public override PrintParameterModifier[] PrintParameterModifiers { get; } = null;
|
|
|
|
public override Size[] ThumbnailsOriginalSize { get; } = {
|
|
Size.Empty,
|
|
Size.Empty,
|
|
Size.Empty,
|
|
Size.Empty
|
|
};
|
|
public override uint ResolutionX
|
|
{
|
|
get => (uint) ImageMat.Width;
|
|
set => throw new NotImplementedException();
|
|
}
|
|
|
|
public override uint ResolutionY
|
|
{
|
|
get => (uint) ImageMat.Height;
|
|
set => throw new NotImplementedException();
|
|
}
|
|
|
|
public override float DisplayWidth
|
|
{
|
|
get => ResolutionX;
|
|
set
|
|
{
|
|
ResolutionX = (uint) value;
|
|
RaisePropertyChanged();
|
|
}
|
|
}
|
|
|
|
public override float DisplayHeight
|
|
{
|
|
get => ResolutionY;
|
|
set
|
|
{
|
|
ResolutionY = (uint) value;
|
|
RaisePropertyChanged();
|
|
}
|
|
}
|
|
|
|
public override bool MirrorDisplay
|
|
{
|
|
get => false;
|
|
set { }
|
|
}
|
|
|
|
public override byte AntiAliasing
|
|
{
|
|
get => 1;
|
|
set { }
|
|
}
|
|
|
|
public override float LayerHeight { get; set; } = 0.01f;
|
|
/*public override float PrintTime { get; } = 0;
|
|
public override float UsedMaterial { get; } = 0;
|
|
public override float MaterialCost { get; } = 0;
|
|
public override string MaterialName { get; } = null;
|
|
public override string MachineName { get; } = null;*/
|
|
public override object[] Configs { get; } = null;
|
|
|
|
private Mat ImageMat { get; set; }
|
|
|
|
protected override void EncodeInternally(string fileFullPath, OperationProgress progress)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
protected override void DecodeInternally(string fileFullPath, OperationProgress progress)
|
|
{
|
|
ImageMat = CvInvoke.Imread(fileFullPath, ImreadModes.Grayscale);
|
|
const byte startDivisor = 2;
|
|
for (int i = 0; i < ThumbnailsCount; i++)
|
|
{
|
|
Thumbnails[i] = new Mat();
|
|
var divisor = (i + 1) * startDivisor;
|
|
CvInvoke.Resize(ImageMat, Thumbnails[i],
|
|
new Size(ImageMat.Width / divisor, ImageMat.Height / divisor));
|
|
}
|
|
|
|
/*if (ImageMat.NumberOfChannels > 1)
|
|
{
|
|
CvInvoke.CvtColor(ImageMat, ImageMat, ColorConversion.Bgr2Gray);
|
|
}*/
|
|
LayerManager.Init(1);
|
|
this[0] = new Layer(0, ImageMat, LayerManager);
|
|
}
|
|
|
|
public override void SaveAs(string filePath = null, OperationProgress progress = null)
|
|
{
|
|
this[0].LayerMat.Save(filePath ?? FileFullPath);
|
|
}
|
|
|
|
public override FileFormat Convert(Type to, string fileFullPath, OperationProgress progress = null)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
|
|
}
|
|
}
|