Beispiel #1
0
        /**
         * <summary>Renders the specified content context into an image context.</summary>
         * <param name="contentContext">Source content context.</param>
         * <param name="size">Image size expressed in device-space units (that is typically pixels).</param>
         * <param name="area">Content area to render; <code>null</code> corresponds to the entire
         * <see cref="IContentContext.Box">content bounding box</see>.</param>
         * <returns>Image representing the rendered contents.</returns>
         */
        public SKBitmap Render(IContentContext contentContext, SKSize size, SKRect?area)
        {
            //TODO:area!
            var image = new SKBitmap(
                (int)size.Width,
                (int)size.Height,
                SKColorType.Rgba8888,
                SKAlphaType.Opaque
                //PixelFormat.Format24bppRgb
                );

            using (var canvas = new SKCanvas(image))
                contentContext.Render(canvas, size);
            return(image);
        }
Beispiel #2
0
        /**
         * <summary>Renders the specified content context into an image context.</summary>
         * <param name="contentContext">Source content context.</param>
         * <param name="size">Image size expressed in device-space units (that is typically pixels).</param>
         * <param name="area">Content area to render; <code>null</code> corresponds to the entire
         * <see cref="IContentContext.Box">content bounding box</see>.</param>
         * <returns>Image representing the rendered contents.</returns>
         */
        public Image Render(
            IContentContext contentContext,
            SizeF size,
            RectangleF?area
            )
        {
            //TODO:area!
            Image image = new Bitmap(
                (int)size.Width,
                (int)size.Height,
                PixelFormat.Format24bppRgb
                );

            contentContext.Render(Graphics.FromImage(image), size);
            return(image);
        }
Beispiel #3
0
   /**
     <summary>Renders the specified content context into an image context.</summary>
     <param name="contentContext">Source content context.</param>
     <param name="size">Image size expressed in device-space units (that is typically pixels).</param>
     <param name="area">Content area to render; <code>null</code> corresponds to the entire
      <see cref="IContentContext.Box">content bounding box</see>.</param>
     <returns>Image representing the rendered contents.</returns>
    */
   public Image Render(
 IContentContext contentContext,
 SizeF size,
 RectangleF? area
 )
   {
       //TODO:area!
         Image image = new Bitmap(
       (int)size.Width,
       (int)size.Height,
       PixelFormat.Format24bppRgb
       );
         contentContext.Render(Graphics.FromImage(image), size);
         return image;
   }