Namespace TallComponents.PDF.Rasterizer

Class DrawJob

Represents an asynchronous drawing job.

The code below shows one way to use a DrawJob. Instead of simply calling Page.Draw(), one can create a DrawJob, start it, and then do some additional work before obtaining the drawn bitmap. drawJob = new DrawJob(page); float scale = (float) (dpi / 72F); SKBitmap mybitmap = new SKBitmap( (int) (page.Width * scale), (int) (page.Height * scale), SKImageInfo.PlatformColorType, SKAlphaType.Unpremul); drawJob.Start(mybitmap, renderSettings, PageBoundary.Default, scale); // ...Drawing will start on a separate thread. In the meantine, one could do // some additional work here. // Wait until drawing has finished. drawJob.Wait(); // Obtain a copy of the bitmap that has been drawn. SKBitmap bitmap = drawJob.GetBitmap(); One will typically use a DrawJob to render a page progesssively. After a drawing job has been started, it is possible to obtain intermediate bitmap results by calling DrawJob.GetImage() while the job is running. This can be done at arbitrary moments, for example via a timer.An easier way is to subscribe to the Updated event of the DrawJob and retrieve a new bitmap in the event handler. The Updated event will be fired regularly, but it will only be fired when the bitmap has actually been updated. After finishing the drawing job, the Updated event will be raised one last time. drawJob = new DrawJob(page); drawJob.Updated += new EventHandler(drawJob_Updated); ... drawJob.Start(...); ... void drawJob_Updated(object sender, EventArgs e) { // Obtain a copy of the bitmap for as far as it has been drawn. SKBitmap bitmap = drawJob.GetBitmap(); ... }

Syntax

public class DrawJob : Object , IDisposable

Constructors

Properties

Methods

Events