Пример #1
1
 /// <exception cref="ArgumentNullException"><paramref name="fingerPrintTransformer" /> is <see langword="null" />.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="fingerPrintCommands" /> is <see langword="null" />.</exception>
 public SvgImageTranslator([NotNull] FingerPrintTransformer fingerPrintTransformer,
                           [NotNull] FingerPrintCommands fingerPrintCommands)
     : base(fingerPrintTransformer)
 {
     this.FingerPrintTransformer = fingerPrintTransformer ?? throw new ArgumentNullException(nameof(fingerPrintTransformer));
     this.FingerPrintCommands    = fingerPrintCommands ?? throw new ArgumentNullException(nameof(fingerPrintCommands));
 }
        public virtual FingerPrintRenderer CreateFingerPrintRenderer([NotNull] FingerPrintTransformer fingerPrintTransformer,
                                                                     CharacterSet characterSet = CharacterSet.Utf8)
        {
            if (fingerPrintTransformer == null)
            {
                throw new ArgumentNullException(nameof(fingerPrintTransformer));
            }

            var svgUnitReader       = this.CreateSvgUnitReader();
            var fingerPrintCommands = this.CreateFingerPrintCommands();
            var fingerPrintRenderer = this.CreateFingerPrintRenderer(fingerPrintCommands,
                                                                     characterSet);
            var svgLineTranslator = this.CreateSvgLineTranslator(fingerPrintTransformer,
                                                                 fingerPrintCommands);
            var svgRectangleTranslator = this.CreateSvgRectangleTranslator(fingerPrintTransformer,
                                                                           fingerPrintCommands,
                                                                           svgUnitReader);
            var svgTextTranslator = this.CreateSvgTextTranslator(fingerPrintTransformer,
                                                                 fingerPrintCommands);
            var svgTextSpanTranslator = this.CreateSvgTextSpanTranslator(fingerPrintTransformer,
                                                                         fingerPrintCommands);
            var svgPathTranslator = this.CreateSvgPathTranslator(fingerPrintTransformer,
                                                                 fingerPrintCommands);
            var svgImageTranslator = this.CreateSvgImageTranslator(fingerPrintTransformer,
                                                                   fingerPrintCommands);

            fingerPrintRenderer.RegisterTranslator(svgLineTranslator);
            fingerPrintRenderer.RegisterTranslator(svgRectangleTranslator);
            fingerPrintRenderer.RegisterTranslator(svgTextTranslator);
            fingerPrintRenderer.RegisterTranslator(svgTextSpanTranslator);
            fingerPrintRenderer.RegisterTranslator(svgPathTranslator);
            fingerPrintRenderer.RegisterTranslator(svgImageTranslator);

            return(fingerPrintRenderer);
        }
Пример #3
0
 /// <exception cref="ArgumentNullException"><paramref name="fingerPrintTransformer" /> is <see langword="null" />.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="fingerPrintCommands" /> is <see langword="null" />.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="svgUnitReader" /> is <see langword="null" />.</exception>
 public SvgRectangleTranslator([NotNull] FingerPrintTransformer fingerPrintTransformer,
                               [NotNull] FingerPrintCommands fingerPrintCommands,
                               [NotNull] SvgUnitReader svgUnitReader)
 {
     this.FingerPrintTransformer = fingerPrintTransformer ?? throw new ArgumentNullException(nameof(fingerPrintTransformer));
     this.FingerPrintCommands    = fingerPrintCommands ?? throw new ArgumentNullException(nameof(fingerPrintCommands));
     this.SvgUnitReader          = svgUnitReader ?? throw new ArgumentNullException(nameof(svgUnitReader));
 }
        protected virtual FingerPrintTransformer CreateFingerPrintTransformer([NotNull] SvgUnitReader svgUnitReader)
        {
            if (svgUnitReader == null)
            {
                throw new ArgumentNullException(nameof(svgUnitReader));
            }

            var fingerPrintTransformer = new FingerPrintTransformer(svgUnitReader);

            return(fingerPrintTransformer);
        }
        protected virtual SvgLineTranslator CreateSvgLineTranslator([NotNull] FingerPrintTransformer fingerPrintTransformer,
                                                                    [NotNull] FingerPrintCommands fingerPrintCommands)
        {
            if (fingerPrintTransformer == null)
            {
                throw new ArgumentNullException(nameof(fingerPrintTransformer));
            }
            if (fingerPrintCommands == null)
            {
                throw new ArgumentNullException(nameof(fingerPrintCommands));
            }

            var svgLineTranslator = new SvgLineTranslator(fingerPrintTransformer,
                                                          fingerPrintCommands);

            return(svgLineTranslator);
        }
        public virtual Matrix CreateViewMatrix([NotNull] FingerPrintTransformer fingerPrintTransformer,
                                               float sourceDpi,
                                               float destinationDpi,
                                               ViewRotation viewRotation = ViewRotation.Normal)
        {
            if (fingerPrintTransformer == null)
            {
                throw new ArgumentNullException(nameof(fingerPrintTransformer));
            }

            var magnificationFactor = destinationDpi / sourceDpi;

            var viewMatrix = fingerPrintTransformer.CreateViewMatrix(magnificationFactor,
                                                                     viewRotation);

            return(viewMatrix);
        }