The LEADTOOLS RasterImage class provides platform independent representation of an image. It serves as a working area for image manipulation and conversion. LEADTOOLS functions use this class for accessing the image in memory and for maintaining the characteristics of the image. This topic discusses how to use the LEADTOOLS RasterImage class with the Windows Presentation Foundation (WPF) and Silverlight platforms (System.Windows.Media).
In the Microsoft WPF and Silverlight platforms, you do not paint an image directly on the screen. Instead, you put your graphics content into an System.Windows.Media.ImageSource object or one of its derived classes and then display this object by either putting inside an System.Windows.Controls.Image tag in the XAML file or through the System.Windows.Media.DrawingContext.DrawImage(System.Windows.Media.ImageSource,System.Windows.Rect) method which also takes System.Windows.Media.ImageSource as the source image parameter.
LEADTOOLS images are typically stored in a Leadtools.RasterImage object. So to display a LEADTOOLS image, simply call one of the image conversion methods described below to obtain an System.Windows.Media.ImageSource from the Leadtools.RasterImage.
Also, LEADTOOLS comes with feature rich controls for writing WPF/Silverlight applications such as the Leadtools.Windows.Controls.ImageBox, Leadtools.Windows.Controls.ImageViewer, Leadtools.Windows.Controls.RasterImageBox and Leadtools.Windows.Controls.RasterImageViewer. These are composite controls that include an System.Windows.Controls.Image tag inside. Using these controls, you can display an System.Windows.Media.ImageSource or Leadtools.RasterImage in your application with many effects such as automatic handling of Leadtools.RasterImage changes and conversion to System.Windows.Media.ImageSource, scrolling, panning, zooming and magnify glass.
The LEADTOOLS RasterImage class supports more pixel and color formats than the WPF and Silverlight System.Windows.Media.ImageSource and its derived classes. LEADTOOLS allow you to convert a RasterImage object to or from a WPF/Silverlight System.Windows.Media.ImageSource object.
Use the RasterImageConverter.ConvertToSource method to convert a RasterImage to a WPF/Silverlight System.Windows.Media.ImageSource object. Use RasterImageConverter.ConvertFromSource to convert a System.Windows.Media.ImageSource object to a RasterImage.
LEADTOOLS provides support for using a Leadtools.RasterImage object directly in the WPF or Silverlight XAML file through the Leadtools.Windows.Controls.RasterImageViewer class. By using the Leadtools.Codecs.RasterImageTypeConverter internally, LEADTOOLS will parse the XAML code and loads the provided image into the viewer.
The following is supported in XAML:
A URL to an image file with extra options. For example:
<leadtools:RasterImageViewer RasterImage="http://MyImages/Image.tif"/>
<leadtools:RasterImageViewer RasterImage="http://MyImages/Image.tif?LeadFirstPage=1&LeadLastPage=2"/>
A resource file in the project. Add any image file to your project and set its build events to Resource, then reference it in the XAML as follows:
<leadtools:RasterImageViewer RasterImage="MyResource.tif"/>
The LEADTOOLS RasterImage has an optional region area that can be used to restrict manipulating the image data to a certain area. You can use the RasterImage.GetRegion to obtain the current region in a RasterImage as a RasterRegion object. Also, the RasterImage.SetRegion method can be used to set or combine a new region in a RasterImage.
Use the RasterRegionConverter.ConvertToGeometry to convert a RasterRegion object to a WPF/Silverlight System.Windows.Media.Geometry object. The RasterRegionConverter.ConvertFromGeometry can be used to convert a WPF/Silverlight System.Windows.Media.Geometry to a RasterRegion. For information on using RasterImage with GDI and GDI+ refer to RasterImage and Gdi/Gdi+
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET