當前位置: 首頁>>代碼示例>>C#>>正文


C# XGraphics.DrawImage方法代碼示例

本文整理匯總了C#中PdfSharp.Drawing.XGraphics.DrawImage方法的典型用法代碼示例。如果您正苦於以下問題:C# XGraphics.DrawImage方法的具體用法?C# XGraphics.DrawImage怎麽用?C# XGraphics.DrawImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PdfSharp.Drawing.XGraphics的用法示例。


在下文中一共展示了XGraphics.DrawImage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RenderPage

    /// <summary>
    /// Demonstrates the use of XGraphics.DrawImage.
    /// </summary>
    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      XImage image = XImage.FromFile(@"..\..\images\Test.gif");  

      gfx.DrawImage(image, 100, 100, 400, 400);

      XImage image2 = XImage.FromFile(@"..\..\images\image009.gif");  

      gfx.DrawImage(image2, 100, 500, 400, 200);
    }
開發者ID:vronikp,項目名稱:EventRegistration,代碼行數:15,代碼來源:ImagesGif.cs

示例2: RenderPage

    /// <summary>
    /// Demonstrates the use of XGraphics.DrawImage.
    /// </summary>
    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      XImage image = XImage.FromFile(@"..\..\images\test.png");  
      gfx.DrawImage(image, 100, 100, 400, 400);

      XImage image2 = XImage.FromFile(@"..\..\images\empira.png");  
      gfx.DrawImage(image2, 100, 500, 200, 200);

      XImage image3 = XImage.FromFile(@"..\..\images\reddot.png");  
      gfx.DrawImage(image3, 300, 500, 200, 200);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:16,代碼來源:ImagesPng.cs

示例3: DrawTo

 public void DrawTo(XGraphics context)
 {
     var state = context.Save();
     layout.Transform(context, form.Size);
     form.PageIndex = sourcePageIndex;
     context.DrawImage(form, 0, 0);
     context.Restore(state);
 }
開發者ID:tinyplasticgreyknight,項目名稱:pocketmodise,代碼行數:8,代碼來源:Subpage.cs

示例4: RenderPage

    /// <summary>
    /// Demonstrates the use of XGraphics.DrawImage.
    /// </summary>
    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      XImage image = XImage.FromFile(@"..\..\images\Test (OS2).bmp");  

      double dx = gfx.PageSize.Width;
      double dy = gfx.PageSize.Height;

#if true
      gfx.TranslateTransform(dx / 2, dy / 2);
      gfx.RotateTransform(-60);
      gfx.TranslateTransform(-dx / 2, -dy / 2);
#endif

      gfx.DrawImage(image, (dx - image.PixelWidth) / 2, (dy - image.PixelHeight) / 2, image.PixelWidth, image.PixelHeight);
    }
開發者ID:vronikp,項目名稱:EventRegistration,代碼行數:20,代碼來源:ImagesBmpOS2.cs

示例5: DrawImageScaled

    /// <summary>
    /// Draws an image scaled.
    /// </summary>
    void DrawImageScaled(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "DrawImage (scaled)");

      XImage image = XImage.FromFile(jpegSamplePath);
      gfx.DrawImage(image, 0, 0, 250, 140);

      EndBox(gfx);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:12,代碼來源:Images.cs

示例6: RenderGIFs

    void RenderGIFs(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XImage image = XImage.FromFile(gifSamplePath);

      // Left position in point
      double x = (250 - image.PixelWidth * 72 / image.HorizontalResolution) / 2;
      gfx.DrawImage(image, x, 0);
    }
開發者ID:vronikp,項目名稱:EventRegistration,代碼行數:10,代碼來源:JPEGs.cs

示例7: Render

        public void Render(XGraphics gfx, FixedElement element)
        {
            var specification = (Image) element.Specification;
            var source = ((PdfSharpImage) specification.Source).Source;

            gfx.DrawImage(source,
                          element.InnerBox.Left.Points,
                          element.InnerBox.Top.Points - element.VisiblePartOfSpecification.Top.Points,
                          element.InnerBox.Width.Points,
                          source.PixelHeight);
        }
開發者ID:asgerhallas,項目名稱:DomFx,代碼行數:11,代碼來源:ImageRenderer.cs

示例8: DrawImage

    /// <summary>
    /// Draws an image in original size.
    /// </summary>
    void DrawImage(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "DrawImage (original)");

      XImage image = XImage.FromFile(jpegSamplePath);

      // Left position in point
      double x = (250 - image.PixelWidth * 72 / image.HorizontalResolution) / 2;
      gfx.DrawImage(image, x, 0);

      EndBox(gfx);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:15,代碼來源:Images.cs

示例9: RenderPage

    /// <summary>
    /// Demonstrates the use of XGraphics.DrawImage.
    /// </summary>
    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);
      gfx.SmoothingMode = XSmoothingMode.None;

      //XImage image = XImage.FromFile(@"..\..\images\PNG (200x100).png");
      //XImage image = XImage.FromFile(@"..\..\images\CMYK balloons.tif");  
      //XImage image = XImage.FromFile(@"..\..\images\Dune.tif");  
      //XImage image = XImage.FromFile(@"..\..\images\Fern.tif");  
      XImage image = XImage.FromFile(@"../../images/Rose (RGB 8).tif");  

      gfx.DrawImage(image, 100, 100, 400, 400);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:16,代碼來源:ImagesTiff.cs

示例10: RenderPage

    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      XImage image = XImage.FromFile(@"..\..\images\Z3.jpg");
      //XImage image = XImage.FromFile(@"..\..\images\CityLogo.jpeg");
      double width = image.PixelWidth;
      double height = image.PixelHeight;
      //double resolution = image.Format
      width.GetType();
      height.GetType();
      //gfx.DrawImage(image, 100, 100, 200, 200);
      gfx.DrawImage(image, 100, 100);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:14,代碼來源:ImagesJpeg.cs

示例11: DrawStats

        public void DrawStats(XGraphics gfx)
        {
            XFont large = new XFont("Arial", 20);
            XFont small = new XFont("Arial", 12);

            double yOff = page_.Height * 0.11;

            XRect rect = new XRect(20, yOff, page_.Width - 40, page_.Height - (yOff + 20));
            DrawingUtil.DrawOutlineRect(rect, gfx, cornerRadius);
            gfx.DrawRoundedRectangle(backgroundBrush, rect, cornerRadius);
            XPoint center = new XPoint(page_.Width * 0.5, page_.Height * 0.45);

            XImage sideLunge = XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\SideLunge.png");
            XImage frontLunge = XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\FrontLunge.png");

            gfx.DrawString("Left Lunge", large, XBrushes.Black, new XPoint(center.X - page_.Width * 0.25, page_.Height * 0.25), XStringFormats.Center);
            gfx.DrawString("Right Lunge", large, XBrushes.Black, new XPoint(center.X + page_.Width * 0.25, page_.Height * 0.25), XStringFormats.Center);

            for (int i = 0; i < 4; i++)
            {
                Parameter param1 = userParameters_.ElementAt(dataReadStart + i);
                Parameter param2 = userParameters_.ElementAt(dataReadStart + i + 4);
                char degree = Convert.ToChar('\u00b0');
                XBrush leftParamCol = XBrushes.Green;
                XBrush rightParamCol = XBrushes.Green;

                double y = (i * page_.Height * 0.15f) + page_.Height * 0.35;
                gfx.DrawString(param1.Name, small, XBrushes.Black, new XPoint(center.X - page_.Width * 0.25, y), XStringFormats.Center);

                leftParamCol = DrawingUtil.Instance.ChooseBrushColor(param1.Color);
                XRect infoRect = new XRect(center.X - page_.Width * 0.25 - 25, y + 20, 50, 35);
                DrawingUtil.DrawOutlineRect(infoRect, gfx, new XSize(10, 10));
                gfx.DrawRoundedRectangle(leftParamCol, infoRect, new XSize(10, 10));
                gfx.DrawString(param1.Value.ToString() + degree, small, XBrushes.Black, new XPoint(infoRect.X + 25, infoRect.Y + 17.5), XStringFormats.Center);

                gfx.DrawString(param2.Name, small, XBrushes.Black, new XPoint(center.X + page_.Width * 0.25, y), XStringFormats.Center);
                rightParamCol = DrawingUtil.Instance.ChooseBrushColor(param2.Color);
                infoRect = new XRect(center.X + page_.Width * 0.25 - 25, y + 20, 50, 35);
                DrawingUtil.DrawOutlineRect(infoRect, gfx, new XSize(10, 10));
                gfx.DrawRoundedRectangle(rightParamCol, infoRect, new XSize(10, 10));
                gfx.DrawString(param2.Value.ToString() + degree, small, XBrushes.Black, new XPoint(infoRect.X + 25, infoRect.Y + 17.5), XStringFormats.Center);

                XImage img = i > 1 ? frontLunge : sideLunge;

                double wRatio = (double)img.PixelWidth / (double)sideLunge.PixelHeight;
                XRect imgRect = new XRect(center.X - wRatio * 40, y, wRatio * 80, 80);
                gfx.DrawImage(img, imgRect);
            }
        }
開發者ID:Nodgez,項目名稱:PDFReporter,代碼行數:49,代碼來源:Lunge_Page.cs

示例12: RenderPage

    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      XImage image = XImage.FromFile(@"..\..\..\..\samples\PDFs\SomeLayout.pdf");

      double dx = gfx.PageSize.Width;
      double dy = gfx.PageSize.Height;

#if true
      gfx.TranslateTransform(dx / 2, dy / 2);
      gfx.RotateTransform(-25);
      gfx.TranslateTransform(-dx / 2, -dy / 2);
#endif

      gfx.DrawImage(image, (dx - image.PixelWidth) / 2, (dy - image.PixelHeight) / 2, image.PixelWidth, image.PixelHeight);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:17,代碼來源:ImagesFormXObject.cs

示例13: PrintLogo

 private static void PrintLogo(XGraphics gfx)
 {
     try
     {
         XImage image = XImage.FromFile("Logo.jpg");
         const double dx = 350, dy = 140;
         //gfx.TranslateTransform(dx / 2, dy / 2);
         gfx.ScaleTransform(0.5);
         //gfx.TranslateTransform(-dx / 2, -dy / 2);
         double width = image.PixelWidth * 72 / image.HorizontalResolution;
         double height = image.PixelHeight * 72 / image.HorizontalResolution;
         gfx.DrawImage(image, 5, 5, dx, dy);
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
     }
 }
開發者ID:ultrasonicsoft,項目名稱:G1,代碼行數:18,代碼來源:SalesOrderContent.xaml.cs

示例14: Render

        /// <summary>
        /// Renders the content of the page.
        /// </summary>
        public void Render(XGraphics xGraphics)
        {
            const double textPossitionX = 50;
            double textPossitionY = 100;
            const string fontFamilyName = "Times";
            const int fontSizeHeader = 18;
            const int fontSizeText = 12;

            XFont fontHeader = new XFont(fontFamilyName, fontSizeHeader, XFontStyle.Bold);
            XFont fontText = new XFont(fontFamilyName, fontSizeText);
            XFont fontItalic = new XFont(fontFamilyName, fontSizeText, XFontStyle.BoldItalic);
            double lineSpacing = fontText.GetHeight(xGraphics);

            xGraphics.DrawString("This is Header", fontHeader, XBrushes.Black, textPossitionX, textPossitionX);
            textPossitionY += lineSpacing;
            xGraphics.DrawString("This is normal.", fontText, XBrushes.Black, textPossitionX, textPossitionY);
            textPossitionY += lineSpacing;
            xGraphics.DrawString("This is Italic.", fontItalic, XBrushes.Black, textPossitionX, textPossitionY);

            textPossitionY += lineSpacing*3;

            //Bitmap bitmap = (Bitmap)Image.FromFile(@"E:\temp\klicaj.jpeg");
            XImage xImage = null;
            if (item != null)
            {
                if (item.Image != null)
                {
                    MemoryStream memoryStream = new MemoryStream(item.Image);
                    Bitmap bitmap = (Bitmap) Image.FromStream(memoryStream, true, true);
                    xImage = XImage.FromGdiPlusImage(bitmap);
                }
            }

            if (xImage != null)
            {
                XRect rcImage = new XRect(100, textPossitionY, 100, 100*Math.Sqrt(2));
                xGraphics.DrawImage(xImage, rcImage);
            }

            XGraphicsState state = xGraphics.Save();
            xGraphics.Restore(state);
        }
開發者ID:trippleflux,項目名稱:jezatools,代碼行數:45,代碼來源:Renderer.cs

示例15: DrawRectangle

        /// <summary>
        /// Draw the texture image in the given graphics at the given location.
        /// </summary>
        public void DrawRectangle(XGraphics g, double x, double y, double width, double height)
        {
            var prevState = g.Save();
            g.IntersectClip(new XRect(x, y, width, height));

            double rx = _translateTransformLocation.X;
            double w = _image.PixelWidth, h = _image.PixelHeight;
            while (rx < x + width)
            {
                double ry = _translateTransformLocation.Y;
                while (ry < y + height)
                {
                    g.DrawImage(_image, rx, ry, w, h);
                    ry += h;
                }
                rx += w;
            }

            g.Restore(prevState);
        }
開發者ID:CapitalCoder,項目名稱:HTML-Renderer,代碼行數:23,代碼來源:XTextureBrush.cs


注:本文中的PdfSharp.Drawing.XGraphics.DrawImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。