Esempio n. 1
0
 internal override void DrawContent(GdiContext context)
 {
     if (Image == null)
     {
         return;
     }
     if (!m_processedImage)
     {
         if (Image is Bitmap)
         {
             ((Bitmap)Image).SetResolution(96f, 96f);
         }
         SharedRenderer.CalculateImageRectangle(ImagePosition, Image.Width, Image.Height, Image.HorizontalResolution, Image.VerticalResolution, Sizing, out ImagePosition, out ImagePositionPX);
         if (InstanceProperties is RPLImageProps)
         {
             ProcessActions(context, InstanceProperties.UniqueName, ((RPLImageProps)InstanceProperties).ActionInfo, ImagePosition);
         }
         ProcessImageMap(context);
         m_processedImage = true;
     }
     if (!(ImagePosition.Width <= 0f) && !(ImagePosition.Height <= 0f))
     {
         SharedRenderer.DrawImage(context.Graphics, Image, ImagePosition, ImagePositionPX);
     }
 }
Esempio n. 2
0
 public void AddElement(Element element)
 {
     Elements.Add(element);
     if (IsActive)
     {
         SharedRenderer.Add(element);
     }
 }
        private void DrawResourceImage(GdiContext context, Bitmap image, RectangleF itemRectangleMM, RectangleF imageRectanglePX)
        {
            InterpolationMode interpolationMode = context.Graphics.InterpolationMode;

            context.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
            SharedRenderer.DrawImage(context.Graphics, image, itemRectangleMM, imageRectanglePX);
            context.Graphics.InterpolationMode = interpolationMode;
        }
Esempio n. 4
0
 public virtual void Update(DeltaTime dt)
 {
     for (int i = 0; i < Elements.Count; i++)
     {
         Elements[i].Update(dt);
     }
     SharedRenderer.Update( );
 }
Esempio n. 5
0
        internal static float GetStylePropertyValueSizeMM(RPLElementProps properties, byte style)
        {
            string text = (string)SharedRenderer.GetStylePropertyValueObject(properties, style);

            if (string.IsNullOrEmpty(text))
            {
                return(float.NaN);
            }
            return((float)new RPLReportSize(text).ToMillimeters());
        }
Esempio n. 6
0
        internal static float GetStylePropertyValueSizePT(RPLElementProps properties, byte style, ref bool fromInstance)
        {
            string text = (string)SharedRenderer.GetStylePropertyValueObject(properties, style, ref fromInstance);

            if (string.IsNullOrEmpty(text))
            {
                return(float.NaN);
            }
            return((float)new RPLReportSize(text).ToPoints());
        }
Esempio n. 7
0
        internal 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);
        }
Esempio n. 8
0
        internal static Color GetStylePropertyValueColor(RPLElementProps properties, byte style)
        {
            string text = (string)SharedRenderer.GetStylePropertyValueObject(properties, style);

            if (string.IsNullOrEmpty(text) || string.Compare(text, "TRANSPARENT", StringComparison.OrdinalIgnoreCase) == 0)
            {
                return(Color.Empty);
            }
            return(new RPLReportColor(text).ToColor());
        }
Esempio n. 9
0
 public virtual void Update(DeltaTime dt)
 {
     if (IsDirty)
     {
         if (Container.IsDirty)
         {
             Container.Refresh( );
         }
         SharedRenderer.RequestUpdate(this);
         IsDirty = false;
     }
 }
        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;
                }
            }
        }
        internal override void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds)
        {
            Color = GdiContext.GetStylePropertyValueColor(InstanceProperties, 0);
            Width = GdiContext.GetStylePropertyValueSizeMM(InstanceProperties, 10);
            switch ((RPLFormat.BorderStyles)SharedRenderer.GetStylePropertyValueObject(InstanceProperties, 5))
            {
            case RPLFormat.BorderStyles.Dotted:
                Style = DashStyle.Dot;
                break;

            case RPLFormat.BorderStyles.Dashed:
                Style = DashStyle.Dash;
                break;

            default:
                Style = DashStyle.Solid;
                break;
            }
        }
        internal override void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds)
        {
            RPLTablix       rPLTablix        = (RPLTablix)rplElement;
            FixedHeaderItem fixedHeaderItem  = null;
            FixedHeaderItem fixedHeaderItem2 = null;
            FixedHeaderItem fixedHeaderItem3 = null;
            float           num  = 0f;
            float           num2 = bounds.Top;

            float[] array = null;
            array = ((rPLTablix.ColumnWidths == null) ? new float[0] : new float[rPLTablix.ColumnWidths.Length]);
            int[] array2 = new int[array.Length];
            for (int i = 0; i < array2.Length; i++)
            {
                array2[i] = int.MaxValue;
            }
            for (int j = 0; j < array.Length; j++)
            {
                if (j > 0)
                {
                    array[j] = array[j - 1] + rPLTablix.ColumnWidths[j - 1];
                }
                if (rPLTablix.FixedColumns[j])
                {
                    if (fixedHeaderItem3 == null)
                    {
                        fixedHeaderItem3              = new FixedHeaderItem(this, base.Position, FixedHeaderItem.LayoutType.Vertical);
                        fixedHeaderItem3.Bounds.X    += array[j];
                        fixedHeaderItem3.Bounds.Width = rPLTablix.ColumnWidths[j];
                    }
                    else
                    {
                        fixedHeaderItem3.Bounds.X      = Math.Min(fixedHeaderItem3.Bounds.X, base.Position.X + array[j]);
                        fixedHeaderItem3.Bounds.Width += rPLTablix.ColumnWidths[j];
                    }
                }
            }
            if (rPLTablix.FixedRow(0))
            {
                fixedHeaderItem = new FixedHeaderItem(this, base.Position, FixedHeaderItem.LayoutType.Horizontal);
                fixedHeaderItem.Bounds.Height = 0f;
                context.RenderingReport.FixedHeaders.Add(fixedHeaderItem);
            }
            if (fixedHeaderItem3 != null)
            {
                context.RenderingReport.FixedHeaders.Add(fixedHeaderItem3);
                if (rPLTablix.FixedRow(0))
                {
                    fixedHeaderItem2 = new FixedHeaderItem(this, base.Position, FixedHeaderItem.LayoutType.Corner);
                    context.RenderingReport.FixedHeaders.Add(fixedHeaderItem2);
                }
            }
            int          num3 = 0;
            int          num4 = -1;
            RPLTablixRow nextRow;

            while ((nextRow = rPLTablix.GetNextRow()) != null)
            {
                if (nextRow is RPLTablixOmittedRow)
                {
                    continue;
                }
                SharedRenderer.CalculateColumnZIndexes(rPLTablix, nextRow, num3, array2);
                if (nextRow.OmittedHeaders != null)
                {
                    for (int k = 0; k < nextRow.OmittedHeaders.Count; k++)
                    {
                        RPLTablixMemberCell rPLTablixMemberCell = nextRow.OmittedHeaders[k];
                        if (!string.IsNullOrEmpty(rPLTablixMemberCell.GroupLabel))
                        {
                            float x = bounds.X;
                            if (rPLTablixMemberCell.ColIndex < array.Length)
                            {
                                x = array[rPLTablixMemberCell.ColIndex];
                            }
                            context.RenderingReport.Labels.Add(rPLTablixMemberCell.UniqueName, new LabelPoint(x, num2));
                        }
                    }
                }
                int num5 = int.MaxValue;
                for (int l = 0; l < nextRow.NumCells; l++)
                {
                    RPLTablixCell      rPLTablixCell      = nextRow[l];
                    RPLItemMeasurement rPLItemMeasurement = new RPLItemMeasurement();
                    rPLItemMeasurement.Element = rPLTablixCell.Element;
                    rPLItemMeasurement.Left    = array[rPLTablixCell.ColIndex];
                    rPLItemMeasurement.Top     = num;
                    rPLItemMeasurement.Width   = rPLTablix.GetColumnWidth(rPLTablixCell.ColIndex, rPLTablixCell.ColSpan);
                    rPLItemMeasurement.Height  = rPLTablix.GetRowHeight(rPLTablixCell.RowIndex, rPLTablixCell.RowSpan);
                    RenderingItem renderingItem = RenderingItem.CreateRenderingItem(context, rPLItemMeasurement, bounds);
                    if (renderingItem == null)
                    {
                        continue;
                    }
                    if (renderingItem is RenderingDynamicImage)
                    {
                        ((RenderingDynamicImage)renderingItem).Sizing = RPLFormat.Sizings.Fit;
                    }
                    RPLTablixMemberCell rPLTablixMemberCell2 = rPLTablixCell as RPLTablixMemberCell;
                    if (rPLTablixMemberCell2 != null && !string.IsNullOrEmpty(rPLTablixMemberCell2.GroupLabel))
                    {
                        context.RenderingReport.Labels.Add(rPLTablixMemberCell2.UniqueName, new LabelPoint(rPLItemMeasurement.Left, rPLItemMeasurement.Top));
                    }
                    if (renderingItem.HasBorders)
                    {
                        renderingItem.DelayDrawBorders = true;
                        if (num3 < rPLTablix.ColumnHeaderRows && rPLTablixCell is RPLTablixCornerCell)
                        {
                            m_cornerBorders.Add(new RenderingItemBorderTablix(0, 0, rPLTablixCell.RowIndex, rPLTablixCell.ColIndex, renderingItem));
                        }
                        else
                        {
                            if (num5 == int.MaxValue)
                            {
                                num5 = SharedRenderer.CalculateRowZIndex(nextRow);
                            }
                            if (num5 == int.MaxValue)
                            {
                                num5 = num4;
                            }
                            RenderingItemBorderTablix renderingItemBorderTablix = new RenderingItemBorderTablix(num5, array2[rPLTablixCell.ColIndex], rPLTablixCell.RowIndex, rPLTablixCell.ColIndex, renderingItem);
                            if (rPLTablixMemberCell2 != null)
                            {
                                if (num3 < rPLTablix.ColumnHeaderRows)
                                {
                                    m_columnHeaderBorders.Add(renderingItemBorderTablix);
                                }
                                else
                                {
                                    renderingItemBorderTablix.CompareRowFirst = false;
                                    m_rowHeaderBorders.Add(renderingItemBorderTablix);
                                }
                            }
                            else
                            {
                                m_detailCellBorders.Add(renderingItemBorderTablix);
                            }
                        }
                    }
                    base.Children.Add(renderingItem);
                    fixedHeaderItem?.RenderingItems.Add(renderingItem);
                    if (rPLTablix.FixedColumns[rPLTablixCell.ColIndex])
                    {
                        fixedHeaderItem3.RenderingItems.Add(renderingItem);
                    }
                    if (fixedHeaderItem2 != null && rPLTablixCell is RPLTablixCornerCell)
                    {
                        fixedHeaderItem2.RenderingItems.Add(renderingItem);
                        fixedHeaderItem2.Bounds = renderingItem.Position;
                    }
                }
                num4 = num5;
                if (fixedHeaderItem != null)
                {
                    fixedHeaderItem.Bounds.Height += rPLTablix.RowHeights[num3];
                    if (num3 == rPLTablix.RowHeights.Length - 1 || !rPLTablix.FixedRow(num3 + 1))
                    {
                        fixedHeaderItem = null;
                    }
                }
                num  += rPLTablix.RowHeights[num3];
                num2 += rPLTablix.RowHeights[num3];
                num3++;
                for (int m = 0; m < nextRow.NumCells; m++)
                {
                    nextRow[m] = null;
                }
            }
            m_detailCellBorders.Sort(new ZIndexComparer());
            m_columnHeaderBorders.Sort(new ZIndexComparer());
            m_rowHeaderBorders.Sort(new ZIndexComparer());
            m_cornerBorders.Sort(new ZIndexComparer());
            RectangleF position = base.Position;

            if (array.Length != 0)
            {
                position.Width = array[array.Length - 1] + rPLTablix.ColumnWidths[rPLTablix.ColumnWidths.Length - 1];
            }
            position.Height = num;
        }
        private void ProcessBorders(GdiWriter writer, RPLElementStyle style, RectangleF position, RectangleF bounds, byte state)
        {
            RPLFormat.BorderStyles stylePropertyValueBorderStyle = SharedRenderer.GetStylePropertyValueBorderStyle(style, 5, RPLFormat.BorderStyles.None);
            BorderLeft.Style   = SharedRenderer.GetStylePropertyValueBorderStyle(style, 6, stylePropertyValueBorderStyle);
            BorderTop.Style    = SharedRenderer.GetStylePropertyValueBorderStyle(style, 8, stylePropertyValueBorderStyle);
            BorderRight.Style  = SharedRenderer.GetStylePropertyValueBorderStyle(style, 7, stylePropertyValueBorderStyle);
            BorderBottom.Style = SharedRenderer.GetStylePropertyValueBorderStyle(style, 9, stylePropertyValueBorderStyle);
            if (BorderLeft.Style == RPLFormat.BorderStyles.None && BorderTop.Style == RPLFormat.BorderStyles.None && BorderRight.Style == RPLFormat.BorderStyles.None && BorderBottom.Style == RPLFormat.BorderStyles.None)
            {
                return;
            }
            float reportSizeStyleMM = SharedRenderer.GetReportSizeStyleMM(style, 10);

            BorderLeft.Width = SharedRenderer.GetReportSizeStyleMM(style, 11);
            if (float.IsNaN(BorderLeft.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderLeft.Width = reportSizeStyleMM;
            }
            BorderTop.Width = SharedRenderer.GetReportSizeStyleMM(style, 13);
            if (float.IsNaN(BorderTop.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderTop.Width = reportSizeStyleMM;
            }
            BorderRight.Width = SharedRenderer.GetReportSizeStyleMM(style, 12);
            if (float.IsNaN(BorderRight.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderRight.Width = reportSizeStyleMM;
            }
            BorderBottom.Width = SharedRenderer.GetReportSizeStyleMM(style, 14);
            if (float.IsNaN(BorderBottom.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderBottom.Width = reportSizeStyleMM;
            }
            if (!float.IsNaN(BorderLeft.Width) || !float.IsNaN(BorderTop.Width) || !float.IsNaN(BorderRight.Width) || !float.IsNaN(BorderBottom.Width))
            {
                Color reportColorStyle = SharedRenderer.GetReportColorStyle(style, 0);
                BorderLeft.Color = SharedRenderer.GetReportColorStyle(style, 1);
                if (BorderLeft.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderLeft.Color = reportColorStyle;
                }
                BorderTop.Color = SharedRenderer.GetReportColorStyle(style, 3);
                if (BorderTop.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderTop.Color = reportColorStyle;
                }
                BorderRight.Color = SharedRenderer.GetReportColorStyle(style, 2);
                if (BorderRight.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderRight.Color = reportColorStyle;
                }
                BorderBottom.Color = SharedRenderer.GetReportColorStyle(style, 4);
                if (BorderBottom.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderBottom.Color = reportColorStyle;
                }
                if (!(BorderLeft.Color == Color.Empty) || !(BorderTop.Color == Color.Empty) || !(BorderRight.Color == Color.Empty) || !(BorderBottom.Color == Color.Empty))
                {
                    RenderingItem.ProcessBorders(writer, ref BorderTop, ref BorderLeft, ref BorderBottom, ref BorderRight, position, bounds, state);
                }
            }
        }
Esempio n. 14
0
 internal override int ConvertToPixels(float mm)
 {
     return(SharedRenderer.ConvertToPixels(mm, 96f));
 }
Esempio n. 15
0
 internal override float ConvertToMillimeters(int pixels)
 {
     return(SharedRenderer.ConvertToMillimeters(pixels, 96f));
 }
        public void DrawTextRun(TextRun run, Paragraph paragraph, Win32DCSafeHandle hdc, float dpiX, FontCache fontCache, int x, int y, int baselineY, int lineHeight, Rectangle layoutRectangle)
        {
            RPLFormat.WritingModes writingMode = WritingMode;
            if (string.IsNullOrEmpty(run.Text))
            {
                return;
            }
            Underline underline = null;

            if (run.UnderlineHeight > 0)
            {
                underline = new Underline(run, hdc, fontCache, layoutRectangle, x, baselineY, writingMode);
            }
            int x2;
            int baselineY2;

            switch (writingMode)
            {
            case RPLFormat.WritingModes.Horizontal:
                x2         = layoutRectangle.X + x;
                baselineY2 = layoutRectangle.Y + baselineY;
                break;

            case RPLFormat.WritingModes.Vertical:
                x2         = layoutRectangle.X + (layoutRectangle.Width - baselineY);
                baselineY2 = layoutRectangle.Y + x;
                break;

            case RPLFormat.WritingModes.Rotate270:
                x2         = layoutRectangle.X + baselineY;
                baselineY2 = layoutRectangle.Y + layoutRectangle.Height - x;
                break;

            default:
                throw new NotSupportedException();
            }
            if (!m_context.TestMode)
            {
                TextBox.DrawTextRun(run, hdc, fontCache, x2, baselineY2, underline);
            }
            else
            {
                TextBox.ExtDrawTextRun(run, hdc, fontCache, x2, baselineY2, underline);
            }
            RenderingTextRun renderingTextRun = run.TextRunProperties as RenderingTextRun;

            if (renderingTextRun == null)
            {
                return;
            }
            RPLTextRunProps rPLTextRunProps = renderingTextRun.InstanceProperties as RPLTextRunProps;

            if (rPLTextRunProps == null)
            {
                return;
            }
            float  num      = SharedRenderer.ConvertToMillimeters(run.GetWidth(hdc, fontCache), dpiX);
            float  num2     = SharedRenderer.ConvertToMillimeters(run.GetHeight(hdc, fontCache), dpiX);
            float  num3     = SharedRenderer.ConvertToMillimeters(x, dpiX);
            float  num4     = SharedRenderer.ConvertToMillimeters(y, dpiX);
            SizeF  empty    = SizeF.Empty;
            PointF location = PointF.Empty;

            if (writingMode == RPLFormat.WritingModes.Horizontal)
            {
                empty    = new SizeF(num, num2);
                location = new PointF(num3 + TextPosition.X, num4 - num2 + TextPosition.Y);
            }
            else
            {
                empty = new SizeF(num2, num);
                if (writingMode == RPLFormat.WritingModes.Vertical)
                {
                    float num5 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Right, dpiX);
                    float num6 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Y, dpiX);
                    location = new PointF(num5 - num4, num6 + num3);
                }
                else
                {
                    float num7 = SharedRenderer.ConvertToMillimeters(layoutRectangle.X, dpiX);
                    float num8 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Bottom, dpiX);
                    location = new PointF(num7 + num4 - num2, num8 - num3 - num);
                }
            }
            RectangleF position = new RectangleF(location, empty);

            renderingTextRun.ProcessActions(m_context, rPLTextRunProps.UniqueName, rPLTextRunProps.ActionInfo, position);
            string toolTip = renderingTextRun.ToolTip;

            if (!string.IsNullOrEmpty(toolTip))
            {
                m_context.RenderingReport.ToolTips.Add(new ReportToolTip(rPLTextRunProps.UniqueName, position, toolTip));
            }
        }
        internal static void ProcessBorders(GdiWriter writer, ref RenderingItemBorder top, ref RenderingItemBorder left, ref RenderingItemBorder bottom, ref RenderingItemBorder right, RectangleF position, RectangleF bounds, byte state)
        {
            if (!top.IsVisible && !left.IsVisible && !bottom.IsVisible && !right.IsVisible)
            {
                return;
            }
            left.Point = position.Left;
            left.Edge  = position.Left;
            float borderLeftEdgeUnclipped = 0f;

            right.Point = position.Right;
            right.Edge  = position.Right;
            float borderRightEdgeUnclipped = 0f;

            top.Point = position.Top;
            top.Edge  = position.Top;
            float borderTopEdgeUnclipped = 0f;

            bottom.Point = position.Bottom;
            bottom.Edge  = position.Bottom;
            float borderBottomEdgeUnclipped = 0f;
            float width  = left.Width;
            float width2 = right.Width;
            float width3 = top.Width;
            float width4 = bottom.Width;

            if (left.Style == RPLFormat.BorderStyles.Double && left.Width < 0.5292f)
            {
                left.Style = RPLFormat.BorderStyles.Solid;
            }
            if (right.Style == RPLFormat.BorderStyles.Double && right.Width < 0.5292f)
            {
                right.Style = RPLFormat.BorderStyles.Solid;
            }
            if (top.Style == RPLFormat.BorderStyles.Double && top.Width < 0.5292f)
            {
                top.Style = RPLFormat.BorderStyles.Solid;
            }
            if (bottom.Style == RPLFormat.BorderStyles.Double && bottom.Width < 0.5292f)
            {
                bottom.Style = RPLFormat.BorderStyles.Solid;
            }
            if (left.IsVisible)
            {
                left.Edge -= left.Width / 2f;
                borderLeftEdgeUnclipped = left.Edge;
                if (left.Edge < bounds.Left)
                {
                    float num = bounds.Left - left.Edge;
                    left.Width -= num;
                    left.Point += num / 2f;
                    left.Edge   = bounds.Left;
                }
            }
            else
            {
                left.Width = 0f;
            }
            if (right.IsVisible)
            {
                right.Edge += right.Width / 2f;
                borderRightEdgeUnclipped = right.Edge;
                if (right.Edge > bounds.Right)
                {
                    float num2 = right.Edge - bounds.Right;
                    right.Width -= num2;
                    right.Point -= num2 / 2f;
                    right.Edge   = bounds.Right;
                }
            }
            else
            {
                right.Width = 0f;
            }
            if (top.IsVisible)
            {
                top.Edge -= top.Width / 2f;
                borderTopEdgeUnclipped = top.Edge;
                if (top.Edge < bounds.Top)
                {
                    float num3 = bounds.Top - top.Edge;
                    top.Width -= num3;
                    top.Point += num3 / 2f;
                    top.Edge   = bounds.Top;
                }
            }
            else
            {
                top.Width = 0f;
            }
            if (bottom.IsVisible)
            {
                bottom.Edge += bottom.Width / 2f;
                borderBottomEdgeUnclipped = bottom.Edge;
                if (bottom.Edge > bounds.Bottom)
                {
                    float num4 = bottom.Edge - bounds.Bottom;
                    bottom.Width -= num4;
                    bottom.Point -= num4 / 2f;
                    bottom.Edge   = bounds.Bottom;
                }
            }
            else
            {
                bottom.Width = 0f;
            }
            left.Edge   = Math.Max(bounds.Left, left.Edge);
            right.Edge  = Math.Min(bounds.Right, right.Edge);
            top.Edge    = Math.Max(bounds.Top, top.Edge);
            bottom.Edge = Math.Min(bounds.Bottom, bottom.Edge);
            if (top.Style != RPLFormat.BorderStyles.Double && state == 0 && top.Style == left.Style && top.Style == bottom.Style && top.Style == right.Style && top.Width == left.Width && top.Width == bottom.Width && top.Width == right.Width && top.Color == left.Color && top.Color == bottom.Color && top.Color == right.Color)
            {
                RectangleF rectangle = new RectangleF(left.Point, top.Point, right.Point - left.Point, bottom.Point - top.Point);
                top.Operations = new List <Operation>(1);
                top.Operations.Add(new DrawRectangleOp(top.Color, top.Width, top.Style, rectangle));
                return;
            }
            float halfPixelWidthX = writer.HalfPixelWidthX;
            float halfPixelWidthY = writer.HalfPixelWidthY;
            float num5            = Math.Min(halfPixelWidthY, top.Width / 2f);
            float num6            = Math.Min(halfPixelWidthX, left.Width / 2f);
            float num7            = Math.Min(halfPixelWidthY, bottom.Width / 2f);
            float num8            = Math.Min(halfPixelWidthX, right.Width / 2f);

            top.Operations = new List <Operation>();
            SharedRenderer.ProcessTopBorder(writer, top.Operations, top.Width, top.Style, top.Color, left.Color, right.Color, top.Point, top.Edge, left.Edge + num6, right.Edge - num8, borderTopEdgeUnclipped, borderLeftEdgeUnclipped, borderRightEdgeUnclipped, left.Width, right.Width, width3, width, width2);
            right.Operations = new List <Operation>();
            SharedRenderer.ProcessRightBorder(writer, right.Operations, right.Width, right.Style, right.Color, top.Color, bottom.Color, right.Point, right.Edge, top.Edge + num5, bottom.Edge - num7, borderRightEdgeUnclipped, borderTopEdgeUnclipped, borderBottomEdgeUnclipped, top.Width, bottom.Width, width2, width3, width4);
            left.Operations = new List <Operation>();
            SharedRenderer.ProcessLeftBorder(writer, left.Operations, left.Width, left.Style, left.Color, top.Color, bottom.Color, left.Point, left.Edge, top.Edge + num5, bottom.Edge - num7, borderLeftEdgeUnclipped, borderTopEdgeUnclipped, borderBottomEdgeUnclipped, top.Width, bottom.Width, width, width3, width4);
            bottom.Operations = new List <Operation>();
            SharedRenderer.ProcessBottomBorder(writer, bottom.Operations, bottom.Width, bottom.Style, bottom.Color, left.Color, right.Color, bottom.Point, bottom.Edge, left.Edge + num6, right.Edge - num8, borderBottomEdgeUnclipped, borderLeftEdgeUnclipped, borderRightEdgeUnclipped, left.Width, right.Width, width4, width, width2);
        }
        internal void ProcessBorders(GdiWriter writer, RPLItemProps properties, RectangleF bounds, byte state)
        {
            RPLFormat.BorderStyles stylePropertyValueBorderStyle = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 5, RPLFormat.BorderStyles.None);
            m_borderLeft.Style   = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 6, stylePropertyValueBorderStyle);
            m_borderRight.Style  = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 7, stylePropertyValueBorderStyle);
            m_borderTop.Style    = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 8, stylePropertyValueBorderStyle);
            m_borderBottom.Style = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 9, stylePropertyValueBorderStyle);
            if (m_borderLeft.Style == RPLFormat.BorderStyles.None && m_borderRight.Style == RPLFormat.BorderStyles.None && m_borderTop.Style == RPLFormat.BorderStyles.None && m_borderBottom.Style == RPLFormat.BorderStyles.None)
            {
                return;
            }
            float stylePropertyValueSizeMM = GdiContext.GetStylePropertyValueSizeMM(properties, 10);

            m_borderLeft.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 11);
            if (float.IsNaN(m_borderLeft.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderLeft.Width = stylePropertyValueSizeMM;
            }
            m_borderRight.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 12);
            if (float.IsNaN(m_borderRight.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderRight.Width = stylePropertyValueSizeMM;
            }
            m_borderTop.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 13);
            if (float.IsNaN(m_borderTop.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderTop.Width = stylePropertyValueSizeMM;
            }
            m_borderBottom.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 14);
            if (float.IsNaN(m_borderBottom.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderBottom.Width = stylePropertyValueSizeMM;
            }
            if (!float.IsNaN(m_borderLeft.Width) || !float.IsNaN(m_borderRight.Width) || !float.IsNaN(m_borderTop.Width) || !float.IsNaN(m_borderBottom.Width))
            {
                Color stylePropertyValueColor = GdiContext.GetStylePropertyValueColor(properties, 0);
                m_borderLeft.Color = GdiContext.GetStylePropertyValueColor(properties, 1);
                if (m_borderLeft.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderLeft.Color = stylePropertyValueColor;
                }
                m_borderRight.Color = GdiContext.GetStylePropertyValueColor(properties, 2);
                if (m_borderRight.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderRight.Color = stylePropertyValueColor;
                }
                m_borderTop.Color = GdiContext.GetStylePropertyValueColor(properties, 3);
                if (m_borderTop.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderTop.Color = stylePropertyValueColor;
                }
                m_borderBottom.Color = GdiContext.GetStylePropertyValueColor(properties, 4);
                if (m_borderBottom.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderBottom.Color = stylePropertyValueColor;
                }
                if (!(m_borderLeft.Color == Color.Empty) || !(m_borderRight.Color == Color.Empty) || !(m_borderTop.Color == Color.Empty) || !(m_borderBottom.Color == Color.Empty))
                {
                    ProcessBorders(writer, ref m_borderTop, ref m_borderLeft, ref m_borderBottom, ref m_borderRight, base.Position, bounds, state);
                }
            }
        }
Esempio n. 19
0
 public void Draw( )
 {
     SharedRenderer.PreDraw( );
     DrawAdditionalContent( );
     SharedRenderer.PostDraw( );
 }