Class PNGPredictor

java.lang.Object
org.loboevolution.pdfview.decode.Predictor
org.loboevolution.pdfview.decode.PNGPredictor

public class PNGPredictor extends Predictor
Undo prediction based on the PNG algorithm.
  • Field Summary

    Fields inherited from class org.loboevolution.pdfview.decode.Predictor

    PNG, TIFF
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of PNGPredictor
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
    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)
    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).
    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)
    protected int
    paeth(int left, int up, int upLeft)
    The paeth algorithm
    unpredict(ByteBuffer imageData)
    Actually perform this algorithm on decoded image data.

    Methods inherited from class org.loboevolution.pdfview.decode.Predictor

    getPredictor

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PNGPredictor

      public PNGPredictor()
      Creates a new instance of PNGPredictor
  • Method Details

    • unpredict

      public ByteBuffer unpredict(ByteBuffer imageData) throws IOException
      Actually perform this algorithm on decoded image data. Subclasses must implement this method

      Undo data based on the png algorithm

      Specified by:
      unpredict in class Predictor
      Parameters:
      imageData - a ByteBuffer object.
      Returns:
      a ByteBuffer object.
      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 of
      invalid reference
      byte
      objects.
    • 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 of
      invalid reference
      byte
      objects.
      prevLine - an array of
      invalid reference
      byte
      objects.
    • 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 of
      invalid reference
      byte
      objects.
      prevLine - an array of
      invalid reference
      byte
      objects.
    • 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 of
      invalid reference
      byte
      objects.
      prevLine - an array of
      invalid reference
      byte
      objects.
    • paeth

      protected int paeth(int left, int up, int upLeft)
      The paeth algorithm
      Parameters:
      left - a Integer object.
      up - a Integer object.
      upLeft - a Integer object.
      Returns:
      a Integer object.