internal static Image GetImage(GdiContext context, RPLImageData imageData) { if (string.IsNullOrEmpty(imageData.ImageName) || !context.SharedImages.TryGetValue(imageData.ImageName, out Image value)) { byte[] array = imageData.ImageData; if (array == null) { if (imageData.ImageDataOffset == -1) { return(null); } array = context.RplReport.GetImage(imageData.ImageDataOffset); if (array == null) { return(null); } } try { value = Image.FromStream(new MemoryStream(array)); } catch { return(null); } if (!string.IsNullOrEmpty(imageData.ImageName)) { context.SharedImages.Add(imageData.ImageName, value); } byte[] array3 = imageData.ImageData = null; array = array3; } return(value); }
internal void ReadImage(IExcelGenerator excel, RPLImageData image, string imageName, RPLReport report) { if (excel == null || image == null || report == null || imageName == null) { return; } SetMimeType(image.ImageMimeType); m_imageName = imageName; if (image.ImageData != null) { m_imageData = excel.CreateStream(imageName); m_imageData.Write(image.ImageData, 0, image.ImageData.Length); } else { if (image.ImageDataOffset <= 0) { m_imageData = null; image.ImageData = null; return; } m_imageData = excel.CreateStream(imageName); report.GetImage(image.ImageDataOffset, m_imageData); } image.ImageData = null; if (image.GDIImageProps != null) { m_width = image.GDIImageProps.Width; m_height = image.GDIImageProps.Height; m_verticalResolution = image.GDIImageProps.VerticalResolution; m_horizontalResolution = image.GDIImageProps.HorizontalResolution; m_imageFormat = image.GDIImageProps.RawFormat; } }
public override void DrawImage(RectangleF position, RPLImage image, RPLImageProps instanceProperties, RPLImagePropsDef definitionProperties) { RPLImageData image2 = instanceProperties.Image; System.Drawing.Image image3 = default(System.Drawing.Image); bool flag = this.GetImage(image2.ImageName, image2.ImageData, image2.ImageDataOffset, false, out image3); RPLFormat.Sizings sizing = definitionProperties.Sizing; if (image3 == null) { this.GetDefaultImage(out image3); flag = true; sizing = RPLFormat.Sizings.Clip; } GDIImageProps gDIImageProps = new GDIImageProps(image3); RectangleF destination = default(RectangleF); RectangleF source = default(RectangleF); SharedRenderer.CalculateImageRectangle(position, gDIImageProps.Width, gDIImageProps.Height, (float)this.m_measureImageDpiX, (float)this.m_measureImageDpiY, sizing, out destination, out source); this.m_graphics.DrawImage(image3, destination, source); if (!flag) { image3.Dispose(); image3 = null; } }
public void ReadImage(IExcelGenerator excel, RPLImageData image, string imageName, RPLReport report) { if (excel != null && image != null && report != null && imageName != null) { this.SetMimeType(image.ImageMimeType); this.m_imageName = imageName; if (image.ImageData != null) { this.m_imageData = excel.CreateStream(imageName); this.m_imageData.Write(image.ImageData, 0, image.ImageData.Length); goto IL_008d; } if (image.ImageDataOffset > 0) { this.m_imageData = excel.CreateStream(imageName); report.GetImage(image.ImageDataOffset, this.m_imageData); goto IL_008d; } this.m_imageData = null; image.ImageData = null; } return; IL_008d: image.ImageData = null; if (image.GDIImageProps != null) { this.m_width = image.GDIImageProps.Width; this.m_height = image.GDIImageProps.Height; this.m_verticalResolution = image.GDIImageProps.VerticalResolution; this.m_horizontalResolution = image.GDIImageProps.HorizontalResolution; this.m_imageFormat = image.GDIImageProps.RawFormat; } }
public void WriteImage(Stream destinationStream, RPLImageData image) { Stream mainStream = m_mainStream; m_mainStream = destinationStream; RenderImageUrl(useSessionId: false, image); m_mainStream = mainStream; }
internal void AddBackgroundImage(RPLPageContent pageContent, RPLReportSection reportSection) { RPLImageData rPLImageData = (RPLImageData)((RPLBody)reportSection.Columns[0].Element).ElementProps.Style[33]; if (rPLImageData == null) { rPLImageData = (RPLImageData)pageContent.PageLayout.Style[33]; } if (rPLImageData != null && rPLImageData.ImageData != null && rPLImageData.ImageData.Length != 0) { m_excel.AddBackgroundImage(rPLImageData.ImageData, rPLImageData.ImageName, ref m_backgroundImage, ref m_backgroundImageWidth, ref m_backgroundImageHeight); } }
private void RenderMHTMLImageUrl(RPLImageData image, bool forCss) { string text = CreateImageStream(image); WriteStream("cid:"); if (forCss) { EncodeCSSStyle(text); } else { WriteAttrEncoded(text); } }
internal override void DrawBackgroundImage(RPLImageData imageData, RPLFormat.BackgroundRepeatTypes repeat, PointF start, RectangleF position) { System.Drawing.Image image; bool image2 = GetImage(imageData.ImageName, imageData.ImageData, imageData.ImageDataOffset, dynamicImage: false, out image); if (image == null) { return; } RectangleF destination; RectangleF source; if (repeat == RPLFormat.BackgroundRepeatTypes.Clip) { if (SharedRenderer.CalculateImageClippedUnscaledBounds(this, position, image.Width, image.Height, start.X, start.Y, m_measureImageDpiX, m_measureImageDpiY, out destination, out source)) { m_graphics.DrawImage(image, destination, source); } } else { float num = SharedRenderer.ConvertToMillimeters(image.Width, m_measureImageDpiX); float num2 = SharedRenderer.ConvertToMillimeters(image.Height, m_measureImageDpiY); float num3 = position.Width; if (repeat == RPLFormat.BackgroundRepeatTypes.RepeatY) { num3 = num; } float num4 = position.Height; if (repeat == RPLFormat.BackgroundRepeatTypes.RepeatX) { num4 = num2; } for (float num5 = start.X; num5 < num3; num5 += num) { for (float num6 = start.Y; num6 < num4; num6 += num2) { if (SharedRenderer.CalculateImageClippedUnscaledBounds(this, position, image.Width, image.Height, num5, num6, m_measureImageDpiX, m_measureImageDpiY, out destination, out source)) { m_graphics.DrawImage(image, destination, source); } } } } if (!image2) { image.Dispose(); image = null; } }
public override void DrawBackgroundImage(RPLImageData imageData, RPLFormat.BackgroundRepeatTypes repeat, PointF start, RectangleF position) { System.Drawing.Image image = default(System.Drawing.Image); bool image2 = this.GetImage(imageData.ImageName, imageData.ImageData, imageData.ImageDataOffset, false, out image); if (image != null) { RectangleF destination = default(RectangleF); RectangleF source = default(RectangleF); if (repeat == RPLFormat.BackgroundRepeatTypes.Clip) { if (SharedRenderer.CalculateImageClippedUnscaledBounds((WriterBase)this, position, image.Width, image.Height, start.X, start.Y, (int?)this.m_measureImageDpiX, (int?)this.m_measureImageDpiY, out destination, out source)) { this.m_graphics.DrawImage(image, destination, source); } } else { float num = SharedRenderer.ConvertToMillimeters(image.Width, (float)this.m_measureImageDpiX); float num2 = SharedRenderer.ConvertToMillimeters(image.Height, (float)this.m_measureImageDpiY); float num3 = position.Width; if (repeat == RPLFormat.BackgroundRepeatTypes.RepeatY) { num3 = num; } float num4 = position.Height; if (repeat == RPLFormat.BackgroundRepeatTypes.RepeatX) { num4 = num2; } for (float num5 = start.X; num5 < num3; num5 += num) { for (float num6 = start.Y; num6 < num4; num6 += num2) { if (SharedRenderer.CalculateImageClippedUnscaledBounds((WriterBase)this, position, image.Width, image.Height, num5, num6, (int?)this.m_measureImageDpiX, (int?)this.m_measureImageDpiY, out destination, out source)) { this.m_graphics.DrawImage(image, destination, source); } } } } if (!image2) { image.Dispose(); image = null; } } }
internal override void DrawImage(RectangleF position, RPLImage image, RPLImageProps instanceProperties, RPLImagePropsDef definitionProperties) { RPLImageData image2 = instanceProperties.Image; System.Drawing.Image image3; bool flag = GetImage(image2.ImageName, image2.ImageData, image2.ImageDataOffset, dynamicImage: false, out image3); RPLFormat.Sizings sizing = definitionProperties.Sizing; if (image3 == null) { GetDefaultImage(out image3); flag = true; sizing = RPLFormat.Sizings.Clip; } GDIImageProps gDIImageProps = new GDIImageProps(image3); SharedRenderer.CalculateImageRectangle(position, gDIImageProps.Width, gDIImageProps.Height, m_measureImageDpiX, m_measureImageDpiY, sizing, out RectangleF imagePositionAndSize, out RectangleF imagePortion); m_graphics.DrawImage(image3, imagePositionAndSize, imagePortion); if (!flag) { image3.Dispose(); image3 = null; } }
public void RenderReportItem(RPLElement reportItem, RPLItemMeasurement measurement, StyleContext styleContext, ref int borderContext, bool renderId, bool treatAsTopLevel) { RPLImageProps rPLImageProps = (RPLImageProps)reportItem.ElementProps; RPLImagePropsDef rPLImagePropsDef = (RPLImagePropsDef)rPLImageProps.Definition; RPLFormat.Sizings sizing = rPLImagePropsDef.Sizing; RPLImageData image = rPLImageProps.Image; this.html5Renderer.GetInnerContainerHeightSubtractBorders(measurement, rPLImageProps.Style); float innerContainerWidthSubtractBorders = this.html5Renderer.GetInnerContainerWidthSubtractBorders(measurement, rPLImageProps.Style); string text = this.html5Renderer.GetImageUrl(true, image); string ariaLabel = null; string role = null; string tooltip = this.html5Renderer.GetTooltip(rPLImageProps); if (treatAsTopLevel) { ariaLabel = (string.IsNullOrEmpty(tooltip) ? RenderRes.AccessibleImageLabel : RenderRes.AccessibleImageNavigationGroupLabel(tooltip)); role = HTMLElements.m_navigationRole; } string altText = string.IsNullOrEmpty(tooltip) ? RenderRes.AccessibleImageLabel : tooltip; Dictionary <string, string> dictionary = new Dictionary <string, string>(); if (this.html5Renderer.m_elementExtender.ShouldApplyToElement(treatAsTopLevel)) { dictionary.Add(HTMLElements.m_reportItemDataName, this.html5Renderer.m_elementExtender.ApplyToElement()); dictionary.Add(HTMLElements.m_reportItemCustomAttrStr, this.html5Renderer.GetReportItemPath(rPLImagePropsDef.Name)); } bool flag = rPLImageProps.ActionImageMapAreas != null && rPLImageProps.ActionImageMapAreas.Length > 0; if (flag) { string s = HTMLElements.m_hashTag + this.html5Renderer.m_deviceInfo.HtmlPrefixId + HTMLElements.m_mapPrefixString + rPLImageProps.UniqueName; dictionary.Add(HTMLElements.m_useMapName, HttpUtility.HtmlAttributeEncode(s)); } if (this.html5Renderer.HasAction(rPLImageProps.ActionInfo)) { this.RenderElementHyperlink(rPLImageProps.Style, rPLImageProps.ActionInfo.Actions[0]); } if (!styleContext.InTablix) { if (sizing == RPLFormat.Sizings.AutoSize) { styleContext.RenderMeasurements = false; } this.html5Renderer.WriteStream(HTMLElements.m_openDiv); this.html5Renderer.RenderReportItemStyle(reportItem, (RPLElementProps)rPLImageProps, (RPLElementPropsDef)rPLImagePropsDef, measurement, styleContext, ref borderContext, rPLImagePropsDef.ID); this.html5Renderer.WriteStream(HTMLElements.m_closeBracket); } if (string.IsNullOrEmpty(text)) { text = "data:image/gif;base64," + Convert.ToBase64String(HTMLRendererResources.GetBytes("Blank.gif")); } HtmlElement htmlElement; switch (sizing) { case RPLFormat.Sizings.FitProportional: htmlElement = new FitProportionalImageElement(text, innerContainerWidthSubtractBorders, role, altText, ariaLabel, dictionary); break; case RPLFormat.Sizings.Fit: htmlElement = new FitImageElement(text, role, altText, ariaLabel, dictionary); break; case RPLFormat.Sizings.Clip: htmlElement = new ClipImageElement(text, role, altText, ariaLabel, dictionary); break; default: htmlElement = new OriginalSizeImageElement(text, role, altText, ariaLabel, dictionary); break; } htmlElement.Render(new Html5OutputStream(this.html5Renderer)); if (!styleContext.InTablix) { this.html5Renderer.WriteStream(HTMLElements.m_closeDiv); } if (this.html5Renderer.HasAction(rPLImageProps.ActionInfo)) { this.html5Renderer.WriteStream(HTMLElements.m_closeA); } if (flag) { this.html5Renderer.RenderImageMapAreas(rPLImageProps.ActionImageMapAreas, (double)measurement.Width, (double)measurement.Height, rPLImageProps.UniqueName, 0, 0); } }
protected override void RenderImageUrl(bool useSessionId, RPLImageData image) { RenderMHTMLImageUrl(image, !m_useInlineStyle); }
public virtual void DrawBackgroundImage(RPLImageData imageData, RPLFormat.BackgroundRepeatTypes repeat, PointF start, RectangleF position) { }