Example #1
0
        /// <summary> Read the header and tags into memory and verify
        /// that the correct type of profile is being used. for encoding.
        /// </summary>
        /// <param name="data">ICCProfile
        /// </param>
        /// <exception cref="ICCProfileInvalidException">for bad signature and class and bad type
        /// </exception>
        private void initProfile(byte[] data)
        {
            header = new ICCProfileHeader(data);
            tags   = ICCTagTable.createInstance(data);


            // Verify that the data pointed to by icc is indeed a valid profile
            // and that it is possibly of one of the Restricted ICC types. The simplest way to check
            // this is to verify that the profile signature is correct, that it is an input profile,
            // and that the PCS used is XYX.

            // However, a common error in profiles will be to create Monitor profiles rather
            // than input profiles. If this is the only error found, it's still useful to let this
            // go through with an error written to stderr.

            if (ProfileClass == kdwDisplayProfile)
            {
                string message = "NOTE!! Technically, this profile is a Display profile, not an"
                                 + " Input Profile, and thus is not a valid Restricted ICC profile."
                                 + " However, it is quite possible that this profile is usable as"
                                 + " a Restricted ICC profile, so this code will ignore this state"
                                 + " and proceed with processing.";

                FacilityManager.getMsgLogger().printmsg(CSJ2K.j2k.util.MsgLogger_Fields.WARNING, message);
            }

            if ((ProfileSignature != kdwProfileSignature) ||
                ((ProfileClass != kdwInputProfile) && (ProfileClass != kdwDisplayProfile)) || (PCSType != kdwXYZData))
            {
                throw new ICCProfileInvalidException();
            }
        }
Example #2
0
		/// <summary> Read the header and tags into memory and verify
		/// that the correct type of profile is being used. for encoding.
		/// </summary>
		/// <param name="data">ICCProfile
		/// </param>
		/// <exception cref="ICCProfileInvalidException">for bad signature and class and bad type
		/// </exception>
		private void  initProfile(byte[] data)
		{
			header = new ICCProfileHeader(data);
			tags = ICCTagTable.createInstance(data);
			
			
			// Verify that the data pointed to by icc is indeed a valid profile    
			// and that it is possibly of one of the Restricted ICC types. The simplest way to check    
			// this is to verify that the profile signature is correct, that it is an input profile,    
			// and that the PCS used is XYX.    
			
			// However, a common error in profiles will be to create Monitor profiles rather    
			// than input profiles. If this is the only error found, it's still useful to let this  
			// go through with an error written to stderr.  
			
			if (ProfileClass == kdwDisplayProfile)
			{
				System.String message = "NOTE!! Technically, this profile is a Display profile, not an" + " Input Profile, and thus is not a valid Restricted ICC profile." + " However, it is quite possible that this profile is usable as" + " a Restricted ICC profile, so this code will ignore this state" + " and proceed with processing.";
				
				FacilityManager.getMsgLogger().printmsg(CSJ2K.j2k.util.MsgLogger_Fields.WARNING, message);
			}
			
			if ((ProfileSignature != kdwProfileSignature) || ((ProfileClass != kdwInputProfile) && (ProfileClass != kdwDisplayProfile)) || (PCSType != kdwXYZData))
			{
				throw new ICCProfileInvalidException();
			}
		}