示例#1
0
 /// <summary>
 /// Creates new instance of <see cref="TJCompressor"/>
 /// </summary>
 /// <exception cref="TJException">
 /// Throws if internal compressor instance can not be created
 /// </exception>
 public TJCompressor()
 {
     _compressorHandle = TurboJpegImport.tjInitCompress();
     if (_compressorHandle == IntPtr.Zero)
     {
         TJUtils.GetErrorAndThrow();
     }
 }
        /// <summary>
        /// Creates new instance of <see cref="TJCompressor"/>
        /// </summary>
        /// <exception cref="TJException">
        /// Throws if internal compressor instance can not be created
        /// </exception>
        public TJCompressor(bool iscrossplatform = false)
        {
            isXPlatform = iscrossplatform;
            if (iscrossplatform)
            {
                _compressorHandle = TurboJpegImport_xplat.tjInitCompressX();
            }
            else
            {
                _compressorHandle = TurboJpegImport.tjInitCompress();
            }

            if (_compressorHandle == IntPtr.Zero)
            {
                TJUtils.GetErrorAndThrow();
            }
        }