1 /* Copyright (C) 2005-2011 Fabio Riccardi */
2 
3 package com.lightcrafts.jai.opimage;
4 
5 import com.lightcrafts.media.jai.opimage.RIFUtil;
6 
7 import com.lightcrafts.mediax.jai.ImageLayout;
8 import com.lightcrafts.mediax.jai.CRIFImpl;
9 import com.lightcrafts.mediax.jai.ROI;
10 
11 import java.awt.image.RenderedImage;
12 import java.awt.image.renderable.ParameterBlock;
13 import java.awt.*;
14 
15 /**
16  * Created by IntelliJ IDEA.
17  * User: fabio
18  * Date: Apr 1, 2005
19  * Time: 10:14:47 AM
20  * To change this template use File | Settings | File Templates.
21  */
22 public class BlendCRIF extends CRIFImpl {
23 
24     /** Constructor. */
BlendCRIF()25     public BlendCRIF() {
26         super("blend");
27     }
28 
29     /**
30      * Creates a new instance of <code>BlendOpImage</code> in the rendered
31      * layer. This method satisfies the implementation of RIF.
32      *
33      * @param paramBlock   The two source images to be blended and the blending mode.
34      * @param renderHints  Optionally contains destination image layout.
35      */
create(ParameterBlock paramBlock, RenderingHints renderHints)36     public RenderedImage create(ParameterBlock paramBlock,
37                                 RenderingHints renderHints) {
38         // Get ImageLayout from renderHints if any.
39         ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
40 
41         return new BlendOpImage(paramBlock.getRenderedSource(0),
42                                 paramBlock.getRenderedSource(1),
43                                 (String) paramBlock.getObjectParameter(0),
44                                 (Double) paramBlock.getObjectParameter(1),
45                                 (ROI) paramBlock.getObjectParameter(2),
46                                 (RenderedImage) paramBlock.getObjectParameter(3),
47                                 renderHints,
48                                 layout);
49     }
50 }
51