コード例 #1
0
        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;
            }
        }
コード例 #2
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;
                }
            }
        }
コード例 #3
0
        internal RenderingReport(GdiContext context)
        {
            RPLPageContent rPLPageContent = context.RplReport.RPLPaginatedPages[0];
            RPLPageLayout  pageLayout     = rPLPageContent.PageLayout;

            context.RenderingReport = this;
            float maxSectionWidth = rPLPageContent.MaxSectionWidth;

            m_position.X      = float.MaxValue;
            m_position.Y      = 0f;
            m_position.Width  = maxSectionWidth;
            m_position.Height = 0f;
            m_reportSections  = new List <RenderingReportSection>(rPLPageContent.ReportSectionSizes.Length);
            int num = 0;

            while (rPLPageContent.HasNextReportSection())
            {
                RPLReportSection nextReportSection = rPLPageContent.GetNextReportSection();
                RPLSizes         rPLSizes          = rPLPageContent.ReportSectionSizes[num];
                m_reportSections.Add(new RenderingReportSection(context, nextReportSection, rPLSizes, num, maxSectionWidth, m_position.Height));
                m_position.X       = Math.Min(m_position.X, rPLSizes.Left);
                m_position.Height += rPLSizes.Height;
                num++;
            }
            object obj = pageLayout.Style[34];

            if (obj != null)
            {
                BackgroundColor = new RPLReportColor((string)obj).ToColor();
            }
            object obj2 = pageLayout.Style[33];

            if (obj2 != null)
            {
                BackgroundImage = RenderingItem.GetImage(context, (RPLImageData)obj2);
                object obj3 = pageLayout.Style[35];
                if (obj3 == null)
                {
                    BackgroundRepeat = RPLFormat.BackgroundRepeatTypes.Repeat;
                }
                else
                {
                    BackgroundRepeat = (RPLFormat.BackgroundRepeatTypes)obj3;
                }
            }
            ProcessBorders(context.GdiWriter, pageLayout.Style, m_position, m_position, 0);
        }
コード例 #4
0
        internal void ProcessBackgroundColorAndImage(GdiContext context, RPLElementProps properties)
        {
            m_backgroundColor = GdiContext.GetStylePropertyValueColor(properties, 34);
            object stylePropertyValueObject = SharedRenderer.GetStylePropertyValueObject(properties, 33);

            if (stylePropertyValueObject != null)
            {
                m_backgroundImage = GetImage(context, (RPLImageData)stylePropertyValueObject);
                object stylePropertyValueObject2 = SharedRenderer.GetStylePropertyValueObject(properties, 35);
                if (stylePropertyValueObject2 == null)
                {
                    m_backgroundRepeat = RPLFormat.BackgroundRepeatTypes.Repeat;
                }
                else
                {
                    m_backgroundRepeat = (RPLFormat.BackgroundRepeatTypes)stylePropertyValueObject2;
                }
            }
        }
コード例 #5
0
        public static string GetValue(RPLFormat.BackgroundRepeatTypes val)
        {
            switch (val)
            {
            case RPLFormat.BackgroundRepeatTypes.Repeat:
                return("repeat");

            case RPLFormat.BackgroundRepeatTypes.Clip:
                return("no-repeat");

            case RPLFormat.BackgroundRepeatTypes.RepeatX:
                return("repeat-x");

            case RPLFormat.BackgroundRepeatTypes.RepeatY:
                return("repeat-y");

            default:
                return(null);
            }
        }
コード例 #6
0
 public virtual void DrawBackgroundImage(RPLImageData imageData, RPLFormat.BackgroundRepeatTypes repeat, PointF start, RectangleF position)
 {
 }
コード例 #7
0
        internal static void DrawBackgroundImage(GdiContext context, Image backgroundImage, RPLFormat.BackgroundRepeatTypes backgroundRepeat, RectangleF position)
        {
            if (backgroundImage is Bitmap)
            {
                ((Bitmap)backgroundImage).SetResolution(96f, 96f);
            }
            int width  = backgroundImage.Width;
            int height = backgroundImage.Height;

            if (backgroundRepeat == RPLFormat.BackgroundRepeatTypes.Clip)
            {
                DrawImageClipped(context, backgroundImage, 0f, 0f, position);
                return;
            }
            int   num  = context.GdiWriter.ConvertToPixels(position.Width);
            int   num2 = context.GdiWriter.ConvertToPixels(position.Height);
            float num3 = context.GdiWriter.ConvertToMillimeters(width);
            float num4 = context.GdiWriter.ConvertToMillimeters(height);
            float num5 = 0f;
            float num6 = 0f;

            switch (backgroundRepeat)
            {
            case RPLFormat.BackgroundRepeatTypes.Repeat:
            {
                for (int j = 0; j < num; j += width)
                {
                    num6 = 0f;
                    for (int k = 0; k < num2; k += height)
                    {
                        DrawImageClipped(context, backgroundImage, num5, num6, position);
                        num6 += num4;
                    }
                    num5 += num3;
                }
                break;
            }

            case RPLFormat.BackgroundRepeatTypes.RepeatX:
            {
                for (int l = 0; l < num; l += width)
                {
                    DrawImageClipped(context, backgroundImage, num5, num6, position);
                    num5 += num3;
                }
                break;
            }

            case RPLFormat.BackgroundRepeatTypes.RepeatY:
            {
                for (int i = 0; i < num2; i += height)
                {
                    DrawImageClipped(context, backgroundImage, num5, num6, position);
                    num6 += num4;
                }
                break;
            }
            }
        }