2018-06-11 22:41:11 +02:00
|
|
|
package ar.com.hjg.pngj;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set of {@link IImageLine} elements.
|
|
|
|
* <p>
|
2018-09-22 11:17:30 +02:00
|
|
|
* This is actually a "virtual" set, it can be implemented in several ways; for
|
|
|
|
* example
|
2018-06-11 22:41:11 +02:00
|
|
|
* <ul>
|
2018-09-22 11:17:30 +02:00
|
|
|
* <li>Cursor-like: stores only one line, which is implicitly moved when
|
|
|
|
* requested</li>
|
2018-06-11 22:41:11 +02:00
|
|
|
* <li>All lines: all lines stored as an array of <tt>IImageLine</tt></li>
|
|
|
|
* <li>
|
2018-09-22 11:17:30 +02:00
|
|
|
* Subset of lines: eg, only first 3 lines, or odd numbered lines. Or a band of
|
|
|
|
* neighbours lines that is moved like a
|
2018-06-11 22:41:11 +02:00
|
|
|
* cursor.</li>
|
2018-09-22 11:17:30 +02:00
|
|
|
* The ImageLine that PngReader returns is hosted by a IImageLineSet (this
|
|
|
|
* abstraction allows the implementation to deal
|
|
|
|
* with interlaced images cleanly) but the library user does not normally needs
|
|
|
|
* to know that (or rely on that), except
|
2018-06-11 22:41:11 +02:00
|
|
|
* for the {@link PngReader#readRows()} method.
|
|
|
|
* </ul>
|
|
|
|
*/
|
|
|
|
public interface IImageLineSet<T extends IImageLine> {
|
|
|
|
|
2018-09-22 11:17:30 +02:00
|
|
|
/**
|
|
|
|
* Asks for imageline corresponding to row <tt>n</tt> in the original image
|
|
|
|
* (zero based). This can trigger side
|
|
|
|
* effects in this object (eg, advance a cursor, set current row number...)
|
|
|
|
* In some scenarios, this should be consider
|
|
|
|
* as alias to (pseudocode) <tt>positionAtLine(n); getCurrentLine();</tt>
|
|
|
|
* <p>
|
|
|
|
* Throws exception if not available. The caller is supposed to know what
|
|
|
|
* he/she is doing
|
|
|
|
**/
|
|
|
|
IImageLine getImageLine(int n);
|
2018-06-11 22:41:11 +02:00
|
|
|
|
2018-09-22 11:17:30 +02:00
|
|
|
/**
|
|
|
|
* Like {@link #getImageLine(int)} but uses the raw numbering inside the
|
|
|
|
* LineSet This makes little sense for a cursor
|
|
|
|
*
|
|
|
|
* @param n
|
|
|
|
* Should normally go from 0 to {@link #size()}
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
IImageLine getImageLineRawNum(int n);
|
2018-06-11 22:41:11 +02:00
|
|
|
|
2018-09-22 11:17:30 +02:00
|
|
|
/**
|
|
|
|
* Returns true if the set contain row <tt>n</tt> (in the original
|
|
|
|
* image,zero based) currently allocated.
|
|
|
|
* <p>
|
|
|
|
* If it's a single-cursor, this should return true only if it's positioned
|
|
|
|
* there. (notice that hasImageLine(n) can
|
|
|
|
* return false, but getImageLine(n) can be ok)
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
boolean hasImageLine(int n);
|
2018-06-11 22:41:11 +02:00
|
|
|
|
2018-09-22 11:17:30 +02:00
|
|
|
/**
|
|
|
|
* Internal size of allocated rows This is informational, it should rarely
|
|
|
|
* be important for the caller.
|
|
|
|
**/
|
|
|
|
int size();
|
2018-06-11 22:41:11 +02:00
|
|
|
|
|
|
|
}
|