/* ----------------------------------------------------------------- */ /// /// GetBitmap /// /// <summary> /// Creates a new instance of the Bitmap class with the specified /// arguments. /// </summary> /// /* ----------------------------------------------------------------- */ public static Bitmap GetBitmap(this RenderOption src, int width, int height) { var dest = new Bitmap(width, height, PixelFormat.Format32bppArgb); src.DrawBackground(e => { using (var gs = Graphics.FromImage(dest)) gs.Clear(e); }); return(dest); }
/* ----------------------------------------------------------------- */ /// /// Render /// /// <summary> /// Executes the rendering with the specified arguments. /// </summary> /// /* ----------------------------------------------------------------- */ public static void Render(IntPtr core, Graphics dest, Page page, PointF point, SizeF size, RenderOption options) => Load(core, page.Number, hp => { options.DrawBackground(e => dest.Clear(e)); var x = (int)point.X; var y = (int)point.Y; var width = (int)size.Width; var height = (int)size.Height; var degree = GetRotation(page.Delta); var flags = options.GetFlags(); var hdc = dest.GetHdc(); NativeMethods.FPDF_RenderPage(hdc, hp, x, y, width, height, degree, flags); dest.ReleaseHdc(hdc); return(true); });