public static void ProcessTopBorder(WriterBase writer, List <Operation> operations, float borderWidthTop, RPLFormat.BorderStyles borderStyleTop, Color borderColorTop, Color borderColorLeft, Color borderColorRight, float borderTop, float borderTopEdge, float borderLeftEdge, float borderRightEdge, float borderTopEdgeUnclipped, float borderLeftEdgeUnclipped, float borderRightEdgeUnclipped, float borderWidthLeft, float borderWidthRight, float borderWidthTopUnclipped, float borderWidthLeftUnclipped, float borderWidthRightUnclipped)
        {
            switch (borderStyleTop)
            {
            case RPLFormat.BorderStyles.None:
                return;

            case RPLFormat.BorderStyles.Solid:
            {
                if (!(borderWidthTop > writer.HalfPixelWidthY * 2.0))
                {
                    break;
                }
                if (!(borderWidthLeft > 0.0) || !(borderColorTop != borderColorLeft))
                {
                    if (!(borderWidthRight > 0.0))
                    {
                        break;
                    }
                    if (!(borderColorTop != borderColorRight))
                    {
                        break;
                    }
                }
                PointF[] polygon = new PointF[4]
                {
                    new PointF(borderLeftEdge, borderTopEdge),
                    new PointF(borderRightEdge, borderTopEdge),
                    new PointF(borderRightEdge - borderWidthRight, borderTopEdge + borderWidthTop),
                    new PointF(borderLeftEdge + borderWidthLeft, borderTopEdge + borderWidthTop)
                };
                if (operations == null)
                {
                    writer.FillPolygon(borderColorTop, polygon);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorTop, polygon));
                }
                return;
            }
            }
            if (borderStyleTop == RPLFormat.BorderStyles.Double)
            {
                PointF[] array = new PointF[4];
                float    num   = (float)(borderWidthTopUnclipped / 3.0);
                if (borderTopEdge <= borderTopEdgeUnclipped + num)
                {
                    float num2 = Math.Max((float)(borderWidthLeft - borderWidthLeftUnclipped / 3.0 * 2.0), 0f);
                    float num3 = Math.Max((float)(borderWidthRight - borderWidthRightUnclipped / 3.0 * 2.0), 0f);
                    array[0] = new PointF(borderLeftEdge, borderTopEdge);
                    array[1] = new PointF(borderRightEdge, borderTopEdge);
                    array[2] = new PointF(borderRightEdge - num3, borderTopEdgeUnclipped + num);
                    array[3] = new PointF(borderLeftEdge + num2, borderTopEdgeUnclipped + num);
                    if (operations == null)
                    {
                        writer.FillPolygon(borderColorTop, array);
                    }
                    else
                    {
                        operations.Add(new FillPolygonOp(borderColorTop, array));
                    }
                }
                array = new PointF[4];
                float num4 = (float)(borderTopEdgeUnclipped + borderWidthTopUnclipped / 3.0 * 2.0);
                float x;
                float x2;
                if (borderWidthLeft > 0.0)
                {
                    x  = (float)(borderLeftEdgeUnclipped + borderWidthLeftUnclipped / 3.0 * 2.0);
                    x2 = borderLeftEdgeUnclipped + borderWidthLeftUnclipped;
                }
                else
                {
                    x = (x2 = borderLeftEdge);
                }
                float x3;
                float x4;
                if (borderWidthRight > 0.0)
                {
                    x3 = (float)(borderRightEdgeUnclipped - borderWidthRightUnclipped / 3.0 * 2.0);
                    x4 = borderRightEdgeUnclipped - borderWidthRightUnclipped;
                }
                else
                {
                    x3 = (x4 = borderRightEdge);
                }
                array[0] = new PointF(x, num4);
                array[1] = new PointF(x3, num4);
                array[2] = new PointF(x4, num4 + num);
                array[3] = new PointF(x2, num4 + num);
                if (operations == null)
                {
                    writer.FillPolygon(borderColorTop, array);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorTop, array));
                }
            }
            else if (operations == null)
            {
                writer.DrawLine(borderColorTop, borderWidthTop, borderStyleTop, borderLeftEdge, borderTop, borderRightEdge, borderTop);
            }
            else
            {
                operations.Add(new DrawLineOp(borderColorTop, borderWidthTop, borderStyleTop, borderLeftEdge, borderTop, borderRightEdge, borderTop));
            }
        }
Ejemplo n.º 2
0
 public override void Perform(WriterBase writer)
 {
     writer.DrawLine(this.Color, this.Width, this.Style, this.X1, this.Y1, this.X2, this.Y2);
 }
        public static void ProcessRightBorder(WriterBase writer, List <Operation> operations, float borderWidthRight, RPLFormat.BorderStyles borderStyleRight, Color borderColorRight, Color borderColorTop, Color borderColorBottom, float borderRight, float borderRightEdge, float borderTopEdge, float borderBottomEdge, float borderRightEdgeUnclipped, float borderTopEdgeUnclipped, float borderBottomEdgeUnclipped, float borderWidthTop, float borderWidthBottom, float borderWidthRightUnclipped, float borderWidthTopUnclipped, float borderWidthBottomUnclipped)
        {
            switch (borderStyleRight)
            {
            case RPLFormat.BorderStyles.None:
                return;

            case RPLFormat.BorderStyles.Solid:
            {
                if (!(borderWidthRight > writer.HalfPixelWidthX * 2.0))
                {
                    break;
                }
                if (!(borderWidthTop > 0.0) || !(borderColorRight != borderColorTop))
                {
                    if (!(borderWidthBottom > 0.0))
                    {
                        break;
                    }
                    if (!(borderColorRight != borderColorBottom))
                    {
                        break;
                    }
                }
                PointF[] polygon = new PointF[4]
                {
                    new PointF(borderRightEdge, borderTopEdge),
                    new PointF(borderRightEdge, borderBottomEdge),
                    new PointF(borderRightEdge - borderWidthRight, borderBottomEdge - borderWidthBottom),
                    new PointF(borderRightEdge - borderWidthRight, borderTopEdge + borderWidthTop)
                };
                if (operations == null)
                {
                    writer.FillPolygon(borderColorRight, polygon);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorRight, polygon));
                }
                return;
            }
            }
            if (borderStyleRight == RPLFormat.BorderStyles.Double)
            {
                PointF[] array = new PointF[4];
                float    num   = (float)(borderWidthRightUnclipped / 3.0);
                if (borderRightEdge >= borderRightEdgeUnclipped - num)
                {
                    float num2 = Math.Max((float)(borderWidthTop - borderWidthTopUnclipped / 3.0 * 2.0), 0f);
                    float num3 = Math.Max((float)(borderWidthBottom - borderWidthBottomUnclipped / 3.0 * 2.0), 0f);
                    array[0] = new PointF(borderRightEdge, borderTopEdge);
                    array[1] = new PointF(borderRightEdge, borderBottomEdge);
                    array[2] = new PointF(borderRightEdgeUnclipped - num, borderBottomEdge - num3);
                    array[3] = new PointF(borderRightEdgeUnclipped - num, borderTopEdge + num2);
                    if (operations == null)
                    {
                        writer.FillPolygon(borderColorRight, array);
                    }
                    else
                    {
                        operations.Add(new FillPolygonOp(borderColorRight, array));
                    }
                }
                array = new PointF[4];
                float num4 = (float)(borderRightEdgeUnclipped - borderWidthRightUnclipped / 3.0 * 2.0);
                float y;
                float y2;
                if (borderWidthTop > 0.0)
                {
                    y  = (float)(borderTopEdgeUnclipped + borderWidthTopUnclipped / 3.0 * 2.0);
                    y2 = borderTopEdgeUnclipped + borderWidthTopUnclipped;
                }
                else
                {
                    y = (y2 = borderTopEdge);
                }
                float y3;
                float y4;
                if (borderWidthBottom > 0.0)
                {
                    y3 = (float)(borderBottomEdgeUnclipped - borderWidthBottomUnclipped / 3.0 * 2.0);
                    y4 = borderBottomEdgeUnclipped - borderWidthBottomUnclipped;
                }
                else
                {
                    y3 = (y4 = borderBottomEdge);
                }
                array[0] = new PointF(num4, y);
                array[1] = new PointF(num4, y3);
                array[2] = new PointF(num4 - num, y4);
                array[3] = new PointF(num4 - num, y2);
                if (operations == null)
                {
                    writer.FillPolygon(borderColorRight, array);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorRight, array));
                }
            }
            else if (operations == null)
            {
                writer.DrawLine(borderColorRight, borderWidthRight, borderStyleRight, borderRight, borderTopEdge, borderRight, borderBottomEdge);
            }
            else
            {
                operations.Add(new DrawLineOp(borderColorRight, borderWidthRight, borderStyleRight, borderRight, borderTopEdge, borderRight, borderBottomEdge));
            }
        }