01: /*
02: * ImageEffect.java
03: *
04: * Created on March 23, 2006, 4:12 PM
05: *
06: * To change this template, choose Tools | Template Manager
07: * and open the template in the editor.
08: */
09:
10: package org.jdesktop.swingx.painter;
11:
12: import java.awt.image.BufferedImage;
13: import java.awt.image.BufferedImageOp;
14: import org.jdesktop.beans.AbstractBean;
15:
16: /**
17: *
18: * @author Richard
19: */
20: public class ImageEffect extends AbstractBean implements Effect {
21: private BufferedImageOp op;
22:
23: /**
24: * Creates a new instance of ImageEffect
25: */
26: public ImageEffect() {
27: }
28:
29: public ImageEffect(BufferedImageOp op) {
30: this .op = op;
31: }
32:
33: public void setOperation(BufferedImageOp op) {
34: BufferedImageOp old = getOperation();
35: this .op = op;
36: firePropertyChange("operation", old, getOperation());
37: }
38:
39: public BufferedImageOp getOperation() {
40: return op;
41: }
42:
43: public BufferedImage apply(BufferedImage image) {
44: if (op != null) {
45: image = op.filter(image, null);
46: }
47: return image;
48: }
49:
50: }
|