←Select platform

ConvertToSourceOptions Enumeration

Summary

Options for converting a LEADTOOLS Leadtools.RasterImage object to Windows Presentation Foundation (WPF) or Silverlight System.Windows.Media.ImageSource.

Syntax

C#
VB
C++
[FlagsAttribute()] 
public enum ConvertToSourceOptions 
  
<FlagsAttribute()> 
Public Enum ConvertToSourceOptions  
   Inherits System.Enum 
   Implements System.IComparable, System.IConvertible, System.IFormattable  
[FlagsAttribute()] 
public enum class ConvertToSourceOptions : public System.Enum, System.IComparable, System.IConvertible, System.IFormattable   

Members

ValueMemberDescription
0x00000000NoneDefault
0x00000001KeepAlphaValues

If the source Leadtools.RasterImage is 32 or 64-bits/pixel, then use the alpha values from this alpha if the result of the conversion is also a 32 or 64-bits/pixel System.Windows.Media.ImageSource.

If this flagged is not specified, the result System.Windows.Media.ImageSource will always have an alpha value of all 1's (255 for 32-bit images or 65535 for 64-bit images) regardless of the alpha values in the source Leadtools.RasterImage. This can be useful when converting some 32-bit images that may have 0 for the alpha (such as BMP files) which translates into an System.Windows.Media.ImageSource that is completely transparent.

If this flag is specified, then the source image alpha values will be used as is.

0x00000002KeepViewPerspective

Keep the original Leadtools.RasterImage view perspective. The Leadtools.RasterImage objects supports having an image data orientation other than the normal top-left through the RasterImage.ViewPerspective property.

If the source Leadtools.RasterImage has a view-perspective other than RasterViewPerspective.TopLeft and this flag is specified, then the result System.Windows.Media.ImageSource might be flipped, reversed or rotated. For example, if the source view-perspective is RasterViewPerspective.BottomLeft and this flag is specified in the conversion options, then the result System.Windows.Media.ImageSource will be flipped.

If this flag is not specified, then the conversion might flip, reverse or rotate the image data as needed to provide correct (top-left) System.Windows.Media.ImageSource.

0x00000004IgnoreLowHighBitsOnGrayImages

Do not use the gray scale bit window values when converting 12 or 16-bit grayscale Leadtools.RasterImage objects. The Leadtools.RasterImage object contains the RasterImage.LowBit and RasterImage.HighBit values that can be set to provide a Window into the image data. This is mostly used by medical applications during a window-leveling operations.

If this flag is specified, the RasterImage.LowBit and RasterImage.HighBit values are ignored and all of the image data is used when converting the Leadtools.RasterImage to System.Windows.Media.ImageSource.

If this flag is not specified, then only the image data between RasterImage.LowBit and RasterImage.HighBit is used.

0x00000008UseSetSource

Note: This option is only used by the LEADTOOLS for Silverlight toolkit. The WPF version of this flag is ignored and have no effect on the conversion operation.

Use this option to use Silverlight native loading capabilities when converting a Leadtools.RasterImage into a System.Windows.Media.ImageSource. When this option is specified, one of the following will happen:

  • If source Leadtools.RasterImage has a bits/pixel value of 1, 2, 3, 4, 5, 6, 7 or 8, the data will be converted to a PNG stream first then a call is made to BitmapSource.SetSource to construct the result image.

  • If source bits/pixel value is 12 or 16, then the data will be converted to a JPEG stream first and then a call is made to BitmapSource.SetSource to construct the result image.

  • For any other bits/pixel value (24, 32, 48 or 64), direct conversion is used and the result is the same as if the UseSetSource flag is not specified.

If this flag is not specified, then BitmapSource.SetSource is not used and the toolkit will directly convert the Leadtools.RasterImage to a compatible System.Windows.Media.ImageSource.

Specifying this flag in the LEADTOOLS for Silverlight toolkit may increase the performance of the RasterImageConverter.ConvertToSource method especially when converting 1 bits/pixel Leadtools.RasterImage objects.

0x00000010AutoDetectAlpha

Indicates LEADTOOLS should automatically detect if the image data contains meaningful alpha channel values, and if so, fill the resulting ImageSource object with premultiplied alpha image data.

Note:This flag is supported only in LEADTOOLS Silverlight versions.

Remarks

This enumeration is used as the options for converting LEADTOOLS Leadtools.RasterImage objects to Windows Presentation Foundation (WPF) or Silverlight System.Windows.Media.ImageSource through the RasterImageConverter.ConvertToSource method.

For more information refer to RasterImage and WPF/Silverlight.

Example

For an example, refer to RasterImage and WPF/Silverlight Support.

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.