/// <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; }
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);
internal static extern JpegLSError JpegLsEncode64( [Out] byte[] compressedData, long compressedLength, out long byteCountWritten, [In] byte[] uncompressedData, long uncompressedLength, [In] ref JlsParameters info, IntPtr reserved);
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); }
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; }
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); }
internal static extern JpegLSError JpegLsReadHeader64([In] byte[] compressedSource, long compressedLength, out JlsParameters info, [Out] StringBuilder errorMessage);
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; }
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); }
private static int GetUncompressedSize(ref JlsParameters info) { var size = info.Width * info.Height * info.Components * ((info.BitsPerSample + 7) / 8); return(size); }
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); }
internal static extern JpegLSError JpegLsReadHeader64([In] byte[] compressedSource, long compressedLength, out JlsParameters info, IntPtr reserved);