org.pdfbox.pdmodel.graphics.predictor
Class Paeth
java.lang.Object
org.pdfbox.pdmodel.graphics.predictor.PredictorAlgorithm
org.pdfbox.pdmodel.graphics.predictor.Paeth
- public class Paeth
- extends PredictorAlgorithm
From http://www.w3.org/TR/PNG-Filters.html: The Paeth filter computes a
simple linear function of the three neighboring pixels (left, above, upper
left), then chooses as predictor the neighboring pixel closest to the
computed value. This technique is due to Alan W. Paeth [PAETH].
To compute the Paeth filter, apply the following formula to each byte of the
scanline:
Paeth(i,j) = Raw(i,j) - PaethPredictor(Raw(i-1,j), Raw(i,j-1), Raw(i-1,j-1))
To decode the Paeth filter
Raw(i,j) = Paeth(i,j) - PaethPredictor(Raw(i-1,j), Raw(i,j-1), Raw(i-1,j-1))
- Version:
- $Revision: 1.3 $
- Author:
- xylifyx@yahoo.co.uk
Constructor Summary |
Paeth()
|
Method Summary |
void |
decodeLine(byte[] src,
byte[] dest,
int srcDy,
int srcOffset,
int destDy,
int destOffset)
decode line of pixel data in src from src_offset and width*bpp bytes
forward, put the decoded bytes into dest. |
void |
encodeLine(byte[] src,
byte[] dest,
int srcDy,
int srcOffset,
int destDy,
int destOffset)
encode line of pixel data in src from srcOffset and width*bpp bytes
forward, put the decoded bytes into dest. |
int |
paethPredictor(int a,
int b,
int c)
The paeth predictor function.
|
Methods inherited from class org.pdfbox.pdmodel.graphics.predictor.PredictorAlgorithm |
aboveLeftPixel, abovePixel, checkBufsiz, decode, encode, getBpp, getFilter, getHeight, getWidth, leftPixel, main, setBpp, setHeight, setWidth |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Paeth
public Paeth()
paethPredictor
public int paethPredictor(int a,
int b,
int c)
- The paeth predictor function.
This function is taken almost directly from the PNG definition on
http://www.w3.org/TR/PNG-Filters.html
- Parameters:
a
- leftb
- abovec
- upper left
- Returns:
- The result of the paeth predictor.
encodeLine
public void encodeLine(byte[] src,
byte[] dest,
int srcDy,
int srcOffset,
int destDy,
int destOffset)
- encode line of pixel data in src from srcOffset and width*bpp bytes
forward, put the decoded bytes into dest.
- Specified by:
encodeLine
in class PredictorAlgorithm
- Parameters:
src
- raw image datadest
- encoded datasrcDy
- byte offset between linessrcOffset
- beginning of line datadestDy
- byte offset between linesdestOffset
- beginning of line data
decodeLine
public void decodeLine(byte[] src,
byte[] dest,
int srcDy,
int srcOffset,
int destDy,
int destOffset)
- decode line of pixel data in src from src_offset and width*bpp bytes
forward, put the decoded bytes into dest.
- Specified by:
decodeLine
in class PredictorAlgorithm
- Parameters:
src
- encoded image datadest
- raw datasrcDy
- byte offset between linessrcOffset
- beginning of line datadestDy
- byte offset between linesdestOffset
- beginning of line data