Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JpegLSMetadataInfo"/> class.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <exception cref="InvalidDataException">Thrown when one the values are out of bounds.</exception>
        internal JpegLSMetadataInfo(ref JlsParameters parameters)
        {
            if (parameters.Width < 1)
            {
                throw new InvalidDataException("parameters.Width < 1");
            }
            if (parameters.Height < 1)
            {
                throw new InvalidDataException("parameters.Height < 1");
            }
            if (parameters.BitsPerSample < 2)
            {
                throw new InvalidDataException("parameters.BitsPerSample < 2");
            }
            if (parameters.Components < 1)
            {
                throw new InvalidDataException("parameters.Components < 1");
            }
            Contract.EndContractBlock();

            width             = parameters.Width;
            height            = parameters.Height;
            componentCount    = parameters.Components;
            bitsPerComponent  = parameters.BitsPerSample;
            AllowedLossyError = parameters.AllowedLossyError;
            InterleaveMode    = parameters.InterleaveMode;
        }
Пример #2
0
 internal static extern JpegLSError JpegLsEncode64(
     [Out] byte[] compressedData,
     long compressedLength,
     out long byteCountWritten,
     [In] byte[] uncompressedData,
     long uncompressedLength,
     [In] ref JlsParameters info,
     [Out] StringBuilder errorMessage);
Пример #3
0
 internal static extern JpegLSError JpegLsEncode64(
     [Out] byte[] compressedData,
     long compressedLength,
     out long byteCountWritten,
     [In] byte[] uncompressedData,
     long uncompressedLength,
     [In] ref JlsParameters info,
     IntPtr reserved);
Пример #4
0
        private static int GetUncompressedSize(ref JlsParameters info)
        {
            Contract.Ensures(Contract.Result <int>() > 0);

            var size = info.Width * info.Height * info.Components * ((info.BitsPerSample + 7) / 8);

            Contract.Assume(size > 0);
            return(size);
        }
Пример #5
0
 internal void CopyTo(ref JlsParameters parameters)
 {
     parameters.Width             = Width;
     parameters.Height            = Height;
     parameters.Components        = ComponentCount;
     parameters.BitsPerSample     = BitsPerComponent;
     parameters.InterleaveMode    = InterleaveMode;
     parameters.AllowedLossyError = AllowedLossyError;
     parameters.OutputBgr         = OutputBgr;
 }
Пример #6
0
        private static void JpegLsReadHeaderThrowWhenError(byte[] source, int length, out JlsParameters info)
        {
            Contract.Requires(source != null);

            var         errorMessage = new StringBuilder(256);
            JpegLSError result       = Is64BitProcess ?
                                       SafeNativeMethods.JpegLsReadHeader64(source, length, out info, errorMessage) :
                                       SafeNativeMethods.JpegLsReadHeader(source, length, out info, errorMessage);

            HandleResult(result, errorMessage);
        }
Пример #7
0
 internal static extern JpegLSError JpegLsReadHeader64([In] byte[] compressedSource, long compressedLength, out JlsParameters info, [Out] StringBuilder errorMessage);
Пример #8
0
 internal static extern JpegLSError JpegLsReadHeader64([In] byte[] compressedSource, long compressedLength, out JlsParameters info, [Out] StringBuilder errorMessage);
Пример #9
0
        private static int GetUncompressedSize(ref JlsParameters info)
        {
            Contract.Ensures(Contract.Result<int>() > 0);

            var size = info.Width * info.Height * info.Components * ((info.BitsPerSample + 7) / 8);
            Contract.Assume(size > 0);
            return size;
        }
Пример #10
0
        private static void JpegLsReadHeaderThrowWhenError(byte[] source, int length, out JlsParameters info)
        {
            Contract.Requires(source != null);

            var errorMessage = new StringBuilder(256);
            JpegLSError result = Environment.Is64BitProcess ?
                SafeNativeMethods.JpegLsReadHeader64(source, length, out info, errorMessage) :
                SafeNativeMethods.JpegLsReadHeader(source, length, out info, errorMessage);
            HandleResult(result, errorMessage);
        }
Пример #11
0
        private static int GetUncompressedSize(ref JlsParameters info)
        {
            var size = info.Width * info.Height * info.Components * ((info.BitsPerSample + 7) / 8);

            return(size);
        }
Пример #12
0
        private static void JpegLsReadHeaderThrowWhenError(byte[] source, int length, out JlsParameters info)
        {
            var result = Environment.Is64BitProcess ?
                         SafeNativeMethods.JpegLsReadHeaderX64(source, length, out info, IntPtr.Zero) :
                         SafeNativeMethods.JpegLsReadHeaderX86(source, length, out info, IntPtr.Zero);

            HandleResult(result);
        }
Пример #13
0
 internal static extern JpegLSError JpegLsReadHeader64([In] byte[] compressedSource, long compressedLength, out JlsParameters info, IntPtr reserved);