Пример #1
0
        /// <summary>
        /// Set decoding parameters to default values.
        /// </summary>
        /// <param name="parameters">The <see cref="DecompressionParameters"/> to decompress image.</param>
        /// <exception cref="ArgumentNullException"><paramref name="parameters"/> is null.</exception>
        /// <exception cref="ObjectDisposedException"><paramref name="parameters"/> is disposed.</exception>
        public static void SetDefaultDecoderParameters(DecompressionParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            parameters.ThrowIfDisposed();

            NativeMethods.openjpeg_openjp2_opj_set_default_decoder_parameters(parameters.NativePtr);
        }
Пример #2
0
        /// <summary>
        /// Setup the decoder with decompression parameters provided by the user and with the message handler provided by the user.
        /// </summary>
        /// <param name="codec">The <see cref="Codec"/> to decompress image.</param>
        /// <param name="parameters">The <see cref="DecompressionParameters"/> to decompress image.</param>
        /// <returns><code>true</code> if the decoder is correctly set; otherwise, <code>false</code>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="codec"/> or <paramref name="parameters"/> is null.</exception>
        /// <exception cref="ObjectDisposedException"><paramref name="codec"/> or <paramref name="parameters"/> is disposed.</exception>
        public static bool SetupDecoder(Codec codec, DecompressionParameters parameters)
        {
            if (codec == null)
            {
                throw new ArgumentNullException(nameof(codec));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            codec.ThrowIfDisposed();
            parameters.ThrowIfDisposed();

            return(NativeMethods.openjpeg_openjp2_opj_setup_decoder(codec.NativePtr, parameters.NativePtr));
        }