/* 898 */ ParameterBlock pb = new ParameterBlock();
/* 899 */ pb.add(paramBlock.getObjectParameter(0)).add(res).add(subImage);
/* 900 */ RenderedImage iipRes = JAI.create("iipresolution", pb);
/* 901 */ Vector sources = new Vector(1);
/* 902 */ sources.add(iipRes);
/* 903 */ RenderableImage ri = new MultiResolutionRenderableImage(sources, 0.0F, 0.0F, 1.0F);
/* */
/* 908 */ if ((opMask & 0x1) != 0) {
/* 909 */ float filter = paramBlock.getFloatParameter(2);
/* 910 */ pb = new ParameterBlock().addSource(ri).add(filter);
/* 911 */ ri = new RenderableImageOp(new FilterCRIF(), pb);
/* */ }
/* */
/* 918 */ int nBands = iipRes.getSampleModel().getNumBands();
/* 919 */ if ((opMask & 0x2) != 0) {
/* 920 */ double[][] ctw = getColorTwistMatrix(iipRes.getColorModel(), paramBlock);
/* */
/* 922 */ pb = new ParameterBlock().addSource(ri).add(ctw);
/* 923 */ ri = JAI.createRenderable("bandcombine", pb);
/* 924 */ nBands = ctw.length;
/* */ }
/* */
/* 928 */ if ((opMask & 0x4) != 0) {
/* 929 */ int csType = iipRes.getColorModel().getColorSpace().getType();
/* 930 */ boolean isPYCC = (csType != 6) && (csType != 5);
/* */
/* 934 */ if (isPYCC)
/* */ {
/* */ double[][] matrix;
/* */ double[][] matrix;
/* 936 */ if (nBands == 3)
/* 937 */ matrix = composeMatrices(YCC_TO_RGB, YCC_TO_RGB_CONST);
/* */ else {
/* 939 */ matrix = composeMatrices(YCCA_TO_RGBA, YCCA_TO_RGBA_CONST);
/* */ }
/* 941 */ pb = new ParameterBlock().addSource(ri).add(matrix);
/* 942 */ ri = JAI.createRenderable("bandcombine", pb);
/* */ }
/* */
/* 945 */ float contrast = paramBlock.getFloatParameter(4);
/* 946 */ LookupTableJAI lut = createContrastLUT(contrast, nBands);
/* */
/* 948 */ pb = new ParameterBlock().addSource(ri).add(lut);
/* 949 */ ri = JAI.createRenderable("lookup", pb);
/* */
/* 951 */ if (isPYCC)
/* */ {
/* */ double[][] matrix;
/* */ double[][] matrix;
/* 953 */ if (nBands == 3)
/* 954 */ matrix = composeMatrices(RGB_TO_YCC, RGB_TO_YCC_CONST);
/* */ else {
/* 956 */ matrix = composeMatrices(RGBA_TO_YCCA, RGBA_TO_YCCA_CONST);
/* */ }
/* 958 */ pb = new ParameterBlock().addSource(ri).add(matrix);
/* 959 */ ri = JAI.createRenderable("bandcombine", pb);
/* */ }
/* */
/* */ }
/* */
/* 964 */ if ((opMask & 0x8) != 0)
/* */ {
/* 966 */ Rectangle2D rect = (Rectangle2D)paramBlock.getObjectParameter(5);
/* */
/* 969 */ if (!rect.intersects(0.0D, 0.0D, aspectRatioSource, 1.0D)) {
/* 970 */ throw new RuntimeException(JaiI18N.getString("IIPCRIF5"));
/* */ }
/* */
/* 974 */ Rectangle2D rectS = new Rectangle2D.Float(0.0F, 0.0F, aspectRatioSource, 1.0F);
/* */
/* 978 */ if (!rect.equals(rectS))
/* */ {
/* 980 */ rect = rect.createIntersection(rectS);
/* */
/* 983 */ pb = new ParameterBlock().addSource(ri);
/* 984 */ pb.add((float)rect.getMinX()).add((float)rect.getMinY());
/* 985 */ pb.add((float)rect.getWidth()).add((float)rect.getHeight());
/* 986 */ ri = JAI.createRenderable("crop", pb);
/* */ }
/* */
/* */ }
/* */
/* 999 */ if ((opMask & 0x10) != 0) {
/* 1000 */ AffineTransform afn = (AffineTransform)paramBlock.getObjectParameter(6);
/* */ try
/* */ {
/* 1004 */ afn = afn.createInverse();
/* */ }
/* */ catch (NoninvertibleTransformException e) {
/* 1007 */ listener.errorOccurred(JaiI18N.getString("AffineNotInvertible"), e, this, false);
/* */ }
/* */
/* 1011 */ pb = new ParameterBlock().addSource(ri).add(afn);
/* 1012 */ if ((hints != null) && (hints.containsKey(JAI.KEY_INTERPOLATION))) {
/* 1013 */ pb.add(hints.get(JAI.KEY_INTERPOLATION));
/* */ }
/* 1015 */ ri = JAI.createRenderable("affine", pb);
/* */ }
/* */
/* 1020 */ Rectangle2D rgn = (opMask & 0x40) != 0 ? (Rectangle2D)paramBlock.getObjectParameter(8) : bounds2D;
/* */
/* 1024 */ if (rgn.isEmpty()) {
/* 1025 */ throw new RuntimeException(JaiI18N.getString("IIPCRIF3"));
/* */ }
/* */
/* 1029 */ Rectangle2D riRect = new Rectangle2D.Float(ri.getMinX(), ri.getMinY(), ri.getWidth(), ri.getHeight());
/* */
/* 1036 */ if (!rgn.equals(riRect))
/* */ {
/* 1038 */ rgn = rgn.createIntersection(riRect);
/* */
/* 1041 */ pb = new ParameterBlock().addSource(ri);
/* 1042 */ pb.add((float)rgn.getMinX()).add((float)rgn.getMinY());
/* 1043 */ pb.add((float)rgn.getWidth()).add((float)rgn.getHeight());
/* 1044 */ ri = JAI.createRenderable("crop", pb);
/* */ }
/* */
/* 1048 */ return ri.createRendering(renderContext);
/* */ }