/Users/lyon/j4p/src/ip/transforms/NoOpFilter.java
|
1 /*
2 * Created by DocJava, Inc.
3 * User: lyon
4 * Date: Feb 28, 2003
5 * Time: 7:44:33 AM
6 */
7 package ip.transforms;
8
9 import j2d.hpp.HppFilterInterface;
10
11
12 public class NoOpFilter implements HppFilterInterface {
13 public short getR(int r) {
14 return noOp(r);
15 }
16
17 public short getG(int g) {
18 return noOp(g);
19 }
20
21 public short getB(int b) {
22 return noOp(b);
23 }
24
25 private short noOp(int v) {
26 if (outOfRange(v))
27 System.out.println("out of range! v=" + v);
28 if (v < 0) return 0;
29 if (v > 255) return 255;
30 return (short) 255;
31 }
32
33 private boolean outOfRange(int v) {
34 if (v < 0) return true;
35 if (v > 255) return true;
36 return false;
37 }
38
39 }
40