C# Class ImageUtility.ColorProfile

The source color for the bitmap The color profile helps converting between the original color space and the internal CIEXYZ color space used in the Bitmap class For now, only standard profiles like Linear, sRGB, Adobe RGB, ProPhoto RGB or any custom chromaticities are supported. I believe it would be overkill to include a library for parsing embedded ICC profiles...
Inheritance: IColorConverter
Afficher le fichier Open project: Patapom/GodComplex Class Usage Examples

Méthodes publiques

Свойство Type Description
ILLUMINANT_A float2
ILLUMINANT_D50 float2
ILLUMINANT_D55 float2
ILLUMINANT_D65 float2
ILLUMINANT_E float2

Protected Properties

Свойство Type Description
m_Chromaticities Chromaticities
m_Exposure float
m_Gamma float
m_GammaCurve GAMMA_CURVE
m_InternalConverter IColorConverter
m_RGB2XYZ float4x4
m_XYZ2RGB float4x4
m_bProfileFoundInFile bool

Méthodes publiques

Méthode Description
ColorProfile ( BitmapMetadata _MetaData, Bitmap _FileType ) : System

Creates the color profile from metadata embedded in the image file

ColorProfile ( Chromaticities _Chromaticities, GAMMA_CURVE _GammaCurve, float _Gamma ) : System

Creates a color profile from chromaticities

ColorProfile ( STANDARD_PROFILE _Profile ) : System

Build from a standard profile

GammaCorrect ( float c, float _ImageGamma ) : float

Applies gamma correction to the provided color

GammaUnCorrect ( float c, float _ImageGamma ) : float

Un-aplies gamma correction to the provided color

Linear2sRGB ( float c ) : float

Converts from linear space to sRGB Code borrowed from D3DX_DXGIFormatConvert.inl from the DX10 SDK

RGB2XYZ ( float4 _RGB ) : float4

Converts a RGB color to a CIEXYZ color

RGB2XYZ ( float4 _RGB, float4 _XYZ ) : void

Converts a RGB color to a CIEXYZ color

XYZ2RGB ( float4 _XYZ ) : float4

Converts a CIEXYZ color to a RGB color

XYZ2RGB ( float4 _XYZ, float4 _RGB ) : void

Converts a CIEXYZ color to a RGB color

XYZ2xyY ( float3 _XYZ ) : float3

Converts from XYZ to xyY

sRGB2Linear ( float c ) : float

Converts from sRGB to linear space Code borrowed from D3DX_DXGIFormatConvert.inl from the DX10 SDK

xyY2XYZ ( float3 _xyY ) : float3

Converts from xyY to XYZ

Méthodes protégées

Méthode Description
BuildTransformFromChroma ( bool _bCheckGammaCurveOverride ) : void

Builds the RGB<->XYZ transforms from chromaticities (refer to http://wiki.nuaj.net/index.php/Color_Transforms#XYZ_Matrices for explanations)

DumpMetaData ( BitmapMetadata _Root ) : string
DumpMetaData ( BitmapMetadata _Root, string _Tab ) : string
EnsureGamma ( GAMMA_CURVE _Curve, float _Gamma ) : bool

Ensures the current gamma curve type and value are the ones we want

EnumerateMetaData ( BitmapMetadata _Root ) : void
EnumerateMetaDataJPG ( BitmapMetadata _MetaData, bool &_bProfileFound, bool &_bGammaWasSpecified ) : void
EnumerateMetaDataPNG ( BitmapMetadata _MetaData, bool &_bProfileFound, bool &_bGammaWasSpecified ) : void
EnumerateMetaDataTIFF ( BitmapMetadata _MetaData, bool &_bProfileFound, bool &_bGammaWasSpecified ) : void
FindAttribute ( string _XMLContent, string _AttributeName ) : string

Attempts to find an XML attribute by name

FindEXIFColorProfile ( BitmapMetadata _Meta ) : bool

Attempts to find the color profile in the EXIF metadata

FindICCProfileString ( BitmapMetadata _Meta, bool &_bGammaWasSpecified ) : bool

Attempts to find the "photoshop:ICCProfile" string in the metadata dump and retrieve a known profile from it

FindPhotometricInterpretation ( BitmapMetadata _Meta, string _MetaPath ) : bool

Attempts to find the TIFF "PhotometricInterpretation" metadata

HandleEXIFColorSpace ( int _ColorSpace ) : bool

Attempts to handle a color profile from the EXIF ColorSpace tag

HandleEXIFColorSpace ( string _ColorSpace ) : bool
HandleICCProfileString ( string _ProfilName ) : bool

Attempts to handle an ICC profile by name

Method Details

BuildTransformFromChroma() protected méthode

Builds the RGB<->XYZ transforms from chromaticities (refer to http://wiki.nuaj.net/index.php/Color_Transforms#XYZ_Matrices for explanations)
protected BuildTransformFromChroma ( bool _bCheckGammaCurveOverride ) : void
_bCheckGammaCurveOverride bool
Résultat void

ColorProfile() public méthode

Creates the color profile from metadata embedded in the image file
public ColorProfile ( BitmapMetadata _MetaData, Bitmap _FileType ) : System
_MetaData BitmapMetadata
_FileType Bitmap
Résultat System

ColorProfile() public méthode

Creates a color profile from chromaticities
public ColorProfile ( Chromaticities _Chromaticities, GAMMA_CURVE _GammaCurve, float _Gamma ) : System
_Chromaticities Chromaticities The chromaticities for this profile
_GammaCurve GAMMA_CURVE The type of gamma curve to use
_Gamma float The gamma power
Résultat System

ColorProfile() public méthode

Build from a standard profile
public ColorProfile ( STANDARD_PROFILE _Profile ) : System
_Profile STANDARD_PROFILE
Résultat System

DumpMetaData() protected méthode

protected DumpMetaData ( BitmapMetadata _Root ) : string
_Root BitmapMetadata
Résultat string

DumpMetaData() protected méthode

protected DumpMetaData ( BitmapMetadata _Root, string _Tab ) : string
_Root BitmapMetadata
_Tab string
Résultat string

EnsureGamma() protected méthode

Ensures the current gamma curve type and value are the ones we want
protected EnsureGamma ( GAMMA_CURVE _Curve, float _Gamma ) : bool
_Curve GAMMA_CURVE
_Gamma float
Résultat bool

EnumerateMetaData() protected méthode

protected EnumerateMetaData ( BitmapMetadata _Root ) : void
_Root BitmapMetadata
Résultat void

EnumerateMetaDataJPG() protected méthode

protected EnumerateMetaDataJPG ( BitmapMetadata _MetaData, bool &_bProfileFound, bool &_bGammaWasSpecified ) : void
_MetaData BitmapMetadata
_bProfileFound bool
_bGammaWasSpecified bool
Résultat void

EnumerateMetaDataPNG() protected méthode

protected EnumerateMetaDataPNG ( BitmapMetadata _MetaData, bool &_bProfileFound, bool &_bGammaWasSpecified ) : void
_MetaData BitmapMetadata
_bProfileFound bool
_bGammaWasSpecified bool
Résultat void

EnumerateMetaDataTIFF() protected méthode

protected EnumerateMetaDataTIFF ( BitmapMetadata _MetaData, bool &_bProfileFound, bool &_bGammaWasSpecified ) : void
_MetaData BitmapMetadata
_bProfileFound bool
_bGammaWasSpecified bool
Résultat void

FindAttribute() protected méthode

Attempts to find an XML attribute by name
protected FindAttribute ( string _XMLContent, string _AttributeName ) : string
_XMLContent string
_AttributeName string
Résultat string

FindEXIFColorProfile() protected méthode

Attempts to find the color profile in the EXIF metadata
protected FindEXIFColorProfile ( BitmapMetadata _Meta ) : bool
_Meta BitmapMetadata
Résultat bool

FindICCProfileString() protected méthode

Attempts to find the "photoshop:ICCProfile" string in the metadata dump and retrieve a known profile from it
protected FindICCProfileString ( BitmapMetadata _Meta, bool &_bGammaWasSpecified ) : bool
_Meta BitmapMetadata
_bGammaWasSpecified bool
Résultat bool

FindPhotometricInterpretation() protected méthode

Attempts to find the TIFF "PhotometricInterpretation" metadata
protected FindPhotometricInterpretation ( BitmapMetadata _Meta, string _MetaPath ) : bool
_Meta BitmapMetadata
_MetaPath string
Résultat bool

GammaCorrect() public static méthode

Applies gamma correction to the provided color
public static GammaCorrect ( float c, float _ImageGamma ) : float
c float The color to gamma-correct
_ImageGamma float The gamma correction the image was encoded with (JPEG is 2.2 for example, if not sure use 1.0)
Résultat float

GammaUnCorrect() public static méthode

Un-aplies gamma correction to the provided color
public static GammaUnCorrect ( float c, float _ImageGamma ) : float
c float The color to gamma-uncorrect
_ImageGamma float The gamma correction the image was encoded with (JPEG is 2.2 for example, if not sure use 1.0)
Résultat float

HandleEXIFColorSpace() protected méthode

Attempts to handle a color profile from the EXIF ColorSpace tag
protected HandleEXIFColorSpace ( int _ColorSpace ) : bool
_ColorSpace int
Résultat bool

HandleEXIFColorSpace() protected méthode

protected HandleEXIFColorSpace ( string _ColorSpace ) : bool
_ColorSpace string
Résultat bool

HandleICCProfileString() protected méthode

Attempts to handle an ICC profile by name
protected HandleICCProfileString ( string _ProfilName ) : bool
_ProfilName string
Résultat bool

Linear2sRGB() public static méthode

Converts from linear space to sRGB Code borrowed from D3DX_DXGIFormatConvert.inl from the DX10 SDK
public static Linear2sRGB ( float c ) : float
c float
Résultat float

RGB2XYZ() public méthode

Converts a RGB color to a CIEXYZ color
public RGB2XYZ ( float4 _RGB ) : float4
_RGB float4
Résultat float4

RGB2XYZ() public méthode

Converts a RGB color to a CIEXYZ color
public RGB2XYZ ( float4 _RGB, float4 _XYZ ) : void
_RGB float4
_XYZ float4
Résultat void

XYZ2RGB() public méthode

Converts a CIEXYZ color to a RGB color
public XYZ2RGB ( float4 _XYZ ) : float4
_XYZ float4
Résultat float4

XYZ2RGB() public méthode

Converts a CIEXYZ color to a RGB color
public XYZ2RGB ( float4 _XYZ, float4 _RGB ) : void
_XYZ float4
_RGB float4
Résultat void

XYZ2xyY() public static méthode

Converts from XYZ to xyY
public static XYZ2xyY ( float3 _XYZ ) : float3
_XYZ float3
Résultat float3

sRGB2Linear() public static méthode

Converts from sRGB to linear space Code borrowed from D3DX_DXGIFormatConvert.inl from the DX10 SDK
public static sRGB2Linear ( float c ) : float
c float
Résultat float

xyY2XYZ() public static méthode

Converts from xyY to XYZ
public static xyY2XYZ ( float3 _xyY ) : float3
_xyY float3
Résultat float3

Property Details

ILLUMINANT_A public_oe static_oe property

public static float2,ImageUtility ILLUMINANT_A
Résultat float2

ILLUMINANT_D50 public_oe static_oe property

public static float2,ImageUtility ILLUMINANT_D50
Résultat float2

ILLUMINANT_D55 public_oe static_oe property

public static float2,ImageUtility ILLUMINANT_D55
Résultat float2

ILLUMINANT_D65 public_oe static_oe property

public static float2,ImageUtility ILLUMINANT_D65
Résultat float2

ILLUMINANT_E public_oe static_oe property

public static float2,ImageUtility ILLUMINANT_E
Résultat float2

m_Chromaticities protected_oe property

protected Chromaticities m_Chromaticities
Résultat Chromaticities

m_Exposure protected_oe property

protected float m_Exposure
Résultat float

m_Gamma protected_oe property

protected float m_Gamma
Résultat float

m_GammaCurve protected_oe property

protected GAMMA_CURVE m_GammaCurve
Résultat GAMMA_CURVE

m_InternalConverter protected_oe property

protected IColorConverter m_InternalConverter
Résultat IColorConverter

m_RGB2XYZ protected_oe property

protected float4x4,ImageUtility m_RGB2XYZ
Résultat float4x4

m_XYZ2RGB protected_oe property

protected float4x4,ImageUtility m_XYZ2RGB
Résultat float4x4

m_bProfileFoundInFile protected_oe property

protected bool m_bProfileFoundInFile
Résultat bool