1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.pdfbox.pdmodel.graphics.predictor;
18
19 /**
20 * The none algorithm.
21 *
22 * <code>None(i,j) = Raw(i,j)</code>
23 *
24 * <code>Raw(i,j) = None(i,j)</code>
25 *
26 * @author xylifyx@yahoo.co.uk
27 * @version $Revision: 1.3 $
28 */
29 public class None extends PredictorAlgorithm
30 {
31 /**
32 * encode a byte array full of image data using the filter that this object
33 * implements.
34 *
35 * @param src
36 * buffer
37 * @param dest
38 * buffer
39 */
40 public void encode(byte[] src, byte[] dest)
41 {
42 checkBufsiz(dest, src);
43 System.arraycopy(src,0,dest,0,src.length);
44 }
45
46 /**
47 * decode a byte array full of image data using the filter that this object
48 * implements.
49 *
50 * @param src
51 * buffer
52 * @param dest
53 * buffer
54 */
55 public void decode(byte[] src, byte[] dest)
56 {
57 System.arraycopy(src,0,dest,0,src.length);
58 }
59
60
61
62 /**
63 * {@inheritDoc}
64 */
65 public void encodeLine(byte[] src, byte[] dest, int srcDy, int srcOffset,
66 int destDy, int destOffset)
67 {
68 int bpl = getWidth() * getBpp();
69 for (int x = 0; x < bpl; x++)
70 {
71 dest[destOffset + x] = src[srcOffset + x];
72 }
73 }
74
75 /**
76 * {@inheritDoc}
77 */
78 public void decodeLine(byte[] src, byte[] dest, int srcDy, int srcOffset,
79 int destDy, int destOffset)
80 {
81 int bpl = getWidth() * getBpp();
82 for (int x = 0; x < bpl; x++)
83 {
84 dest[destOffset + x] = src[srcOffset + x];
85 }
86 }
87
88 }