CachedBitmap(BitmapSource, BitmapCreateOptions, BitmapCacheOption) 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化拥有指定源、位图创建选项和位图缓存选项的 CachedBitmap 的一个新实例。
public:
CachedBitmap(System::Windows::Media::Imaging::BitmapSource ^ source, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
public CachedBitmap (System.Windows.Media.Imaging.BitmapSource source, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
new System.Windows.Media.Imaging.CachedBitmap : System.Windows.Media.Imaging.BitmapSource * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.CachedBitmap
Public Sub New (source As BitmapSource, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption)
参数
- source
- BitmapSource
正在缓存的源位图。
- createOptions
- BitmapCreateOptions
位图图像的初始化选项。
- cacheOption
- BitmapCacheOption
指定如何将位图缓存到内存。
例外
当 source
为 null
时发生。
示例
下面的代码示例演示如何创建和使用代码中的代码 CachedBitmap 。
CachedBitmap cachedSource = new CachedBitmap(
scaledSource,
BitmapCreateOptions.None,
BitmapCacheOption.OnLoad);
// Create a new BitmapSource using a different format than the original one.
FormatConvertedBitmap newFormatSource = new FormatConvertedBitmap();
newFormatSource.BeginInit();
newFormatSource.Source = cachedSource;
newFormatSource.DestinationFormat = PixelFormats.Gray32Float;
newFormatSource.EndInit();
Dim cachedSource As New CachedBitmap(scaledSource, BitmapCreateOptions.None, BitmapCacheOption.OnLoad)
' Create a new BitmapSource using a different format than the original one.
Dim newFormatSource As New FormatConvertedBitmap()
newFormatSource.BeginInit()
newFormatSource.Source = cachedSource
newFormatSource.DestinationFormat = PixelFormats.Gray32Float
newFormatSource.EndInit()