Visual Basic (Declaration) | |
---|---|
Public Shared Function ConvertFrom( _ ByVal srcImage As RasterImage, _ ByVal flags As RasterImageMediaConverterFromFlags _ ) As ImageSource |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public static ImageSource ConvertFrom( RasterImage srcImage, RasterImageMediaConverterFromFlags flags ) |
Managed Extensions for C++ | |
---|---|
public: static ImageSource ConvertFrom( RasterImage srcImage, RasterImageMediaConverterFromFlags flags ) |
C++/CLI | |
---|---|
public: static ImageSource ConvertFrom( RasterImage srcImage, RasterImageMediaConverterFromFlags flags ) |
Parameters
- srcImage
- The RasterImage object containing the image data to convert.
- flags
-
Options to control the conversion operation. The following values can be ORed together:
Value Meaning RasterImageMediaConverterFromFlags.None No options RasterImageMediaConverterFromFlags.KeepAlphaValues Use srcImage alpha values when converting from and to a pixel format that supports an alpha channel. If this flag is not set, the alpha values in srcImage will be ignored (if present) and an alpha value of all 1's (opaque) will be used instead. If the destination pixel format does not support alpha, this value is ignored. RasterImageMediaConverterFromFlags.KeepViewPerspective Do not rotate or flip the destination image if srcImage has a view perspective other than RasterViewPerspective.TopLeft/>. For example, if srcImage has a view perspective of RasterViewPerspective.BottomLeft, the result destination image will be flipped. If this flag is not present, the conversion method will rotate/flip the scanlines as needed. RasterImageMediaConverterFromFlags.IgnoreLowHighBitsOnGrayImages Ignore the LowBit and HighBit values if srcImage is a grayscale image with bits per pixel value of 12 or 16. If this flag is not present, the low/high bit values will be used when converting the scanlines of the destination image.
Return Value
An ImageSource object representing the converted image.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 pixel format achieved when passing images with different bits/pixel values:
Source Bits/Pixel | Result PixelFormat |
---|---|
1 bits/pixel with black on white palette | BlackWhite |
1 bits/pixel with any other palette | Indexed1 |
2 bits/pixel | Indexed2 |
3 or 4 bits/pixel | Indexed4 |
5, 6, 7 or 8 bits/pixel | Indexed8 |
16 bits/pixel with byte order value of RasterByteOrder.Bgr | Bgr555 |
16 bits/pixel with byte order value of RasterByteOrder.Gray | Bgra32 |
12, 24, 32, 48 or 64 bits/pixel | Bgra32 |
Use the ConvertTo method to convert a WPF ImageSource to LEADTOOLS for .NET RasterImage 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.
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