Beispiel #1
0
        internal void CreateTransform(SafeProfileHandle sourceProfile, SafeProfileHandle destinationProfile)
        {
            if (sourceProfile == null || sourceProfile.IsInvalid)
            {
                throw new ArgumentNullException("sourceProfile");
            }

            if (destinationProfile == null || destinationProfile.IsInvalid)
            {
                throw new ArgumentNullException("destinationProfile");
            }

            IntPtr[] handles = new IntPtr[2];
            bool     success = true;

            sourceProfile.DangerousAddRef(ref success);
            Debug.Assert(success);
            destinationProfile.DangerousAddRef(ref success);
            Debug.Assert(success);

            try
            {
                handles[0] = sourceProfile.DangerousGetHandle();
                handles[1] = destinationProfile.DangerousGetHandle();

                UInt32[] dwIntents = new UInt32[2] {
                    INTENT_PERCEPTUAL, INTENT_PERCEPTUAL
                };

                // No need to get rid of the old handle as it will get GC'ed
                _transformHandle = UnsafeNativeMethods.Mscms.CreateMultiProfileTransform(
                    handles,
                    (UInt32)handles.Length,
                    dwIntents,
                    (UInt32)dwIntents.Length,
                    BEST_MODE | USE_RELATIVE_COLORIMETRIC,
                    0
                    );
            }
            finally
            {
                sourceProfile.DangerousRelease();
                destinationProfile.DangerousRelease();
            }

            if (_transformHandle == null || _transformHandle.IsInvalid)
            {
                HRESULT.Check(Marshal.GetHRForLastWin32Error());
            }
        }
 internal static extern bool GetColorProfileHeader(SafeProfileHandle /* HANDLE */ phProfile, out MS.Win32.UnsafeNativeMethods.PROFILEHEADER pHeader);
 internal static extern bool GetColorProfileFromHandle(SafeProfileHandle /* HANDLE */ hProfile, byte[] pBuffer, ref uint pdwSize);
Beispiel #4
0
        internal void CreateTransform(SafeProfileHandle sourceProfile, SafeProfileHandle destinationProfile)
        {
            if (sourceProfile == null || sourceProfile.IsInvalid)
            {
                throw new ArgumentNullException("sourceProfile");
            }

            if (destinationProfile == null || destinationProfile.IsInvalid)
            {
                throw new ArgumentNullException("destinationProfile");
            }

            IntPtr[] handles = new IntPtr[2];
            bool success = true;

            sourceProfile.DangerousAddRef(ref success);
            Debug.Assert(success);
            destinationProfile.DangerousAddRef(ref success);
            Debug.Assert(success);

            try
            {
                handles[0] = sourceProfile.DangerousGetHandle();
                handles[1] = destinationProfile.DangerousGetHandle();

                UInt32[] dwIntents = new UInt32[2] {INTENT_PERCEPTUAL, INTENT_PERCEPTUAL};

                // No need to get rid of the old handle as it will get GC'ed
                _transformHandle = UnsafeNativeMethods.Mscms.CreateMultiProfileTransform(
                    handles,
                    (UInt32)handles.Length,
                    dwIntents,
                    (UInt32)dwIntents.Length,
                    BEST_MODE | USE_RELATIVE_COLORIMETRIC,
                    0
                    );
            }
            finally
            {
                sourceProfile.DangerousRelease();
                destinationProfile.DangerousRelease();
            }

            if (_transformHandle == null || _transformHandle.IsInvalid)
            {
                HRESULT.Check(Marshal.GetHRForLastWin32Error());
            }
        }