ColorConvertedBitmap Class

Changes the color space of a BitmapSource. This class cannot be inherited.

Namespace: System.Windows.Media.Imaging
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

public sealed class ColorConvertedBitmap : BitmapSource, ISupportInitialize
public final class ColorConvertedBitmap extends BitmapSource implements ISupportInitialize
public final class ColorConvertedBitmap extends BitmapSource implements ISupportInitialize
 For XAML information, see ColorConvertedBitmap Markup Extension. 

ColorConvertedBitmap implements the ISupportInitialize interface to optimize initialization on multiple properties. Property changes can only occur during object initialization. Call BeginInit to signal that initialization has begun and EndInit to signal that initialization has completed. Once initialized, property changes are ignored.

ColorConvertedBitmap objects created using the ColorConvertedBitmap(BitmapSource,ColorContext,ColorContext,PixelFormat) constructor are automatically initialized and property changes are ignored.

A ColorConvertedBitmap is never cached.

The following example shows how to create an instance of ColorConvertedBitmap and use it to convert color.

Stream imageStream = new FileStream("tulipfarm.jpg", FileMode.Open, FileAccess.Read, FileShare.Read);
BitmapSource myBitmapSource = BitmapFrame.Create(imageStream);
BitmapFrame myBitmapSourceFrame = (BitmapFrame)myBitmapSource;
ColorContext sourceColorContext = myBitmapSourceFrame.ColorContexts[0];
ColorContext destColorContext = new ColorContext(PixelFormats.Bgra32);
ColorConvertedBitmap ccb = new ColorConvertedBitmap(myBitmapSource, sourceColorContext, destColorContext, PixelFormats.Pbgra32);
Image myImage3 = new Image();
myImage3.Source = ccb;
myImage3.Stretch = Stretch.None;


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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0