C# Class BitMiracle.LibJpeg.Classic.Internal.my_source_mgr

Expanded data source object for stdio input
Inheritance: jpeg_source_mgr
Show file Open project: prepare/HTML-Renderer

Public Methods

Method Description
Attach ( Stream infile ) : void
fill_input_buffer ( ) : bool

Fill the input buffer - called whenever buffer is emptied. In typical applications, this should read fresh data into the buffer (ignoring the current state of next_input_byte and bytes_in_buffer), reset the pointer and count to the start of the buffer, and return true indicating that the buffer has been reloaded. It is not necessary to fill the buffer entirely, only to obtain at least one more byte. There is no such thing as an EOF return. If the end of the file has been reached, the routine has a choice of ERREXIT() or inserting fake data into the buffer. In most cases, generating a warning message and inserting a fake EOI marker is the best course of action --- this will allow the decompressor to output however much of the image is there. However, the resulting error message is misleading if the real problem is an empty input file, so we handle that case specially. In applications that need to be able to suspend compression due to input not being available yet, a false return indicates that no more data can be obtained right now, but more may be forthcoming later. In this situation, the decompressor will return to its caller (with an indication of the number of scanlines it has read, if any). The application should resume decompression after it has loaded more data into the input buffer. Note that there are substantial restrictions on the use of suspension --- see the documentation. When suspending, the decompressor will back up to a convenient restart point (typically the start of the current MCU). next_input_byte and bytes_in_buffer indicate where the restart point will be if the current call returns false. Data beyond this point must be rescanned after resumption, so move it to the front of the buffer rather than discarding it.

init_source ( ) : void
my_source_mgr ( jpeg_decompress_struct cinfo ) : System.IO

Initialize source - called by jpeg_read_header before any data is actually read.

Method Details

Attach() public method

public Attach ( Stream infile ) : void
infile System.IO.Stream
return void

fill_input_buffer() public method

Fill the input buffer - called whenever buffer is emptied. In typical applications, this should read fresh data into the buffer (ignoring the current state of next_input_byte and bytes_in_buffer), reset the pointer and count to the start of the buffer, and return true indicating that the buffer has been reloaded. It is not necessary to fill the buffer entirely, only to obtain at least one more byte. There is no such thing as an EOF return. If the end of the file has been reached, the routine has a choice of ERREXIT() or inserting fake data into the buffer. In most cases, generating a warning message and inserting a fake EOI marker is the best course of action --- this will allow the decompressor to output however much of the image is there. However, the resulting error message is misleading if the real problem is an empty input file, so we handle that case specially. In applications that need to be able to suspend compression due to input not being available yet, a false return indicates that no more data can be obtained right now, but more may be forthcoming later. In this situation, the decompressor will return to its caller (with an indication of the number of scanlines it has read, if any). The application should resume decompression after it has loaded more data into the input buffer. Note that there are substantial restrictions on the use of suspension --- see the documentation. When suspending, the decompressor will back up to a convenient restart point (typically the start of the current MCU). next_input_byte and bytes_in_buffer indicate where the restart point will be if the current call returns false. Data beyond this point must be rescanned after resumption, so move it to the front of the buffer rather than discarding it.
public fill_input_buffer ( ) : bool
return bool

init_source() public method

public init_source ( ) : void
return void

my_source_mgr() public method

Initialize source - called by jpeg_read_header before any data is actually read.
public my_source_mgr ( jpeg_decompress_struct cinfo ) : System.IO
cinfo jpeg_decompress_struct
return System.IO