internal static float ConvertToMillimeters(int pixels, float?dpi, WriterBase writer)
 {
     if (dpi.HasValue)
     {
         return(ConvertToMillimeters(pixels, dpi.Value));
     }
     return(writer.ConvertToMillimeters(pixels));
 }
 internal static int ConvertToPixels(float mm, float?dpi, WriterBase writer)
 {
     if (dpi.HasValue)
     {
         return(ConvertToPixels(mm, dpi.Value));
     }
     return(writer.ConvertToPixels(mm));
 }
        internal 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)
            {
                return(false);
            }
            RectangleF rectangleF = default(RectangleF);
            float      num        = ConvertToMillimeters(width, measureImageDpiX, writer);

            if (xOffsetMM >= 0f)
            {
                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 = ConvertToMillimeters(height, measureImageDpiY, writer);

            if (yOffsetMM >= 0f)
            {
                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 < 0f || rectangleF.Bottom < 0f)
            {
                return(false);
            }
            destination = rectangleF;
            float x = 0f;

            if (xOffsetMM < 0f)
            {
                x = -ConvertToPixels(xOffsetMM, measureImageDpiX, writer);
            }
            float y = 0f;

            if (yOffsetMM < 0f)
            {
                y = -ConvertToPixels(yOffsetMM, measureImageDpiY, writer);
            }
            float width2  = Math.Min(width, ConvertToPixels(rectangleF.Width, measureImageDpiX, writer));
            float height2 = Math.Min(height, ConvertToPixels(rectangleF.Height, measureImageDpiY, writer));

            source = new RectangleF(x, y, width2, height2);
            return(true);
        }
Example #4
0
 internal override void Perform(WriterBase writer)
 {
     writer.DrawLine(Color, Width, Style, X1, Y1, X2, Y2);
 }
Example #5
0
 internal ReportTextBox(RPLTextBoxProps source, WriterBase writer)
 {
     m_source = source;
     m_writer = writer;
 }
Example #6
0
 internal override void Perform(WriterBase writer)
 {
     writer.FillPolygon(Color, Polygon);
 }
Example #7
0
 internal override void Perform(WriterBase writer)
 {
     writer.DrawRectangle(Color, Width, Style, Rectangle);
 }
 internal static bool CalculateImageClippedUnscaledBounds(WriterBase writer, RectangleF bounds, int width, int height, float xOffsetMM, float yOffsetMM, out RectangleF destination, out RectangleF source)
 {
     return(CalculateImageClippedUnscaledBounds(writer, bounds, width, height, xOffsetMM, yOffsetMM, null, null, out destination, out source));
 }
        internal 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 * 2f && ((borderWidthLeft > 0f && borderColorTop != borderColorLeft) || (borderWidthRight > 0f && borderColorTop != borderColorRight)))
                {
                    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;
                }
                break;
            }
            if (borderStyleTop == RPLFormat.BorderStyles.Double)
            {
                PointF[] array = new PointF[4];
                float    num   = borderWidthTopUnclipped / 3f;
                if (borderTopEdge <= borderTopEdgeUnclipped + num)
                {
                    float num2 = Math.Max(borderWidthLeft - borderWidthLeftUnclipped / 3f * 2f, 0f);
                    float num3 = Math.Max(borderWidthRight - borderWidthRightUnclipped / 3f * 2f, 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 = borderTopEdgeUnclipped + borderWidthTopUnclipped / 3f * 2f;
                float x;
                float x2;
                if (borderWidthLeft > 0f)
                {
                    x  = borderLeftEdgeUnclipped + borderWidthLeftUnclipped / 3f * 2f;
                    x2 = borderLeftEdgeUnclipped + borderWidthLeftUnclipped;
                }
                else
                {
                    x = (x2 = borderLeftEdge);
                }
                float x3;
                float x4;
                if (borderWidthRight > 0f)
                {
                    x3 = borderRightEdgeUnclipped - borderWidthRightUnclipped / 3f * 2f;
                    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));
            }
        }
        internal 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 * 2f && ((borderWidthTop > 0f && borderColorRight != borderColorTop) || (borderWidthBottom > 0f && borderColorRight != borderColorBottom)))
                {
                    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;
                }
                break;
            }
            if (borderStyleRight == RPLFormat.BorderStyles.Double)
            {
                PointF[] array = new PointF[4];
                float    num   = borderWidthRightUnclipped / 3f;
                if (borderRightEdge >= borderRightEdgeUnclipped - num)
                {
                    float num2 = Math.Max(borderWidthTop - borderWidthTopUnclipped / 3f * 2f, 0f);
                    float num3 = Math.Max(borderWidthBottom - borderWidthBottomUnclipped / 3f * 2f, 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 = borderRightEdgeUnclipped - borderWidthRightUnclipped / 3f * 2f;
                float y;
                float y2;
                if (borderWidthTop > 0f)
                {
                    y  = borderTopEdgeUnclipped + borderWidthTopUnclipped / 3f * 2f;
                    y2 = borderTopEdgeUnclipped + borderWidthTopUnclipped;
                }
                else
                {
                    y = (y2 = borderTopEdge);
                }
                float y3;
                float y4;
                if (borderWidthBottom > 0f)
                {
                    y3 = borderBottomEdgeUnclipped - borderWidthBottomUnclipped / 3f * 2f;
                    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));
            }
        }