Renders a LEADTOOLS RasterImage into the surface of Windows Runtime WriteableBitmap or HTML Canvas objects.
The RasterImageRenderer class provides support for rendering a LEADTOOLS RasterImage into a generic buffer containing 32-bit image data. This buffer can be the surface of a Windows Runtime WriteableBitmap object or the image data of HTML Canvas. The source RasterImage can have any bits/pixel or color order supported by LEADTOOLS.
To render any portion of a raster image into a Windows Runtime WriteableBitmap:
Create a RasterRenderBuffer object passing the width, height and pixel buffer of the WriteableBitmap. You can use the helper CreateFromWriteableBitmap helper method to setup the buffer properties correctly.
Call any of the RasterImageRenderer.Render methods to render the image into the buffer
Finally, call the WriteableBitmap.Invalidate method to apply the new data into the bitmap.
To render any portion of a raster image into a HTML Canvas:
Obtain the 2d context of canvas and then create a new HTML ImageData object with the required size, using Context.createImageData.
Create a RasterRenderBuffer object passing the width, height and image data of the ImageData. You can use the helper CreateFromHtmlImageData helper method to setup the buffer properties correctly.
Call any of the RasterImageRenderer.Render methods to render the image into the buffer
Finally, call context.putImageData to apply the new data into the canvas context.
You can also use an instance of RasterImageRenderProperties and change any of its properties to control the speed and quality of the render operation. Such as performing scale to gray or resample rendering.
RasterRenderBuffer also contains the ToRasterImage helper method that allows you to convert the data inside a RasterRenderBuffer into a RasterImage object. This can be used to create a RasterImage from a Windows Runtime WriteableBitmap or HTML Canvas.