Esempio n. 1
0
        /// <summary> Get the ICCProfile information JP2 ColorSpace</summary>
        /// <param name="csm">provides all necessary info about the colorspace
        /// </param>
        /// <returns> ICCMatrixBasedInputProfile for 3 component input and
        /// ICCMonochromeInputProfile for a 1 component source.  Returns
        /// null if exceptions were encountered.
        /// </returns>
        /// <exception cref="ColorSpaceException">
        /// </exception>
        /// <exception cref="ICCProfileException">
        /// </exception>
        /// <exception cref="IllegalArgumentException">
        /// </exception>
        private RestrictedICCProfile getICCProfile(CSJ2K.Color.ColorSpace csm)
        {
            switch (ncomps)
            {
            case 1:
                icc  = ICCMonochromeInputProfile.createInstance(csm);
                ricc = icc.parse();
                if (ricc.Type != RestrictedICCProfile.kMonochromeInput)
                {
                    throw new System.ArgumentException("wrong ICCProfile type" + " for image");
                }
                break;

            case 3:
                icc  = ICCMatrixBasedInputProfile.createInstance(csm);
                ricc = icc.parse();
                if (ricc.Type != RestrictedICCProfile.kThreeCompInput)
                {
                    throw new System.ArgumentException("wrong ICCProfile type" + " for image");
                }
                break;

            default:
                throw new System.ArgumentException("illegal number of " + "components (" + ncomps + ") in image");
            }
            return(ricc);
        }
Esempio n. 2
0
        /// <summary> Create an XYZNumber from byte [] input</summary>
        /// <param name="data">array containing the XYZNumber representation
        /// </param>
        /// <param name="offset">start of the rep in the array
        /// </param>
        /// <returns> the created XYZNumber
        /// </returns>
        public static XYZNumber getXYZNumber(byte[] data, int offset)
        {
            int x, y, z;

            x = ICCProfile.getInt(data, offset);
            y = ICCProfile.getInt(data, offset + int_size);
            z = ICCProfile.getInt(data, offset + 2 * int_size);
            return(new XYZNumber(x, y, z));
        }
Esempio n. 3
0
        /// <summary> Create an ICCDateTime from byte [] input</summary>
        /// <param name="data">array containing the ICCProfileVersion representation
        /// </param>
        /// <param name="offset">start of the rep in the array
        /// </param>
        /// <returns> the created ICCProfileVersion
        /// </returns>
        public static ICCDateTime getICCDateTime(byte[] data, int offset)
        {
            short wYear    = ICCProfile.getShort(data, offset);                             // Number of the actual year (i.e. 1994)
            short wMonth   = ICCProfile.getShort(data, offset + ICCProfile.short_size);     // Number of the month (1-12)
            short wDay     = ICCProfile.getShort(data, offset + 2 * ICCProfile.short_size); // Number of the day
            short wHours   = ICCProfile.getShort(data, offset + 3 * ICCProfile.short_size); // Number of hours (0-23)
            short wMinutes = ICCProfile.getShort(data, offset + 4 * ICCProfile.short_size); // Number of minutes (0-59)
            short wSeconds = ICCProfile.getShort(data, offset + 5 * ICCProfile.short_size); // Number of seconds (0-59)

            return(new ICCDateTime(wYear, wMonth, wDay, wHours, wMinutes, wSeconds));
        }
Esempio n. 4
-1
		/// <summary> Get the ICCProfile information JP2 ColorSpace</summary>
		/// <param name="csm">provides all necessary info about the colorspace
		/// </param>
		/// <returns> ICCMatrixBasedInputProfile for 3 component input and
		/// ICCMonochromeInputProfile for a 1 component source.  Returns
		/// null if exceptions were encountered.
		/// </returns>
		/// <exception cref="ColorSpaceException">
		/// </exception>
		/// <exception cref="ICCProfileException">
		/// </exception>
		/// <exception cref="IllegalArgumentException">
		/// </exception>
		private RestrictedICCProfile getICCProfile(CSJ2K.Color.ColorSpace csm)
		{
			
			switch (ncomps)
			{
				
				case 1: 
					icc = ICCMonochromeInputProfile.createInstance(csm);
					ricc = icc.parse();
					if (ricc.Type != RestrictedICCProfile.kMonochromeInput)
						throw new System.ArgumentException("wrong ICCProfile type" + " for image");
					break;
				
				case 3: 
					icc = ICCMatrixBasedInputProfile.createInstance(csm);
					ricc = icc.parse();
					if (ricc.Type != RestrictedICCProfile.kThreeCompInput)
						throw new System.ArgumentException("wrong ICCProfile type" + " for image");
					break;
				
				default: 
					throw new System.ArgumentException("illegal number of " + "components (" + ncomps + ") in image");
				
			}
			return ricc;
		}