当前位置: 首页>>代码示例>>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: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例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;未经允许,请勿转载。