mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-13 03:47:40 +02:00
3c0a41a049
* (Add) Program start elapsed seconds on Log * (Add) Lift heights @ speeds, retract speed, light-off information to status bar * (Fix) Per layer settings are being lost when doing operations via tools that changes the layer count * (Fix) Current layer height mm was being calculated instead of showing the stored position Z value (For hacked files) * (Fix) Zip: By using hacked gcodes were possible to do a lift sequence without returning back to Z layer position * (Fix) ZCodex: Read per layer lift height/speed, retract speed and pwm from GCode * (Fix) Status bar, layer top and bottom bar: Break content down for the next line if window size overlaps the controls * (Fix) Status bar: Make right buttons same height as left buttons * (Improvement) CWS: Better gcode parser for decoding * (Change) GCodes: Cure commands (Light-on/Cure time/Light-off) are only exposed when exposure time and pwm are present and greater than 0 [Safe guard] * (Change) Zip: If only one G0 command found per layer, it will be associated to the cure z position (No lift height) * (Change) Merged bottom/normal exposure times on status bar * (Change) Tabs: Change controls spacing from 5 to 2 for better looking * (Change) Deploy UVtools self-contained per platform specific: (#89) * Platform optimized * Reduced the package size * Includes .NET Core assemblies and dont require the installation of .NET Core * Can execute UVtools by double click on "UVtools" file or via ".\UVtools" on terminal * **Naming:** UVtools_[os]-[architecture]_v[version].zip * **"universal"** zip file that includes the portable version, os and architecture independent but requires dotnet to run, these build were used in all previous versions
107 lines
3.4 KiB
C#
107 lines
3.4 KiB
C#
using System;
|
|
using System.IO;
|
|
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 FileExtension("jpg", "JPG"),
|
|
new FileExtension("jpeg", "JPEG"),
|
|
new FileExtension("png", "PNG"),
|
|
new FileExtension("bmp", "BMP"),
|
|
new FileExtension("gif", "GIF"),
|
|
new FileExtension("tga", "TGA"),
|
|
};
|
|
|
|
public override Type[] ConvertToFormats { get; } = null;
|
|
public override PrintParameterModifier[] PrintParameterModifiers { get; } = null;
|
|
public override byte ThumbnailsCount { get; } = 4;
|
|
public override Size[] ThumbnailsOriginalSize { get; } = null;
|
|
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 byte AntiAliasing { get; } = 1;
|
|
public override float LayerHeight { get; set; } = 0;
|
|
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; }
|
|
|
|
public override void Decode(string fileFullPath, OperationProgress progress = null)
|
|
{
|
|
base.Decode(fileFullPath, 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 = new LayerManager(1, this);
|
|
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 bool Convert(Type to, string fileFullPath, OperationProgress progress = null)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
|
|
}
|
|
}
|