Exemplo n.º 1
0
 protected double RealWidth(RepObj repObj)
 {
     if (repObj is RepRect)
     {
         RepRect repRect = (RepRect)repObj;
         return(repRect.rWidth + repRect.penProp.rWidth);
     }
     else if (repObj is RepImage)
     {
         RepImage repImage = (RepImage)repObj;
         if (Double.IsNaN(repImage.rWidth))
         {
             using (Image image = Image.FromStream(repImage.stream))
             {
                 if (Double.IsNaN(repImage.rHeight))
                 {
                     repImage.rWidth  = image.Width / image.HorizontalResolution * 72;
                     repImage.rHeight = image.Height / image.VerticalResolution * 72;
                 }
                 else
                 {
                     repImage.rWidth = image.Width * repImage.rHeight / image.Height;
                 }
             }
         }
         return(repImage.rWidth);
     }
     else
     {
         return(repObj.rWidth);
     }
 }
Exemplo n.º 2
0
 protected double RealX(RepObj repObj, double r_X)
 {
     if (repObj is RepRect)
     {
         RepRect repRect = (RepRect)repObj;
         return(r_X + repRect.penProp.rWidth / 2);
     }
     else
     {
         return(r_X);
     }
 }
Exemplo n.º 3
0
        //------------------------------------------------------------------------------------------07.02.2006
        /// <summary>Writes the RepObj to the buffer.</summary>
        /// <param name="e">Environment data</param>
        public void Write(PdfIndirectObject_PageContents.Environment e)
        {
            PdfIndirectObject_PageContents p = e.pdfIndirectObject_PageContents;
            RepRect repRect = (RepRect)e.repObj;
            Double  rOfsX   = repRect.rWidth * repRect.rAlignH;
            Double  rOfsY   = repRect.rHeight * (1 - repRect.rAlignV);

            e.matrixD.Multiply(1, 0, 0, 1, -rOfsX, rOfsY);
            if (repRect.penProp != null)
            {
                if (repRect.penProp.rWidth > 0f)
                {
                    p.Write_Pen(repRect.penProp);
                }
                else
                {
                    repRect.penProp = null;
                }
            }
            if (repRect.brushProp != null)
            {
                p.Write_Brush(repRect.brushProp);
            }

            if (e.bComplex)
            {
                p.Command("q");
                p.Write_Matrix(e.matrixD);
                p.Command("cm");
                p.Write_Point(0, 0);  p.Space();  p.Number(repRect.rWidth);  p.Space();  p.Number(repRect.rHeight);  p.Space();
                p.Command("re");
                p.Command(repRect.penProp == null ? "f" : (repRect.brushProp == null ? "S" : "B"));
                p.Command("Q");
            }
            else
            {
                p.Write_Point(e.matrixD.rDX, e.matrixD.rDY);  p.Space();  p.Number(repRect.rWidth);  p.Space();  p.Number(repRect.rHeight);
                p.Command("re");
                p.Command(repRect.penProp == null ? "f" : (repRect.brushProp == null ? "S" : "B"));
            }
        }