diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Cm.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Cm.cs deleted file mode 100644 index 1e4a0cf..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Cm.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Cm : LegacyUnit - { - public Cm(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator Cm(dotnetCampus.OpenXmlUnitConverter.Cm newUnit) - { - return new Cm(newUnit.Value); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Degree.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Degree.cs deleted file mode 100644 index 21ef848..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Degree.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Degree - { - public static readonly Degree Degree270 = Degree.FromDouble(270.0); - - public static readonly Degree Degree90 = Degree.FromDouble(90); - - public static readonly Degree Degree180 = Degree.FromDouble(180); - - - private int _intValue; - private const int MaxDegreeValue = 21600000; - private const double Precision = 60000.0; - - public Degree(int value) - { - IntValue = value; - } - - public int IntValue - { - get => _intValue; - private set - { - var d = value % MaxDegreeValue; - if (d < 0) - { - d += MaxDegreeValue; - } - - _intValue = d; - } - } - - public double DoubleValue => IntValue / Precision; - - public double ToRadiansValue() => DoubleValue / 180 * Math.PI; - - - public override bool Equals(object obj) - { - if ((obj == null) || this.GetType() != obj.GetType()) - { - return false; - } - else - { - Degree p = (Degree)obj; - return IntValue == p.IntValue; - } - } - - public override int GetHashCode() - { - return this.IntValue.GetHashCode(); - } - - public static Degree operator +(Degree a) => a; - public static Degree operator -(Degree a) => new Degree(-a.IntValue); - - public static Degree operator +(Degree a, Degree b) - => new Degree(a.IntValue + b.IntValue); - - public static Degree operator -(Degree a, Degree b) - => a + (-b); - - public static Degree operator *(Degree a, double b) - => new Degree(((int)(a.IntValue * b))); - - public static Degree operator *(double a, Degree b) - => new Degree(((int)(a * b.IntValue))); - - public static Degree operator /(Degree a, double b) - { - if (b == 0) - { - throw new DivideByZeroException(); - } - - return new Degree((int)(a.IntValue / b)); - } - - public static bool operator >(Degree a, Degree b) - => a.IntValue > b.IntValue; - - public static bool operator <(Degree a, Degree b) - => b > a; - - public static bool operator ==(Degree a, Degree b) - { - return a.IntValue == b.IntValue; - } - - public static bool operator !=(Degree a, Degree b) - { - return !(a == b); - } - - public static Degree FromDouble(double value) - { - int v = (int)(value * Precision); - return new Degree(v); - } - - public static implicit operator dotnetCampus.OpenXmlUnitConverter.Degree(Degree legacyUnit) - { - return new dotnetCampus.OpenXmlUnitConverter.Degree(legacyUnit.IntValue); - } - - public static implicit operator Degree(dotnetCampus.OpenXmlUnitConverter.Degree newUnit) - { - return new Degree(newUnit.IntValue); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Dxa.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Dxa.cs deleted file mode 100644 index 1341bb9..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Dxa.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Dxa : LegacyUnit - { - public Dxa(double value) => Value = value; - - public double Value { get; } - - public static implicit operator Dxa(dotnetCampus.OpenXmlUnitConverter.Dxa newUnit) - { - return new Dxa(newUnit.Value); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Emu.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Emu.cs deleted file mode 100644 index cc236cf..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Emu.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Emu : LegacyUnit - { - public Emu(double value) - { - Value = value; - } - - public double Value { get; } - - public static readonly Emu Zero = new Emu(0); - - public static implicit operator Emu(dotnetCampus.OpenXmlUnitConverter.Emu newUnit) - { - return new Emu(newUnit.Value); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/EmuPercentage.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/EmuPercentage.cs deleted file mode 100644 index 843db34..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/EmuPercentage.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class EmuPercentage : LegacyUnit - { - public EmuPercentage(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator EmuPercentage(dotnetCampus.OpenXmlUnitConverter.EmuPercentage newUnit) - { - return new EmuPercentage(newUnit.Value); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/HalfPoint.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/HalfPoint.cs deleted file mode 100644 index 9145a45..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/HalfPoint.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class HalfPoint : LegacyUnit - { - public HalfPoint(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator HalfPoint(dotnetCampus.OpenXmlUnitConverter.HalfPoint newUnit) - { - return new HalfPoint(newUnit.Value); - } - } -} \ No newline at end of file diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Inch.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Inch.cs deleted file mode 100644 index f5903fc..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Inch.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Inch : LegacyUnit - { - public Inch(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator Inch(dotnetCampus.OpenXmlUnitConverter.Inch newUnit) - { - return new Inch(newUnit.Value); - } - } -} \ No newline at end of file diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/LegacyUnit.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/LegacyUnit.cs deleted file mode 100644 index db49974..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/LegacyUnit.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("此类型仅供兼容代码使用,请勿直接调用。")] - public abstract class LegacyUnit - where T : struct - where TLegacy : LegacyUnit - { - public static implicit operator T(LegacyUnit legacyUnit) - { - var legacyValue = legacyUnit.GetType().GetProperty("Value", typeof(double))!.GetValue(legacyUnit); - return (T)typeof(T).GetConstructor(new[] { typeof(double) })!.Invoke(null, new object[] { legacyValue }); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Mm.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Mm.cs deleted file mode 100644 index c2358d4..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Mm.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Mm : LegacyUnit - { - public Mm(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator Mm(dotnetCampus.OpenXmlUnitConverter.Mm newUnit) - { - return new Mm(newUnit.Value); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Percentage.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Percentage.cs deleted file mode 100644 index 79160e9..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Percentage.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Percentage - { - private const double Precision = 100000.0; - - public Percentage(int value) - { - IntValue = value; - } - - /// - /// 从一个 OpenXML 的数值转换为百分比 - /// - /// - public Percentage(string percentageText) - { - if (int.TryParse(percentageText, out var intValue)) - { - IntValue = intValue; - return; - } - else - { - // 如果是带了百分比的 - if (percentageText.Length > 1 && percentageText.EndsWith("%")) - { - var newPercentageText = percentageText.Substring(0, percentageText.Length - 1); - if (double.TryParse(newPercentageText, out var doubleValue)) - { - IntValue = (int)Math.Round(doubleValue * 1000); - - return; - } - } - } - - throw new ArgumentException( - $"Can not convert PercentageText={percentageText} to {nameof(OpenXmlUnitConverter.Percentage)} value."); - } - - public static Percentage FromDouble(double value) - { - int v = (int)(value * Precision); - return new Percentage(v); - } - - public int IntValue { get; } - - public double DoubleValue => IntValue / Precision; - - public double DoubleValueWithRange(double min, double max) - { - if (min > max) - { - throw new InvalidOperationException($"{nameof(max)}:{max} must greater than {nameof(min)}:{min}"); - } - - var value = IntValue / Precision; - value = value > max ? max : value; - value = value < min ? min : value; - return value; - } - - public override bool Equals(object obj) - { - if ((obj == null) || this.GetType() != obj.GetType()) - { - return false; - } - else - { - Percentage p = (Percentage)obj; - return IntValue == p.IntValue; - } - } - - public override int GetHashCode() - { - return this.IntValue.GetHashCode(); - } - - public static Percentage operator +(Percentage a) => a; - public static Percentage operator -(Percentage a) => new Percentage(-a.IntValue); - - public static Percentage operator +(Percentage a, Percentage b) - => new Percentage(a.IntValue + b.IntValue); - - public static Percentage operator -(Percentage a, Percentage b) - => a + (-b); - - public static Percentage operator *(Percentage a, Percentage b) - => new Percentage(a.IntValue * b.IntValue); - - public static Percentage operator /(Percentage a, Percentage b) - { - if (b.IntValue == 0) - { - throw new DivideByZeroException(); - } - - return new Percentage(a.IntValue / b.IntValue); - } - - public static bool operator >(Percentage a, Percentage b) - { - return a.IntValue > b.IntValue; - } - - public static bool operator <(Percentage a, Percentage b) - { - return b > a; - } - - public static implicit operator dotnetCampus.OpenXmlUnitConverter.Percentage(Percentage legacyUnit) - { - return new dotnetCampus.OpenXmlUnitConverter.Percentage(legacyUnit.IntValue); - } - - public static implicit operator Percentage(dotnetCampus.OpenXmlUnitConverter.Percentage newUnit) - { - return new Percentage(newUnit.IntValue); - } - } -} \ No newline at end of file diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pixel.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pixel.cs deleted file mode 100644 index 8d2808c..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pixel.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Pixel : LegacyUnit - { - public Pixel(double value) - { - Value = value; - } - - public double Value { get; } - - public static readonly Pixel ZeroPixel = new Pixel(0); - - public static implicit operator Pixel(dotnetCampus.OpenXmlUnitConverter.Pixel newUnit) - { - return new Pixel(newUnit.Value); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PixelPercentage.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PixelPercentage.cs deleted file mode 100644 index 99ba70b..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PixelPercentage.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class PixelPercentage : Percentage - { - public PixelPercentage(int value) : base(value) - { - } - - public static implicit operator PixelPercentage(dotnetCampus.OpenXmlUnitConverter.PixelPercentage newUnit) - { - return new PixelPercentage(newUnit.IntValue); - } - } -} diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pound.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pound.cs deleted file mode 100644 index e54158a..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pound.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Pound : LegacyUnit - { - public Pound(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator Pound(dotnetCampus.OpenXmlUnitConverter.Pound newUnit) - { - return new Pound(newUnit.Value); - } - } -} \ No newline at end of file diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PoundHundredfold.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PoundHundredfold.cs deleted file mode 100644 index 5f32fa3..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PoundHundredfold.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class PoundHundredfold : LegacyUnit - { - public PoundHundredfold(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator PoundHundredfold(dotnetCampus.OpenXmlUnitConverter.PoundHundredfold newUnit) - { - return new PoundHundredfold(newUnit.Value); - } - } -} \ No newline at end of file diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pt.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pt.cs deleted file mode 100644 index 52d3d33..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/Pt.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class Pt : LegacyUnit - { - public Pt(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator Pt(dotnetCampus.OpenXmlUnitConverter.Pt newUnit) - { - return new Pt(newUnit.Value); - } - } -} \ No newline at end of file diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PtHundredfold.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PtHundredfold.cs deleted file mode 100644 index 75692f3..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/PtHundredfold.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public class PtHundredfold : LegacyUnit - { - public PtHundredfold(double value) - { - Value = value; - } - - public double Value { get; } - - public static implicit operator PtHundredfold(dotnetCampus.OpenXmlUnitConverter.PtHundredfold newUnit) - { - return new PtHundredfold(newUnit.Value); - } - } -} \ No newline at end of file diff --git a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/UnitConverter.cs b/src/dotnetCampus.OpenXmlUnitConverter/Legacy/UnitConverter.cs deleted file mode 100644 index 9721088..0000000 --- a/src/dotnetCampus.OpenXmlUnitConverter/Legacy/UnitConverter.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.ComponentModel; - -namespace dotnetCampus.OpenXMLUnitConverter -{ - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("请使用 dotnetCampus.OpenXmlUnitConverter 命名空间下的同名类型。")] - public static class UnitConverter - { - public const double DefaultDpi = 96; - - #region EmuPercentage - - public static PixelPercentage ToPixelPercentage(this EmuPercentage emuPercentage) => - new PixelPercentage((int)new Emu(emuPercentage.Value).ToPixel().Value); - - #endregion - - #region Pound - - public static Pound ToPound(this PoundHundredfold poundHundredfold) => new Pound(poundHundredfold.Value / 100); - - public static Pound ToPound(this Pixel pixel) => new Pound(pixel.Value / 96 * 72); - - public static PoundHundredfold ToPoundHundredfold(this Pound pound) => new PoundHundredfold(pound.Value * 100); - - public static Pixel ToPixel(this Pound pound) => new Pixel(pound.Value * 96 / 72); - - public static Pixel ToPixel(this PoundHundredfold pound) => pound.ToPound().ToPixel(); - - #endregion - - #region PtHundredfold - - public static Pt ToPt(this PtHundredfold ptHundredfold) => new Pt(ptHundredfold.Value / 100); - - public static Pixel ToPixel(this PtHundredfold ptHundredfold) => ptHundredfold.ToPt().ToPixel(); - - #endregion - - #region Pixel - - public static Pixel ToPixel(this Inch inch) => inch.ToEmu().ToPixel(); - - public static Inch ToInch(this Pixel pixel) => pixel.ToEmu().ToInch(); - - #endregion - - #region Dxa - - /// - /// 将 单位转换为 单位。 - /// - public static Pt ToPt(this Dxa dxa) - { - return new Pt(dxa.Value / 20); - } - - public static Dxa ToDxa(this Pt pt) - { - return new Dxa(pt.Value * 20); - } - - public static Inch ToInch(this Dxa dxa) - { - return new Inch(dxa.Value / 72); - } - - public static Dxa ToDxa(this Inch inch) - { - return new Dxa(inch.Value * 72); - } - - #endregion - - #region Mm - - public static Cm ToCm(this Mm mm) - { - return new Cm(mm.Value / 10); - } - - public static Mm ToMm(this Cm cm) - { - return new Mm(cm.Value * 10); - } - - #endregion - - #region Pt - - public static Cm ToCm(this Pt pt) - { - return pt.ToEmu().ToCm(); - } - - public static Pt ToPt(this Cm cm) - { - return cm.ToEmu().ToPt(); - } - - public static Mm ToMm(this Pt pt) - { - return pt.ToCm().ToMm(); - } - - public static Pt ToPt(this Mm mm) - { - return mm.ToCm().ToPt(); - } - - public static Pt ToPt(this HalfPoint halfPoint) - { - return new Pt(halfPoint.Value / 2); - } - - public static HalfPoint ToHalfPoint(this Pt pt) - { - return new HalfPoint(pt.Value * 2); - } - - - public static Pixel ToPixel(this Pt pt) - { - return new Pixel(pt.Value / 72 * DefaultDpi); - } - - public static Pt ToPoint(this Pixel px) - { - return new Pt(px.Value * 72 / DefaultDpi); - } - - #endregion - - #region Emu - - public static Emu ToEmu(this Inch inch) - { - return new Emu(inch.Value * 914400); - } - - public static Inch ToInch(this Emu emu) - { - return new Inch(emu.Value / 914400); - } - - public static Emu ToEmu(this Cm cm) - { - return new Emu(cm.Value * 360000); - } - - public static Cm ToCm(this Emu emu) - { - return new Cm(emu.Value / 360000); - } - - public static Emu ToEmu(this Mm cm) - { - return new Emu(cm.Value * 36000); - } - - public static Dxa ToDxa(this Emu emu) - { - return new Dxa(emu.Value / 635); - } - - public static Emu ToEmu(this Dxa dxa) - { - return new Emu(dxa.Value * 635); - } - - public static Mm ToMm(this Emu emu) - { - return new Mm(emu.Value / 36000); - } - - - public static Emu ToEmu(this Pixel px) - { - return new Emu(px.Value * 914400 / DefaultDpi); - } - - public static Pixel ToPixel(this Emu emu) - { - return new Pixel(emu.Value / 914400 * DefaultDpi); - } - - public static Emu ToEmu(this Pt pt) - { - return new Emu(pt.Value * 12700); - } - - public static Pt ToPt(this Emu emu) - { - return new Pt(emu.Value / 12700); - } - - #endregion - } -}