public TypeElementRenderProcessor(IShapeRenderer zShapeRenderer, IDrawGraphic zDrawGraphic, IDrawFormattedText zDrawFormattedText, IDrawText zDrawText)
 {
     m_zShapeRenderer     = zShapeRenderer;
     m_zDrawGraphic       = zDrawGraphic;
     m_zDrawFormattedText = zDrawFormattedText;
     m_zDrawText          = zDrawText;
 }
Exemple #2
0
        public string ProcessInlineBackgroundGraphic(IDrawGraphic zDrawGraphic, Graphics zGraphics, ProjectLayoutElement zElement, string sInput)
        {
            var   kvpMatchedProcessor = new KeyValuePair <Regex, Action <Match, ProjectLayoutElement, ProjectLayoutElement, PointOffset> >();
            Match zMatch = null;

            foreach (var kvpGraphicProcessor in listGraphicProcessingPairs)
            {
                zMatch = kvpGraphicProcessor.Key.Match(sInput);
                if (zMatch.Success)
                {
                    kvpMatchedProcessor = kvpGraphicProcessor;
                    break;
                }
            }

            if (kvpMatchedProcessor.Key == null ||
                zMatch == null ||
                !zMatch.Success)
            {
                return(sInput);
            }

            var sToReplace        = zMatch.Groups[0].Value;
            var pointOffset       = new PointOffset();
            var zBgGraphicElement = new ProjectLayoutElement(Guid.NewGuid().ToString());

            zBgGraphicElement.opacity = -1;

            kvpMatchedProcessor.Value(zMatch, zBgGraphicElement, zElement, pointOffset);

            zDrawGraphic.DrawGraphicFile(zGraphics, zBgGraphicElement.variable, zBgGraphicElement, pointOffset.X, pointOffset.Y);

            return(sInput.Replace(sToReplace, string.Empty));
        }
Exemple #3
0
        public string ProcessInlineBackgroundGraphic(IDrawGraphic zDrawGraphic, Graphics zGraphics, ProjectLayoutElement zElement, string sInput)
        {
            var   zExtendedMatch = regexGraphicExtendedBG.Match(sInput);
            Match zMatch         = null;

            if (!zExtendedMatch.Success)
            {
                zMatch = regexGraphicBG.Match(sInput);
                if (!zMatch.Success)
                {
                    return(sInput);
                }
            }

            var sToReplace = String.Empty;

            int[] arrayReplaceIndcies = null;
            var   zBgGraphicElement   = new ProjectLayoutElement(Guid.NewGuid().ToString());
            var   nXOffset            = 0;
            var   nYOffset            = 0;

            if (zExtendedMatch.Success)
            {
                nXOffset = ParseUtil.ParseDefault(zExtendedMatch.Groups[4].Value, 0);
                nYOffset = ParseUtil.ParseDefault(zExtendedMatch.Groups[6].Value, 0);
                zBgGraphicElement.width           = zElement.width + ParseUtil.ParseDefault(zExtendedMatch.Groups[8].Value, 0);
                zBgGraphicElement.height          = zElement.height + ParseUtil.ParseDefault(zExtendedMatch.Groups[10].Value, 0);
                zBgGraphicElement.opacity         = zElement.opacity;
                zBgGraphicElement.lockaspect      = ParseUtil.ParseDefault(zExtendedMatch.Groups[12].Value, false);
                zBgGraphicElement.tilesize        = zExtendedMatch.Groups[14].Value;
                zBgGraphicElement.horizontalalign = ParseUtil.ParseDefault(zExtendedMatch.Groups[16].Value, 0);
                zBgGraphicElement.verticalalign   = ParseUtil.ParseDefault(zExtendedMatch.Groups[18].Value, 0);
                zBgGraphicElement.variable        = zExtendedMatch.Groups[2].Value;
                zBgGraphicElement.type            = ElementType.Graphic.ToString();
                sToReplace = zExtendedMatch.Groups[0].Value;
            }
            else if (zMatch.Success)
            {
                zBgGraphicElement.width    = zElement.width;
                zBgGraphicElement.height   = zElement.height;
                zBgGraphicElement.opacity  = zElement.opacity;
                zBgGraphicElement.variable = zMatch.Groups[2].Value;
                zBgGraphicElement.type     = ElementType.Graphic.ToString();
                sToReplace = zMatch.Groups[0].Value;
            }

            zDrawGraphic.DrawGraphicFile(zGraphics, zBgGraphicElement.variable, zBgGraphicElement, nXOffset, nYOffset);

            return(sInput.Replace(sToReplace, string.Empty));
        }
 public InlineElementRenderProcessor(IShapeRenderer zShapeRenderer, IDrawGraphic zDrawGraphic)
 {
     m_zShapeRenderer = zShapeRenderer;
     m_zDrawGraphic   = zDrawGraphic;
 }