private void Reset()
        {
            if (this.inputProfile != null)
            {
                this.inputProfile.Dispose();
                this.inputProfile = null;
            }

            if (this.displayProfile != null)
            {
                this.displayProfile.Dispose();
                this.displayProfile = null;
            }

            if (this.proofingProfile != null)
            {
                this.proofingProfile.Dispose();
                this.proofingProfile = null;
            }

            if (this.proofingTransform != null)
            {
                this.proofingTransform.Dispose();
                this.proofingTransform = null;
            }
            this.inputProfilePath         = null;
            this.displayProfilePath       = null;
            this.proofingProfilePath      = null;
            this.proofingTransformIsValid = false;
        }
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (!this.disposed)
            {
                if (this.inputProfile != null)
                {
                    this.inputProfile.Dispose();
                    this.inputProfile = null;
                }

                if (this.displayProfile != null)
                {
                    this.displayProfile.Dispose();
                    this.displayProfile = null;
                }

                if (this.proofingProfile != null)
                {
                    this.proofingProfile.Dispose();
                    this.proofingProfile = null;
                }

                if (this.proofingTransform != null)
                {
                    this.proofingTransform.Dispose();
                    this.proofingTransform = null;
                }
                this.proofingTransformIsValid = false;
                this.disposed = true;
            }
        }
        /// <summary>
        /// Initializes the color transform with the options from the specified <see cref="SoftProofingConfigToken"/>.
        /// </summary>
        /// <param name="token">The token containing the transform options.</param>
        /// <returns>
        ///     <c>true</c> if the proofing transform was successfully initialized; otherwise, <c>false</c>.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="token"/> is null.</exception>
        private bool InitializeProofingTransform(SoftProofingConfigToken token)
        {
            if (token == null)
            {
                throw new ArgumentNullException("token");
            }

            if (this.proofingTransform != null)
            {
                this.proofingTransform.Dispose();
                this.proofingTransform = null;
            }

            this.proofingTransform = LCMSHelper.CreateProofingTransformBGRA8(
                this.inputProfile,
                this.displayProfile,
                token.DisplayIntent,
                this.proofingProfile,
                token.ProofingIntent,
                token.ShowGamutWarning,
                token.GamutWarningColor,
                token.BlackPointCompensation
                );

            return(!this.proofingTransform.IsInvalid);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ColorManagement"/> class.
 /// </summary>
 public ColorManagement()
 {
     this.inputProfile             = null;
     this.displayProfile           = null;
     this.proofingProfile          = null;
     this.proofingTransform        = null;
     this.inputProfilePath         = null;
     this.displayProfilePath       = null;
     this.proofingProfilePath      = null;
     this.proofingTransformIsValid = false;
     this.disposed = false;
 }