1 package com.octo.captcha.component.image.deformation; 2 3 import java.awt.image.BufferedImage; 4 import java.awt.image.BufferedImageOp; 5 import java.util.List; 6 import java.util.ArrayList; 7 8 /*** 9 * @author mag 10 * @Date 5 mars 2008 11 */ 12 public class ImageDeformationByBufferedImageOp implements ImageDeformation{ 13 14 private List<BufferedImageOp> ImageOperations = new ArrayList<BufferedImageOp>(); 15 16 public void setImageOperations(List<BufferedImageOp> imageOperations) { 17 ImageOperations = imageOperations; 18 } 19 20 public ImageDeformationByBufferedImageOp(List<BufferedImageOp> imageOperations) { 21 ImageOperations = imageOperations; 22 } 23 24 public ImageDeformationByBufferedImageOp(BufferedImageOp imageOperation) { 25 ImageOperations.add(imageOperation); 26 } 27 28 public BufferedImage deformImage(BufferedImage image) { 29 for(BufferedImageOp operation:ImageOperations){ 30 image = operation.filter(image, null); 31 } 32 return image; 33 } 34 }