mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-11 11:02:32 +02:00
c94b5fb7f1
- **Windows MSI:** - (Fix) Use the folder programs x64 instead of x86 for new installation path (#254) - (Improvement) Mark program and all files as x64 - (Improvement) Add UVtools logo to side panel and top banner - (Improvement) Add open-source logo to side panel - (Improvement) License text aligment and bold title - (Add) File format: OSLA / ODLP / OMSLA - Universal binary file format - (Add) Calibration - Lift height: Generates test models with various strategies and increments to measure the optimal lift height or peel forces for layers given the printed area - (Add) Layer Actions - Export layers to images (PNG, JPG/JPEG, JP2, TIF/TIFF, BMP, PBM, PGM, SR/RAS and SVG) - (Add) About box: License with link - (Add) Include a copy of the LICENSE on the packages - (Improvement) File formats: Implement `Wait time before cure` properties on file formats with light-off delay, when used it will calculate the right light-off delay with that extra time and set to `LightOffDelay` property - (Improvement) Change all date times to Utc instead of local - (Fix) Tool - Flip: 'Both' were not working correctly - (Fix) Linux: File 'UVtools.sh' with incorrect line break type, changed to \n (#258)
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 DisplayMirror
|
|
{
|
|
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();
|
|
}
|
|
|
|
|
|
}
|
|
}
|