/// <summary>
        /// Creates the proofing transform from the specified <see cref="SoftProofingConfigToken"/>.
        /// </summary>
        /// <param name="token">The token containing the settings transform.</param>
        /// <exception cref="ArgumentNullException"><paramref name="token" /> is null.</exception>
        /// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
        public void CreateProofingTransform(SoftProofingConfigToken token)
        {
            if (token == null)
            {
                throw new ArgumentNullException("token");
            }

            if (this.disposed)
            {
                throw new ObjectDisposedException("ColorManagement");
            }

            if (token.InputColorProfile != null &&
                token.DisplayColorProfile != null &&
                token.ProofingColorProfiles != null &&
                token.ProofingProfileIndex >= 0)
            {
                if (InitializeColorProfiles(token.InputColorProfile.Path, token.DisplayColorProfile.Path, token.ProofingColorProfiles[token.ProofingProfileIndex].Path))
                {
                    this.proofingTransformIsValid = InitializeProofingTransform(token);
                }
            }
            else
            {
                if (this.inputProfile != null)
                {
                    Reset();
                }
            }
        }
        /// <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);
        }
Esempio n. 3
0
 private SoftProofingConfigToken(SoftProofingConfigToken cloneMe)
 {
     this.InputColorProfile      = cloneMe.InputColorProfile;
     this.DisplayColorProfile    = cloneMe.DisplayColorProfile;
     this.DisplayIntent          = cloneMe.DisplayIntent;
     this.ProofingColorProfiles  = cloneMe.ProofingColorProfiles;
     this.ProofingProfileIndex   = cloneMe.ProofingProfileIndex;
     this.ProofingIntent         = cloneMe.ProofingIntent;
     this.ShowGamutWarning       = cloneMe.ShowGamutWarning;
     this.GamutWarningColor      = cloneMe.GamutWarningColor;
     this.BlackPointCompensation = cloneMe.BlackPointCompensation;
 }
        protected override void InitTokenFromDialog()
        {
            SoftProofingConfigToken token = (SoftProofingConfigToken)this.theEffectToken;

            token.InputColorProfile      = this.inputProfile;
            token.DisplayColorProfile    = this.displayProfile;
            token.DisplayIntent          = (RenderingIntent)this.displayIntentCombo.SelectedIndex;
            token.ProofingColorProfiles  = this.proofingColorProfiles;
            token.ProofingProfileIndex   = this.proofingProfileIndex;
            token.ProofingIntent         = (RenderingIntent)this.proofingIntentCombo.SelectedIndex;
            token.ShowGamutWarning       = this.gamutWarningCheckBox.Checked;
            token.GamutWarningColor      = this.gamutWarningColorButton.Value;
            token.BlackPointCompensation = this.blackPointCheckBox.Checked;
        }
Esempio n. 5
0
        protected override void OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            SoftProofingConfigToken token = (SoftProofingConfigToken)parameters;

            if (this.colorManagement == null)
            {
                this.colorManagement = new ColorManagement();
            }

            this.colorManagement.CreateProofingTransform(token);

            this.renderProofingTransform = this.colorManagement.ProofingTransformIsValid;

            base.OnSetRenderInfo(parameters, dstArgs, srcArgs);
        }
        protected override void InitDialogFromToken(EffectConfigToken effectTokenCopy)
        {
            SoftProofingConfigToken token = (SoftProofingConfigToken)effectTokenCopy;

            PushSuppressTokenUpdate();

            if (token.InputColorProfile != null)
            {
                this.inputProfile = token.InputColorProfile;
                this.inputProfileDescription.Text = this.inputProfile.Description;
            }

            if (token.DisplayColorProfile != null)
            {
                this.displayProfile = token.DisplayColorProfile;
                this.displayProfileDescription.Text = this.displayProfile.Description;
            }

            if (token.ProofingColorProfiles != null)
            {
                if (this.proofingColorProfiles.Count == 0)
                {
                    InitializeProfileListFromToken(token.ProofingColorProfiles);
                }

                if (token.ProofingProfileIndex >= 0)
                {
                    this.proofingProfilesCombo.SelectedIndex = token.ProofingProfileIndex + 1;
                }
            }

            this.displayIntentCombo.SelectedIndex  = (int)token.DisplayIntent;
            this.proofingIntentCombo.SelectedIndex = (int)token.ProofingIntent;
            this.gamutWarningCheckBox.Checked      = token.ShowGamutWarning;
            this.gamutWarningColorButton.Value     = token.GamutWarningColor;
            this.blackPointCheckBox.Checked        = token.BlackPointCompensation;

            PopSuppressTokenUpdate();
        }