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)); }
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 string Render(Graphics zGraphics, ProjectLayoutElement zElement, Deck zDeck, string sInput, int nX, int nY, bool bExport) { switch (EnumUtil.GetElementType(zElement.type)) { case ElementType.Text: m_zDrawText.DrawText(zGraphics, zElement, sInput); break; case ElementType.FormattedText: m_zDrawFormattedText.Draw(zGraphics, zDeck, zElement, sInput); break; case ElementType.Graphic: m_zDrawGraphic.DrawGraphicFile(zGraphics, sInput, zElement); break; case ElementType.Shape: m_zShapeRenderer.HandleShapeRender(zGraphics, sInput.ToLower(), zElement); break; } return(sInput); }