1 31 package org.pdfbox.pdmodel.graphics.predictor; 32 33 43 public class Sub extends PredictorAlgorithm 44 { 45 48 public void encodeLine(byte[] src, byte[] dest, int srcDy, int srcOffset, 49 int destDy, int destOffset) 50 { 51 int bpl = getWidth()*getBpp(); 52 int bpp = getBpp(); 53 for (int x = 0; x < bpl && x < bpp; x++) 55 { 56 dest[x + destOffset] = src[x + srcOffset]; 57 } 58 for (int x = getBpp(); x < bpl; x++) 60 { 61 dest[x + destOffset] = (byte) (src[x + srcOffset] - src[x 62 + srcOffset - bpp]); 63 } 64 } 65 66 69 public void decodeLine(byte[] src, byte[] dest, int srcDy, int srcOffset, 70 int destDy, int destOffset) 71 { 72 int bpl = getWidth()*getBpp(); 73 int bpp = getBpp(); 74 for (int x = 0; x < bpl && x < bpp; x++) 76 { 77 dest[x + destOffset] = src[x + srcOffset]; 78 } 79 for (int x = getBpp(); x < bpl; x++) 81 { 82 dest[x + destOffset] = (byte) (src[x + srcOffset] + dest[x 83 + destOffset - bpp]); 84 } 85 } 86 } 87 | Popular Tags |