Package org.loboevolution.pdfview.decode
Class PNGPredictor
java.lang.Object
org.loboevolution.pdfview.decode.Predictor
org.loboevolution.pdfview.decode.PNGPredictor
Undo prediction based on the PNG algorithm.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoAverageLine(byte[] curLine, byte[] prevLine) Return the value of the average algorithm on the line (compare bytes to the average of the previous byte of the same color and the same byte on the previous line)protected voiddoPaethLine(byte[] curLine, byte[] prevLine) Return the value of the average algorithm on the line (compare bytes to the average of the previous byte of the same color and the same byte on the previous line)protected voiddoSubLine(byte[] curLine) Return the value of the Sub algorithm on the line (compare bytes to the previous byte of the same color on this line).protected voiddoUpLine(byte[] curLine, byte[] prevLine) Return the value of the up algorithm on the line (compare bytes to the same byte in the previous line)protected intpaeth(int left, int up, int upLeft) The paeth algorithmunpredict(ByteBuffer imageData) Actually perform this algorithm on decoded image data.Methods inherited from class org.loboevolution.pdfview.decode.Predictor
getPredictor
-
Constructor Details
-
PNGPredictor
public PNGPredictor()Creates a new instance of PNGPredictor
-
-
Method Details
-
unpredict
Actually perform this algorithm on decoded image data. Subclasses must implement this methodUndo data based on the png algorithm
- Specified by:
unpredictin classPredictor- Parameters:
imageData- aByteBufferobject.- Returns:
- a
ByteBufferobject. - Throws:
IOException- if any.
-
doSubLine
protected void doSubLine(byte[] curLine) Return the value of the Sub algorithm on the line (compare bytes to the previous byte of the same color on this line).- Parameters:
curLine- an array ofobjects.invalid reference
byte
-
doUpLine
protected void doUpLine(byte[] curLine, byte[] prevLine) Return the value of the up algorithm on the line (compare bytes to the same byte in the previous line)- Parameters:
curLine- an array ofobjects.invalid reference
byteprevLine- an array ofobjects.invalid reference
byte
-
doAverageLine
protected void doAverageLine(byte[] curLine, byte[] prevLine) Return the value of the average algorithm on the line (compare bytes to the average of the previous byte of the same color and the same byte on the previous line)- Parameters:
curLine- an array ofobjects.invalid reference
byteprevLine- an array ofobjects.invalid reference
byte
-
doPaethLine
protected void doPaethLine(byte[] curLine, byte[] prevLine) Return the value of the average algorithm on the line (compare bytes to the average of the previous byte of the same color and the same byte on the previous line)- Parameters:
curLine- an array ofobjects.invalid reference
byteprevLine- an array ofobjects.invalid reference
byte
-
paeth
protected int paeth(int left, int up, int upLeft) The paeth algorithm
-