Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
CachedBitmap Class
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
CachedBitmap Class

Provides caching functionality for a BitmapSource.

Namespace:  System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)
Visual Basic (Declaration)
Public NotInheritable Class CachedBitmap _
    Inherits BitmapSource
Visual Basic (Usage)
Dim instance As CachedBitmap
C#
public sealed class CachedBitmap : BitmapSource
Visual C++
public ref class CachedBitmap sealed : public BitmapSource
JScript
public final class CachedBitmap extends BitmapSource
XAML
You cannot directly create an instance of this class in XAML.

A BitmapSource does not cache bitmap data automatically. Using a CachedBitmap can improve performance in scenarios where multiple operations (such as clipping an image or scaling) need to be performed on a single bitmap.

The following code example shows how to create and use a CachedBitmap in code.

Visual Basic
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()
C#
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();

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker