Skip to main content
ColorContext Class
 

Represents the International Color Consortium (ICC) or Image Color Management (ICM) color profile that is associated with a bitmap image.

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

Inheritance Hierarchy
SystemObject
  System.Windows.MediaColorContext

Syntax
public class ColorContext
public ref class ColorContext 
type ColorContext = class end
Public Class ColorContext
Constructors
NameDescription
System_CAPS_pubmethod ColorContext

Initializes a new instance of ColorContext with the standard color profile (sRGB or RGB ) that most closely matches the supplied PixelFormat.

System_CAPS_pubmethod ColorContext

Initializes a new instance of ColorContext with the International Color Consortium (ICC) or Image Color Management (ICM) color profile located at a given Uri.

Properties
NameDescription
System_CAPS_pubproperty

Gets a Uri that represents the location of a International Color Consortium (ICC) or Image Color Management (ICM) color profile.

Methods
NameDescription
System_CAPS_pubmethod Equals

Determines whether an Object is equal to an instance of ColorContext.(Overrides ObjectEquals.)

System_CAPS_protmethod Finalize

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethod GetHashCode

Gets the hash code for this instance of ColorContext. (Overrides ObjectGetHashCode.)

System_CAPS_pubmethod GetType

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethod MemberwiseClone

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethod OpenProfileStream

Returns a readable Stream of raw color profile data.

System_CAPS_pubmethod ToString

Returns a string that represents the current object.(Inherited from Object.)

Operators
NameDescription
System_CAPS_puboperator System_CAPS_static Equality

Operates on two instances of ColorContext to determine equality.

System_CAPS_puboperator System_CAPS_static Inequality

Operates on two instances of ColorContext to determine that they are not equal.

Remarks

The supported standard color spaces are sRGB, ScRGB, RGB, CMYK, Gray, Multichannel, and unknown.

Examples

The following code example demonstrates how to get the color profile that is associated with a bitmap image.

ColorConvertedBitmap myColorConvertedBitmap = new ColorConvertedBitmap();
myColorConvertedBitmap.BeginInit();
myColorConvertedBitmap.SourceColorContext = myBitmapSourceFrame2.ColorContexts[0];
myColorConvertedBitmap.Source = myBitmapSource2;
myColorConvertedBitmap.DestinationFormat = PixelFormats.Pbgra32;
myColorConvertedBitmap.DestinationColorContext = new ColorContext(PixelFormats.Bgra32);
myColorConvertedBitmap.EndInit();
Dim myColorConvertedBitmap As New ColorConvertedBitmap()
myColorConvertedBitmap.BeginInit()
myColorConvertedBitmap.SourceColorContext = myBitmapSourceFrame2.ColorContexts(0)
myColorConvertedBitmap.Source = myBitmapSource2
myColorConvertedBitmap.DestinationFormat = PixelFormats.Pbgra32
myColorConvertedBitmap.DestinationColorContext = New ColorContext(PixelFormats.Bgra32)
myColorConvertedBitmap.EndInit()
Version Information
.NET Framework
Available since 3.0
Thread Safety

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

Return to top