public static void CalculateColumnZIndexes(RPLTablix tablix, RPLTablixRow row, int currentRow, int[] columnZIndexes)
 {
     if (currentRow < tablix.ColumnHeaderRows)
     {
         for (int i = 0; i < row.NumCells; i++)
         {
             RPLTablixMemberCell rPLTablixMemberCell = row[i] as RPLTablixMemberCell;
             if (rPLTablixMemberCell != null)
             {
                 columnZIndexes[rPLTablixMemberCell.ColIndex] = Math.Min(columnZIndexes[rPLTablixMemberCell.ColIndex], SharedRenderer.CalculateZIndex(rPLTablixMemberCell));
             }
         }
     }
     else
     {
         for (int j = 0; j < row.NumCells; j++)
         {
             RPLTablixMemberCell rPLTablixMemberCell2 = row[j] as RPLTablixMemberCell;
             if (rPLTablixMemberCell2 != null)
             {
                 columnZIndexes[rPLTablixMemberCell2.ColIndex] = SharedRenderer.CalculateZIndex(rPLTablixMemberCell2);
             }
         }
     }
 }
 public static void GetFontFormatInformation(RPLElementProps elementProperties, out RPLFormat.WritingModes writingMode, out RPLFormat.Directions direction, out RPLFormat.VerticalAlignments verticalAlign, out RPLFormat.TextAlignments textAlign, ref bool stringFormatFromInstance)
 {
     writingMode   = (RPLFormat.WritingModes)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)30, ref stringFormatFromInstance);
     direction     = (RPLFormat.Directions)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)29, ref stringFormatFromInstance);
     verticalAlign = (RPLFormat.VerticalAlignments)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)26, ref stringFormatFromInstance);
     textAlign     = (RPLFormat.TextAlignments)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)25, ref stringFormatFromInstance);
 }
Exemplo n.º 3
0
 private bool GetImage(string imageName, Stream imageStream, long imageDataOffset, bool dynamicImage, out System.Drawing.Image image)
 {
     image = null;
     if (dynamicImage || string.IsNullOrEmpty(imageName) || !this.m_cachedImages.TryGetValue(imageName, out image))
     {
         if (imageStream == null)
         {
             imageStream = SharedRenderer.GetEmbeddedImageStream(base.m_renderer.RplReport, imageDataOffset, base.CreateAndRegisterStream, imageName);
             if (imageStream == null)
             {
                 return(false);
             }
         }
         if (imageStream.Position != 0 && imageStream.CanSeek)
         {
             imageStream.Position = 0L;
         }
         try
         {
             image = System.Drawing.Image.FromStream(imageStream);
         }
         catch
         {
             return(false);
         }
         this.AddImageToCache(image, dynamicImage, imageName);
     }
     if (!dynamicImage)
     {
         return(!string.IsNullOrEmpty(imageName));
     }
     return(false);
 }
Exemplo n.º 4
0
 private bool GetImage(string imageName, byte[] imageBytes, long imageDataOffset, bool dynamicImage, out System.Drawing.Image image)
 {
     image = null;
     if (dynamicImage || string.IsNullOrEmpty(imageName) || !this.m_cachedImages.TryGetValue(imageName, out image))
     {
         if (!SharedRenderer.GetImage(base.m_renderer.RplReport, ref imageBytes, imageDataOffset))
         {
             return(false);
         }
         try
         {
             image = System.Drawing.Image.FromStream(new MemoryStream(imageBytes));
         }
         catch
         {
             return(false);
         }
         this.AddImageToCache(image, dynamicImage, imageName);
     }
     if (!dynamicImage)
     {
         return(!string.IsNullOrEmpty(imageName));
     }
     return(false);
 }
Exemplo n.º 5
0
        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 static float ConvertToMillimeters(int pixels, float?dpi, WriterBase writer)
 {
     if (dpi.HasValue)
     {
         return(SharedRenderer.ConvertToMillimeters(pixels, dpi.Value));
     }
     return(writer.ConvertToMillimeters(pixels));
 }
 public static int ConvertToPixels(float mm, float?dpi, WriterBase writer)
 {
     if (dpi.HasValue)
     {
         return(SharedRenderer.ConvertToPixels(mm, dpi.Value));
     }
     return(writer.ConvertToPixels(mm));
 }
 public static void GetFontStyleInformation(RPLElementProps elementProperties, out RPLFormat.FontStyles fontStyle, out RPLFormat.FontWeights fontWeight, out RPLFormat.TextDecorations textDecoration, out float fontSize, out string fontFamily, ref bool fontStyleFromInstance)
 {
     fontSize       = (float)new RPLReportSize(SharedRenderer.GetStylePropertyValueString(elementProperties, (byte)21, ref fontStyleFromInstance)).ToPoints();
     fontStyle      = (RPLFormat.FontStyles)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)19, ref fontStyleFromInstance);
     fontWeight     = (RPLFormat.FontWeights)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)22, ref fontStyleFromInstance);
     textDecoration = (RPLFormat.TextDecorations)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)24, ref fontStyleFromInstance);
     fontFamily     = SharedRenderer.GetStylePropertyValueString(elementProperties, (byte)20, ref fontStyleFromInstance);
 }
Exemplo n.º 9
0
        public override void ClipTextboxRectangle(Win32DCSafeHandle hdc, RectangleF position)
        {
            if (this.m_bodyRect.X != 0 || this.m_bodyRect.Y != 0)
            {
                if (!AspNetCore.ReportingServices.Rendering.RichText.Win32.GetViewportOrgEx(hdc, out this.m_prevViewportOrg))
                {
                    int    lastWin32Error = Marshal.GetLastWin32Error();
                    string message        = string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "GetViewportOrgEx", lastWin32Error);
                    throw new Exception(message);
                }
                if (!AspNetCore.ReportingServices.Rendering.RichText.Win32.SetViewportOrgEx(hdc, this.m_bodyRect.X, this.m_bodyRect.Y, Win32ObjectSafeHandle.Zero))
                {
                    int    lastWin32Error2 = Marshal.GetLastWin32Error();
                    string message2        = string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SetViewportOrgEx", lastWin32Error2);
                    throw new Exception(message2);
                }
            }
            System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(SharedRenderer.ConvertToPixels(position.X, (float)base.m_commonGraphics.DpiX), SharedRenderer.ConvertToPixels(position.Y, (float)base.m_commonGraphics.DpiY), SharedRenderer.ConvertToPixels(position.Width, (float)base.m_commonGraphics.DpiX), SharedRenderer.ConvertToPixels(position.Height, (float)base.m_commonGraphics.DpiY));
            if (position.X < 0.0)
            {
                rectangle.Width += rectangle.X;
                rectangle.X      = 0;
            }
            if (position.Y < 0.0)
            {
                rectangle.Height += rectangle.Y;
                rectangle.Y       = 0;
            }
            rectangle.X += this.m_bodyRect.X;
            rectangle.Y += this.m_bodyRect.Y;
            if (rectangle.Right > this.m_bodyRect.Right)
            {
                rectangle.Width = this.m_bodyRect.Right - rectangle.Left;
            }
            if (rectangle.Bottom > this.m_bodyRect.Bottom)
            {
                rectangle.Height = this.m_bodyRect.Bottom - rectangle.Top;
            }
            Win32ObjectSafeHandle win32ObjectSafeHandle = AspNetCore.ReportingServices.Rendering.RichText.Win32.CreateRectRgn(rectangle.X, rectangle.Y, rectangle.Right, rectangle.Bottom);

            if (!win32ObjectSafeHandle.IsInvalid)
            {
                try
                {
                    if (AspNetCore.ReportingServices.Rendering.RichText.Win32.SelectClipRgn(hdc, win32ObjectSafeHandle) == 0)
                    {
                        int    lastWin32Error3 = Marshal.GetLastWin32Error();
                        string message3        = string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SelectClipRgn", lastWin32Error3);
                        throw new Exception(message3);
                    }
                }
                finally
                {
                    win32ObjectSafeHandle.Close();
                }
            }
        }
Exemplo n.º 10
0
        public override void BeginPageSection(RectangleF bounds)
        {
            base.BeginPageSection(bounds);
            int dpiX = base.m_commonGraphics.DpiX;
            int dpiY = base.m_commonGraphics.DpiY;

            this.m_bodyRect = new System.Drawing.Rectangle(SharedRenderer.ConvertToPixels(bounds.X, (float)dpiX), SharedRenderer.ConvertToPixels(bounds.Y, (float)dpiY), SharedRenderer.ConvertToPixels(bounds.Width + this.HalfPixelWidthX, (float)dpiX), SharedRenderer.ConvertToPixels(bounds.Height + this.HalfPixelWidthY, (float)dpiY));
            this.m_graphics.ResetClipAndTransform(new RectangleF(bounds.Left, bounds.Top, bounds.Width + this.HalfPixelWidthX, bounds.Height + this.HalfPixelWidthY));
        }
 public static void DrawImage(System.Drawing.Graphics graphics, Image image, RectangleF rectDestMM, RectangleF rectSourcePX, ImageAttributes imageAttributes)
 {
     SharedRenderer.DrawImage(graphics, image, new PointF[3]
     {
         rectDestMM.Location,
         new PointF(rectDestMM.Location.X + rectDestMM.Width, rectDestMM.Location.Y),
         new PointF(rectDestMM.Location.X, rectDestMM.Location.Y + rectDestMM.Height)
     }, rectSourcePX, imageAttributes);
 }
        public static RPLFormat.BorderStyles GetStylePropertyValueBorderStyle(RPLElementProps properties, byte style, RPLFormat.BorderStyles defaultStyle)
        {
            object stylePropertyValueObject = SharedRenderer.GetStylePropertyValueObject(properties, style);

            if (stylePropertyValueObject != null)
            {
                return((RPLFormat.BorderStyles)stylePropertyValueObject);
            }
            return(defaultStyle);
        }
        public static string GetStylePropertyValueString(RPLElementProps properties, byte style, ref bool fromInstance)
        {
            object stylePropertyValueObject = SharedRenderer.GetStylePropertyValueObject(properties, style, ref fromInstance);

            if (stylePropertyValueObject == null)
            {
                return(null);
            }
            return((string)stylePropertyValueObject);
        }
        public static void CalculateImageRectangle(RectangleF position, int width, int height, float horizontalResolution, float verticalResolution, RPLFormat.Sizings sizing, out RectangleF imagePositionAndSize, out RectangleF imagePortion)
        {
            imagePositionAndSize = position;
            if (sizing == RPLFormat.Sizings.Clip)
            {
                imagePortion = new RectangleF(0f, 0f, (float)width, (float)height);
                float num = (float)SharedRenderer.ConvertToPixels(imagePositionAndSize.Width, horizontalResolution);
                if ((float)width > num)
                {
                    imagePortion.Width = num;
                }
                else
                {
                    imagePositionAndSize.Width = SharedRenderer.ConvertToMillimeters(width, horizontalResolution);
                }
                float num2 = (float)SharedRenderer.ConvertToPixels(imagePositionAndSize.Height, verticalResolution);
                if ((float)height > num2)
                {
                    imagePortion.Height = num2;
                }
                else
                {
                    imagePositionAndSize.Height = SharedRenderer.ConvertToMillimeters(height, verticalResolution);
                }
            }
            else
            {
                imagePortion = new RectangleF(0f, 0f, (float)width, (float)height);
                switch (sizing)
                {
                case RPLFormat.Sizings.AutoSize:
                    imagePositionAndSize.Width  = SharedRenderer.ConvertToMillimeters(width, horizontalResolution);
                    imagePositionAndSize.Height = SharedRenderer.ConvertToMillimeters(height, verticalResolution);
                    break;

                case RPLFormat.Sizings.FitProportional:
                {
                    float num3 = SharedRenderer.ConvertToMillimeters(width, horizontalResolution);
                    float num4 = SharedRenderer.ConvertToMillimeters(height, verticalResolution);
                    float num5 = position.Width / num3;
                    float num6 = position.Height / num4;
                    if (num5 > num6)
                    {
                        imagePositionAndSize.Width = num3 * num6;
                    }
                    else
                    {
                        imagePositionAndSize.Height = num4 * num5;
                    }
                    break;
                }
                }
            }
        }
 public static bool CalculateImageClippedUnscaledBounds(WriterBase writer, RectangleF bounds, int width, int height, float xOffsetMM, float yOffsetMM, int?measureImageDpiX, int?measureImageDpiY, out RectangleF destination, out RectangleF source)
 {
     destination = Rectangle.Empty;
     source      = Rectangle.Empty;
     if (!(bounds.Left + xOffsetMM > bounds.Right) && !(bounds.Top + yOffsetMM > bounds.Bottom))
     {
         RectangleF rectangleF = default(RectangleF);
         float      num        = SharedRenderer.ConvertToMillimeters(width, (float?)measureImageDpiX, writer);
         if (xOffsetMM >= 0.0)
         {
             rectangleF.X     = bounds.Left + xOffsetMM;
             rectangleF.Width = Math.Min(num, bounds.Width - xOffsetMM);
         }
         else
         {
             rectangleF.X     = bounds.Left;
             rectangleF.Width = Math.Min(num, num + xOffsetMM);
         }
         float num2 = SharedRenderer.ConvertToMillimeters(height, (float?)measureImageDpiY, writer);
         if (yOffsetMM >= 0.0)
         {
             rectangleF.Y      = bounds.Top + yOffsetMM;
             rectangleF.Height = Math.Min(num2, bounds.Height - yOffsetMM);
         }
         else
         {
             rectangleF.Y      = bounds.Top;
             rectangleF.Height = Math.Min(num2, num2 + yOffsetMM);
         }
         if (!(rectangleF.Right < 0.0) && !(rectangleF.Bottom < 0.0))
         {
             destination = rectangleF;
             float x = 0f;
             if (xOffsetMM < 0.0)
             {
                 x = (float)(-SharedRenderer.ConvertToPixels(xOffsetMM, (float?)measureImageDpiX, writer));
             }
             float y = 0f;
             if (yOffsetMM < 0.0)
             {
                 y = (float)(-SharedRenderer.ConvertToPixels(yOffsetMM, (float?)measureImageDpiY, writer));
             }
             float width2  = (float)Math.Min(width, SharedRenderer.ConvertToPixels(rectangleF.Width, (float?)measureImageDpiX, writer));
             float height2 = (float)Math.Min(height, SharedRenderer.ConvertToPixels(rectangleF.Height, (float?)measureImageDpiY, writer));
             source = new RectangleF(x, y, width2, height2);
             return(true);
         }
         return(false);
     }
     return(false);
 }
Exemplo n.º 16
0
        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;
                }
            }
        }
Exemplo n.º 17
0
        public static GDIFont GetOrCreateFont(Dictionary <string, GDIFont> gdiFonts, string fontFamily, float fontSize, RPLFormat.FontWeights fontWeight, RPLFormat.FontStyles fontStyle, RPLFormat.TextDecorations textDecoration)
        {
            string  key     = GDIFont.GetKey(fontFamily, fontSize, fontWeight, fontStyle, textDecoration);
            GDIFont gDIFont = default(GDIFont);

            if (gdiFonts.TryGetValue(key, out gDIFont))
            {
                return(gDIFont);
            }
            bool flag        = SharedRenderer.IsWeightBold(fontWeight);
            bool flag2       = fontStyle == RPLFormat.FontStyles.Italic;
            bool underLine   = false;
            bool lineThrough = false;

            switch (textDecoration)
            {
            case RPLFormat.TextDecorations.Underline:
                underLine = true;
                break;

            case RPLFormat.TextDecorations.LineThrough:
                lineThrough = true;
                break;
            }
            Font font = null;

            try
            {
                font    = FontCache.CreateGdiPlusFont(fontFamily, fontSize, ref flag, ref flag2, lineThrough, underLine);
                gDIFont = new GDIFont(key, font, fontSize);
                gdiFonts.Add(key, gDIFont);
                return(gDIFont);
            }
            catch
            {
                if (font != null && !gdiFonts.ContainsKey(key))
                {
                    font.Dispose();
                    font = null;
                }
                throw;
            }
        }
 public static void DrawImage(System.Drawing.Graphics graphics, Image image, PointF[] pointsDestMM, RectangleF rectSourcePX, ImageAttributes imageAttributes)
 {
     PointF[] destPoints = new PointF[3]
     {
         new PointF((float)SharedRenderer.ConvertToPixels(pointsDestMM[0].X, graphics.DpiX), (float)SharedRenderer.ConvertToPixels(pointsDestMM[0].Y, graphics.DpiY)),
         new PointF((float)SharedRenderer.ConvertToPixels(pointsDestMM[1].X, graphics.DpiX), (float)SharedRenderer.ConvertToPixels(pointsDestMM[1].Y, graphics.DpiY)),
         new PointF((float)SharedRenderer.ConvertToPixels(pointsDestMM[2].X, graphics.DpiX), (float)SharedRenderer.ConvertToPixels(pointsDestMM[2].Y, graphics.DpiY))
     };
     using (Matrix matrix = graphics.Transform)
     {
         using (Matrix transform = new Matrix(matrix.Elements[0], matrix.Elements[1], matrix.Elements[2], matrix.Elements[3], (float)SharedRenderer.ConvertToPixels(matrix.Elements[4], graphics.DpiX), (float)SharedRenderer.ConvertToPixels(matrix.Elements[5], graphics.DpiY)))
         {
             graphics.Transform = transform;
             graphics.PageUnit  = GraphicsUnit.Pixel;
             graphics.DrawImage(image, destPoints, rectSourcePX, GraphicsUnit.Pixel, imageAttributes);
             graphics.PageUnit  = GraphicsUnit.Millimeter;
             graphics.Transform = matrix;
         }
     }
 }
        public static int CalculateRowZIndex(RPLTablixRow row)
        {
            int num = 2147483647;

            for (int i = 0; i < row.NumCells; i++)
            {
                RPLTablixMemberCell rPLTablixMemberCell = row[i] as RPLTablixMemberCell;
                if (rPLTablixMemberCell != null)
                {
                    num = Math.Min(num, SharedRenderer.CalculateZIndex(rPLTablixMemberCell));
                }
            }
            if (row.OmittedHeaders != null && row.OmittedHeaders.Count > 0)
            {
                for (int j = 0; j < row.OmittedHeaders.Count; j++)
                {
                    num = Math.Min(num, SharedRenderer.CalculateZIndex(row.OmittedHeaders[j]));
                }
            }
            return(num);
        }
Exemplo n.º 20
0
        public void DrawTextRun(TextRun run, Paragraph paragraph, Win32DCSafeHandle hdc, float dpiX, FontCache fontCache, int x, int y, int baselineY, int lineHeight, Rectangle layoutRectangle)
        {
            TypeCode typeCode = ((RPLTextBoxPropsDef)this.m_source.Definition).SharedTypeCode;

            if (typeCode == TypeCode.Object)
            {
                typeCode = this.m_source.TypeCode;
            }
            ReportTextRun reportTextRun = run.TextRunProperties as ReportTextRun;

            if (reportTextRun != null && reportTextRun.ActionInfo != null && reportTextRun.ActionInfo.Actions.Length > 0)
            {
                RPLActionInfo actionInfo = reportTextRun.ActionInfo;
                RectangleF    position   = default(RectangleF);
                if (this.WritingMode == RPLFormat.WritingModes.Horizontal)
                {
                    position.Width  = SharedRenderer.ConvertToMillimeters(run.GetWidth(hdc, fontCache), fontCache.Dpi);
                    position.Height = SharedRenderer.ConvertToMillimeters(run.GetHeight(hdc, fontCache), fontCache.Dpi);
                    position.X      = SharedRenderer.ConvertToMillimeters(layoutRectangle.X, fontCache.Dpi) + SharedRenderer.ConvertToMillimeters(x, fontCache.Dpi);
                    position.Y      = SharedRenderer.ConvertToMillimeters(layoutRectangle.Y, fontCache.Dpi) + (SharedRenderer.ConvertToMillimeters(y, fontCache.Dpi) - position.Height);
                }
                else
                {
                    position.Width  = SharedRenderer.ConvertToMillimeters(run.GetHeight(hdc, fontCache), fontCache.Dpi);
                    position.Height = SharedRenderer.ConvertToMillimeters(run.GetWidth(hdc, fontCache), fontCache.Dpi);
                    if (this.WritingMode == RPLFormat.WritingModes.Vertical)
                    {
                        position.X = SharedRenderer.ConvertToMillimeters(layoutRectangle.Right, fontCache.Dpi) - SharedRenderer.ConvertToMillimeters(y, fontCache.Dpi);
                        position.Y = SharedRenderer.ConvertToMillimeters(layoutRectangle.Y, fontCache.Dpi) + SharedRenderer.ConvertToMillimeters(x, fontCache.Dpi);
                    }
                    else
                    {
                        position.X = SharedRenderer.ConvertToMillimeters(layoutRectangle.X, fontCache.Dpi) + SharedRenderer.ConvertToMillimeters(y, fontCache.Dpi) - position.Width;
                        position.Y = SharedRenderer.ConvertToMillimeters(layoutRectangle.Bottom, fontCache.Dpi) - SharedRenderer.ConvertToMillimeters(x, fontCache.Dpi) - position.Height;
                    }
                }
                this.m_writer.ProcessAction(reportTextRun.UniqueName, actionInfo, position);
            }
            this.m_writer.DrawTextRun(hdc, fontCache, this, run, typeCode, paragraph.ParagraphProps.Alignment, this.VerticalAlignment, this.WritingMode, this.Direction, new Point(x, y), layoutRectangle, lineHeight, baselineY);
        }
 public static bool GetImage(RPLReport rplReport, ref byte[] imageData, long imageDataOffset, ref GDIImageProps gdiImageProps)
 {
     if (SharedRenderer.GetImage(rplReport, ref imageData, imageDataOffset))
     {
         if (gdiImageProps == null)
         {
             try
             {
                 using (Image image = Image.FromStream(new MemoryStream(imageData)))
                 {
                     gdiImageProps = new GDIImageProps(image);
                 }
             }
             catch
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 22
0
        private static string GetKey(string fontFamily, float fontSize, RPLFormat.FontWeights fontWeight, RPLFormat.FontStyles fontStyle, RPLFormat.TextDecorations textDecoration)
        {
            StringBuilder stringBuilder = new StringBuilder("FO");

            stringBuilder.Append(fontFamily);
            stringBuilder.Append(fontSize.ToString(CultureInfo.InvariantCulture));
            if (SharedRenderer.IsWeightBold(fontWeight))
            {
                stringBuilder.Append('b');
            }
            else
            {
                stringBuilder.Append('n');
            }
            if (fontStyle == RPLFormat.FontStyles.Italic)
            {
                stringBuilder.Append('i');
            }
            else
            {
                stringBuilder.Append('n');
            }
            switch (textDecoration)
            {
            case RPLFormat.TextDecorations.Underline:
                stringBuilder.Append('u');
                break;

            case RPLFormat.TextDecorations.LineThrough:
                stringBuilder.Append('s');
                break;

            default:
                stringBuilder.Append('n');
                break;
            }
            return(stringBuilder.ToString());
        }
Exemplo n.º 23
0
 private void CalculateMetafileRectangle(float pageWidth, float pageHeight)
 {
     if (this.IsEmf)
     {
         Win32DCSafeHandle hdc = this.m_graphics.GetHdc();
         try
         {
             int    deviceCaps  = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 4);
             int    deviceCaps2 = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 6);
             int    deviceCaps3 = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 8);
             int    deviceCaps4 = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 10);
             double num         = (double)SharedRenderer.ConvertToPixels(pageWidth, (float)this.m_graphics.DpiX);
             double num2        = (double)SharedRenderer.ConvertToPixels(pageHeight, (float)this.m_graphics.DpiY);
             float  width       = (float)(num * (double)deviceCaps * 100.0) / (float)deviceCaps3;
             float  height      = (float)(num2 * (double)deviceCaps2 * 100.0) / (float)deviceCaps4;
             this.MetafileRectangle = new RectangleF(0f, 0f, width, height);
         }
         finally
         {
             this.m_graphics.ReleaseHdc();
         }
     }
 }
Exemplo n.º 24
0
 public int ConvertToPixels(float mm)
 {
     return(SharedRenderer.ConvertToPixels(mm, (float)this.m_dpiX));
 }
Exemplo n.º 25
0
 public float ConvertToMillimeters(int pixels)
 {
     return(SharedRenderer.ConvertToMillimeters(pixels, (float)this.m_dpiX));
 }
 public static bool CalculateImageClippedUnscaledBounds(WriterBase writer, RectangleF bounds, int width, int height, float xOffsetMM, float yOffsetMM, out RectangleF destination, out RectangleF source)
 {
     return(SharedRenderer.CalculateImageClippedUnscaledBounds(writer, bounds, width, height, xOffsetMM, yOffsetMM, (int?)null, (int?)null, out destination, out source));
 }
 public static void CalculateImageRectangle(RectangleF position, GDIImageProps gdiProperties, RPLFormat.Sizings sizing, out RectangleF imagePositionAndSize, out RectangleF imagePortion)
 {
     SharedRenderer.CalculateImageRectangle(position, gdiProperties.Width, gdiProperties.Height, gdiProperties.HorizontalResolution, gdiProperties.VerticalResolution, sizing, out imagePositionAndSize, out imagePortion);
 }
        public static string GetStylePropertyValueString(RPLElementProps properties, byte style)
        {
            bool flag = false;

            return(SharedRenderer.GetStylePropertyValueString(properties, style, ref flag));
        }
 public static void DrawImage(System.Drawing.Graphics graphics, Image image, RectangleF rectDestMM, RectangleF rectSourcePX)
 {
     SharedRenderer.DrawImage(graphics, image, rectDestMM, rectSourcePX, null);
 }