mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
Anet N4: fix regression
In original format both name and description could be an empty string with length -1. Bounding rectangle should be an index of first/last white pixels.
This commit is contained in:
@@ -60,11 +60,11 @@ public sealed class AnetN4File : FileFormat
|
||||
|
||||
public class Header
|
||||
{
|
||||
[FieldOrder(0)][FieldEndianness(Endianness.Big)] public uint VersionLength { get; set; } = 2;
|
||||
[FieldOrder(0)][FieldEndianness(Endianness.Big)] public int VersionLength { get; set; } = 2;
|
||||
[FieldOrder(1)][FieldEncoding("UTF-16BE")][FieldLength(nameof(VersionLength))] public string Version { get; set; } = "3";
|
||||
[FieldOrder(2)][FieldEndianness(Endianness.Big)] public uint NameLength { get; set; } = (uint)About.SoftwareWithVersion.Length * 2;
|
||||
[FieldOrder(2)][FieldEndianness(Endianness.Big)] public int NameLength { get; set; } = About.SoftwareWithVersion.Length * 2;
|
||||
[FieldOrder(3)][FieldEncoding("UTF-16BE")][FieldLength(nameof(NameLength))] public string Name { get; set; } = About.SoftwareWithVersion;
|
||||
[FieldOrder(4)][FieldEndianness(Endianness.Big)] public uint DescriptionLength { get; set; } = (uint)About.SoftwareWithVersion.Length * 2;
|
||||
[FieldOrder(4)][FieldEndianness(Endianness.Big)] public int DescriptionLength { get; set; } = About.SoftwareWithVersion.Length * 2;
|
||||
[FieldOrder(5)][FieldEncoding("UTF-16BE")][FieldLength(nameof(DescriptionLength))] public string Description { get; set; } = About.SoftwareWithVersion;
|
||||
[FieldOrder(6)][FieldEndianness(Endianness.Big)] public double XYPixelSize { get; set; } = 0.04725; // mm
|
||||
[FieldOrder(7)][FieldEndianness(Endianness.Big)] public double LayerHeight { get; set; } // mm; from 0.03 to 0.08
|
||||
@@ -123,8 +123,8 @@ public sealed class AnetN4File : FileFormat
|
||||
WhitePixelsCount = layer.NonZeroPixelCount; // To be re-set latter while encoding
|
||||
XMin = layer.BoundingRectangle.X;
|
||||
YMin = layer.BoundingRectangle.Y;
|
||||
XMax = layer.BoundingRectangle.Right;
|
||||
YMax = layer.BoundingRectangle.Bottom;
|
||||
XMax = layer.BoundingRectangle.Right - 1;
|
||||
YMax = layer.BoundingRectangle.Bottom - 1;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
Reference in New Issue
Block a user