コード例 #1
0
 public static float ConvertToMillimeters(int pixels, float?dpi, WriterBase writer)
 {
     if (dpi.HasValue)
     {
         return(SharedRenderer.ConvertToMillimeters(pixels, dpi.Value));
     }
     return(writer.ConvertToMillimeters(pixels));
 }
コード例 #2
0
 public static int ConvertToPixels(float mm, float?dpi, WriterBase writer)
 {
     if (dpi.HasValue)
     {
         return(SharedRenderer.ConvertToPixels(mm, dpi.Value));
     }
     return(writer.ConvertToPixels(mm));
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 public override void Perform(WriterBase writer)
 {
     writer.FillPolygon(this.Color, this.Polygon);
 }
コード例 #5
0
 public ReportTextBox(RPLTextBoxProps source, WriterBase writer)
 {
     this.m_source = source;
     this.m_writer = writer;
 }
コード例 #6
0
 public override void Perform(WriterBase writer)
 {
     writer.DrawRectangle(this.Color, this.Width, this.Style, this.Rectangle);
 }
コード例 #7
0
 public override void Perform(WriterBase writer)
 {
     writer.DrawLine(this.Color, this.Width, this.Style, this.X1, this.Y1, this.X2, this.Y2);
 }
コード例 #8
0
 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));
 }
コード例 #9
0
        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));
            }
        }
コード例 #10
0
        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));
            }
        }