001 /*
002 * ImageEffect.java
003 *
004 * Created on March 23, 2006, 4:12 PM
005 *
006 * To change this template, choose Tools | Template Manager
007 * and open the template in the editor.
008 */
009
010 package org.jdesktop.swingx.painter;
011
012 import java.awt.image.BufferedImage;
013 import java.awt.image.BufferedImageOp;
014 import org.jdesktop.swingx.JavaBean;
015
016 /**
017 *
018 * @author Richard
019 */
020 public class ImageEffect extends JavaBean implements Effect {
021 private BufferedImageOp op;
022
023 /**
024 * Creates a new instance of ImageEffect
025 */
026 public ImageEffect() {
027 }
028
029 public ImageEffect(BufferedImageOp op) {
030 this.op = op;
031 }
032
033 public void setOperation(BufferedImageOp op) {
034 BufferedImageOp old = getOperation();
035 this.op = op;
036 firePropertyChange("operation", old, getOperation());
037 }
038
039 public BufferedImageOp getOperation() {
040 return op;
041 }
042
043 public BufferedImage apply(BufferedImage image) {
044 if (op != null) {
045 image = op.filter(image, null);
046 }
047 return image;
048 }
049
050 }