Leadtools.Windows.Media Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.8.31
ConvertTo Method
See Also 
Leadtools.Windows.Media Namespace > RasterImageMediaConverter Class : ConvertTo Method




srcImage
The ImageSource object containing the image data to convert.
flags
Options to control the conversion operation. Currently there are no extra options and the value of this parameter must be set to RasterImageMediaConverterToFlags.None
Converts a Windows Presentation Foundation (WPF) ImageSource object to LEADTOOLS for .NET RasterImage.

Syntax

Visual Basic (Declaration) 
Public Shared Function ConvertTo( _
   ByVal srcImage As ImageSource, _
   ByVal flags As RasterImageMediaConverterToFlags _
) As RasterImage
Visual Basic (Usage)Copy Code
Dim srcImage As ImageSource
Dim flags As RasterImageMediaConverterToFlags
Dim value As RasterImage
 
value = RasterImageMediaConverter.ConvertTo(srcImage, flags)
C# 
public static RasterImage ConvertTo( 
   ImageSource srcImage,
   RasterImageMediaConverterToFlags flags
)
Managed Extensions for C++ 
public: static RasterImage ConvertTo( 
   ImageSource srcImage,
   RasterImageMediaConverterToFlags flags
) 
C++/CLI 
public:
static RasterImage ConvertTo( 
   ImageSource srcImage,
   RasterImageMediaConverterToFlags flags
) 

Parameters

srcImage
The ImageSource object containing the image data to convert.
flags
Options to control the conversion operation. Currently there are no extra options and the value of this parameter must be set to RasterImageMediaConverterToFlags.None

Return Value

A RasterImage object representing the converted image.

Example

For an example, refer to RasterImageMediaConverter

Remarks

LEADTOOLS for .NET and Windows Presentation Foundation support different pixel formats. These pixel formats may not be identical in some cases. The conversion process takes care of converting scanlines to a suitable format that best matches the source data. The following table shows the result bits/pixel byte order achieved when passing images with different pixel format values:
Source PixelFormatResult Bits/Pixel and byte order
Bgr10101024 bits/pixel and RasterByteOrder.Bgr
Bgr2424 bits/pixel and RasterByteOrder.Bgr
Bgr3232 bits/pixel and RasterByteOrder.Bgr
Bgr55516 bits/pixel and RasterByteOrder.Bgr
Bgr56524 bits/pixel and RasterByteOrder.Bgr
BlackWhite1 bits/pixel and RasterByteOrder.Rgb with a black on white palette
Cmyk3224 bits/pixel and RasterByteOrder.Bgr
Gray1616 bits/pixel and RasterByteOrder.Gray
Gray22 bits/pixel and RasterByteOrder.Rgb with a palette containing 2 shades of gray
Gray32Float24 bits/pixel and RasterByteOrder.Bgr
Gray44 bits/pixel and RasterByteOrder.Rgb with a palette containing 16 shades of gray
Gray88 bits/pixel and RasterByteOrder.Rgb with a palette containing 256 shades of gray
Indexed11 bits/pixel and RasterByteOrder.Rgb with corresponding palette
Indexed22 bits/pixel and RasterByteOrder.Rgb with corresponding palette
Indexed44 bits/pixel and RasterByteOrder.Rgb with corresponding palette
Indexed88 bits/pixel and RasterByteOrder.Rgb with corresponding palette
Pbgra3232 bits/pixel and RasterByteOrder.Bgr
Prgba128Float24 bits/pixel and RasterByteOrder.Bgr
Rgb2424 bits/pixel and RasterByteOrder.Rgb
Rgb4848 bits/pixel and RasterByteOrder.Rgb
Rgb128Float24 bits/pixel and RasterByteOrder.Rgb
Rgba6464 bits/pixel and RasterByteOrder.Rgb

Use the ConvertFrom method to convert LEADTOOLS for .NET RasterImage to a WPF ImageSource object.

The conversion works by copying the image data over to the new destination. Currently, there is no support for sharing memory between a RasterImage and an ImageSource.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also