public override void IsEqualSame() { var cs1 = new Colorspace(); var cs2 = new Colorspace(); bool cmp1 = cs1 == cs2; bool cmp2 = cs1.Equals(cs2); Assert.IsTrue(cmp1 == cmp2); }
/// <summary> /// Creates a new instance of the <see cref="ConversionData"/> class /// </summary> /// <param name="inColor">The input color</param> /// <param name="outColor">The output color</param> public ConversionData(Color inColor, Color outColor) { if (inColor == null || outColor == null) { throw new ArgumentNullException(); } Type inColorType = inColor.GetType(); Type outColorType = inColor.GetType(); Colorspace inSpace = inColor.Space; Colorspace outSpace = outColor.Space; Type inSpaceType = inSpace.GetType(); Type outSpaceType = outSpace.GetType(); IsCARequired = !inSpace.Equals(outSpace); IsDifferentWP = inSpace.ReferenceWhite != outSpace.ReferenceWhite; InTransform = inSpace.GetTransformation(true); OutTransform = outSpace.GetTransformation(false); _InSpaceData = inSpace.GetData(true); _OutSpaceData = outSpace.GetData(false); if (_InSpaceData != null) { InSpaceData = _InSpaceData.DataPointer; } if (_OutSpaceData != null) { OutSpaceData = _OutSpaceData.DataPointer; } ColVars1Handle = GCHandle.Alloc(ColVars1Array, GCHandleType.Pinned); ColVars2Handle = GCHandle.Alloc(ColVars2Array, GCHandleType.Pinned); VarsHandle = GCHandle.Alloc(VarsArray, GCHandleType.Pinned); InWPHandle = GCHandle.Alloc(inSpace.ReferenceWhite.XYZ, GCHandleType.Pinned); OutWPHandle = GCHandle.Alloc(outSpace.ReferenceWhite.XYZ, GCHandleType.Pinned); InWPCrHandle = GCHandle.Alloc(inSpace.ReferenceWhite.Cxy, GCHandleType.Pinned); OutWPCrHandle = GCHandle.Alloc(outSpace.ReferenceWhite.Cxy, GCHandleType.Pinned); ColVars1 = (double *)ColVars1Handle.AddrOfPinnedObject(); ColVars2 = (double *)ColVars2Handle.AddrOfPinnedObject(); Vars = (double *)VarsHandle.AddrOfPinnedObject(); InWP = (double *)InWPHandle.AddrOfPinnedObject(); OutWP = (double *)OutWPHandle.AddrOfPinnedObject(); InWPCr = (double *)InWPCrHandle.AddrOfPinnedObject(); OutWPCr = (double *)OutWPCrHandle.AddrOfPinnedObject(); AdditionalDataHandle = new List <ArrayData>(); }