Пример #1
0
        private SvgUnit GetRelativeUnit(double value, SvgUnitType type)
        {
            if (type == SvgUnitType.Pixel)
            {
                var convertedValue = (PreciseDouble)value * PixelToCm;
                convertedValue = UnitOfMeasure.ConvertTo(convertedValue, UnitOfMeasure.Cm, Options.ExportUnit);
                return new SvgUnit((float)convertedValue);
            }
            else if (type == SvgUnitType.Point)
            {
                var convertedValue = (PreciseDouble)value * PointToCm;
                convertedValue = UnitOfMeasure.ConvertTo(convertedValue, UnitOfMeasure.Cm, Options.ExportUnit);
                return new SvgUnit((float)convertedValue);
            }

            return new SvgUnit(type, (float)value);
        }