/* Error handling routines (these replace corresponding IJG routines). * These are used for both compression and decompression. */ public override void error_exit() { string buffer = format_message(); Tiff.ErrorExt(m_sp.GetTiff(), m_sp.GetTiff().m_clientdata, "LibJpeg", "{0}", buffer); /* display the error message */ // clean up LibJpeg.Net state m_sp.m_libjpeg_jpeg_decompress_struct.jpeg_abort(); throw new Exception(buffer); }
/// <summary> /// Fills input buffer /// </summary> /// <returns> /// <c>true</c> if operation succeed; otherwise, <c>false</c> /// </returns> public override bool fill_input_buffer() { Tiff tif = m_sp.GetTiff(); byte[] mem = null; uint len = 0; if (!m_sp.OJPEGWriteStream(out mem, out len)) { Tiff.ErrorExt(tif, tif.m_clientdata, "LibJpeg", "Premature end of JPEG data"); } initInternalBuffer(mem, (int)len); return(true); }