private double[] getScalingParams(ParameterBlock paramBlock, boolean isScale2) { // Shearing is not taken into account. // params are ordered like this: scaleX, scaleY, transX, transY double[] scalingParams = new double[4]; for (int i = 0; i < 4; i++) { // Use proper datatype parameter getter depending on the type of operation scalingParams[i] = isScale2 ? paramBlock.getDoubleParameter(i) : paramBlock.getFloatParameter(i); } return scalingParams; }
source = paramBlock.getRenderedSource(0); float sx = paramBlock.getFloatParameter(0); float sy = paramBlock.getFloatParameter(1); float sWidth = paramBlock.getFloatParameter(2); float sHeight = paramBlock.getFloatParameter(3);
/** * Maps the output RenderContext into the RenderContext for the ith source. This method satisfies the implementation of CRIF. * * @param i The index of the source image. * @param renderContext The renderContext being applied to the operation. * @param paramBlock The ParameterBlock containing the sources and the translation factors. * @param image The RenderableImageOp from which this method was called. */ public RenderContext mapRenderContext(int i, RenderContext renderContext, ParameterBlock paramBlock, RenderableImage image) { float scale_x = paramBlock.getFloatParameter(0); float scale_y = paramBlock.getFloatParameter(1); float trans_x = paramBlock.getFloatParameter(2); float trans_y = paramBlock.getFloatParameter(3); AffineTransform scale = new AffineTransform(scale_x, 0.0, 0.0, scale_y, trans_x, trans_y); RenderContext RC = (RenderContext) renderContext.clone(); AffineTransform usr2dev = RC.getTransform(); usr2dev.concatenate(scale); RC.setTransform(usr2dev); return RC; }
/** * Maps the output RenderContext into the RenderContext for the ith source. This method satisfies the implementation of CRIF. * * @param i The index of the source image. * @param renderContext The renderContext being applied to the operation. * @param paramBlock The ParameterBlock containing the sources and the translation factors. * @param image The RenderableImageOp from which this method was called. */ public RenderContext mapRenderContext(int i, RenderContext renderContext, ParameterBlock paramBlock, RenderableImage image) { float scale_x = paramBlock.getFloatParameter(0); float scale_y = paramBlock.getFloatParameter(1); float trans_x = paramBlock.getFloatParameter(2); float trans_y = paramBlock.getFloatParameter(3); AffineTransform scale = new AffineTransform(scale_x, 0.0, 0.0, scale_y, trans_x, trans_y); RenderContext rc = (RenderContext) renderContext.clone(); AffineTransform usr2dev = rc.getTransform(); usr2dev.concatenate(scale); rc.setTransform(usr2dev); return rc; }
/** * Maps the output RenderContext into the RenderContext for the ith source. This method satisfies the implementation of CRIF. * * @param i The index of the source image. * @param renderContext The renderContext being applied to the operation. * @param paramBlock The ParameterBlock containing the sources and the translation factors. * @param image The RenderableImageOp from which this method was called. */ public RenderContext mapRenderContext(int i, RenderContext renderContext, ParameterBlock paramBlock, RenderableImage image) { float scale_x = paramBlock.getFloatParameter(0); float scale_y = paramBlock.getFloatParameter(1); float trans_x = paramBlock.getFloatParameter(2); float trans_y = paramBlock.getFloatParameter(3); AffineTransform scale = new AffineTransform(scale_x, 0.0, 0.0, scale_y, trans_x, trans_y); RenderContext rc = (RenderContext) renderContext.clone(); AffineTransform usr2dev = rc.getTransform(); usr2dev.concatenate(scale); rc.setTransform(usr2dev); return rc; }
/** * Maps the output RenderContext into the RenderContext for the ith source. This method satisfies the implementation of CRIF. * * @param i The index of the source image. * @param renderContext The renderContext being applied to the operation. * @param paramBlock The ParameterBlock containing the sources and the translation factors. * @param image The RenderableImageOp from which this method was called. */ public RenderContext mapRenderContext(int i, RenderContext renderContext, ParameterBlock paramBlock, RenderableImage image) { float scale_x = paramBlock.getFloatParameter(0); float scale_y = paramBlock.getFloatParameter(1); float trans_x = paramBlock.getFloatParameter(2); float trans_y = paramBlock.getFloatParameter(3); AffineTransform scale = new AffineTransform(scale_x, 0.0, 0.0, scale_y, trans_x, trans_y); RenderContext RC = (RenderContext) renderContext.clone(); AffineTransform usr2dev = RC.getTransform(); usr2dev.concatenate(scale); RC.setTransform(usr2dev); return RC; }
@Override public RenderedImage create(ParameterBlock parameterBlock, RenderingHints hints) { RenderedImage source = parameterBlock.getRenderedSource(0); float xTrans = parameterBlock.getFloatParameter(0); float yTrans = parameterBlock.getFloatParameter(1); // Get ImageLayout from renderHints if any. ImageLayout layout = RIFUtil.getImageLayoutHint(hints); // If there is a layout hint, TranslateIntOpImage can't deal with it if ((Math.abs(xTrans - (int) xTrans) < TOLERANCE) && (Math.abs(yTrans - (int) yTrans) < TOLERANCE) && layout == null) { return new TranslateIntOpImage(source, hints, (int) xTrans, (int) yTrans); } return null; }
/** * Gets the bounding box for the output of <code>ScaleOpImage</code>. This method satisfies the implementation of CRIF. */ public Rectangle2D getBounds2D(ParameterBlock paramBlock) { RenderableImage source = paramBlock.getRenderableSource(0); float scale_x = paramBlock.getFloatParameter(0); float scale_y = paramBlock.getFloatParameter(1); float trans_x = paramBlock.getFloatParameter(2); float trans_y = paramBlock.getFloatParameter(3); // Get the source dimensions float x0 = source.getMinX(); float y0 = source.getMinY(); float w = source.getWidth(); float h = source.getHeight(); // Forward map the source using x0, y0, w and h float d_x0 = x0 * scale_x + trans_x; float d_y0 = y0 * scale_y + trans_y; float d_w = w * scale_x; float d_h = h * scale_y; return new Rectangle2D.Float(d_x0, d_y0, d_w, d_h); }
float x = paramBlock.getFloatParameter(GTCropDescriptor.X_ARG); float y = paramBlock.getFloatParameter(GTCropDescriptor.Y_ARG); float width = paramBlock.getFloatParameter(GTCropDescriptor.WIDTH_ARG); float height = paramBlock.getFloatParameter(GTCropDescriptor.HEIGHT_ARG);
/** * Gets the bounding box for the output of <code>ScaleOpImage</code>. This method satisfies the implementation of CRIF. */ public Rectangle2D getBounds2D(ParameterBlock paramBlock) { RenderableImage source = paramBlock.getRenderableSource(0); float scale_x = paramBlock.getFloatParameter(0); float scale_y = paramBlock.getFloatParameter(1); float trans_x = paramBlock.getFloatParameter(2); float trans_y = paramBlock.getFloatParameter(3); // Get the source dimensions float x0 = source.getMinX(); float y0 = source.getMinY(); float w = source.getWidth(); float h = source.getHeight(); // Forward map the source using x0, y0, w and h float d_x0 = x0 * scale_x + trans_x; float d_y0 = y0 * scale_y + trans_y; float d_w = w * scale_x; float d_h = h * scale_y; return new Rectangle2D.Float(d_x0, d_y0, d_w, d_h); }
/** * Gets the bounding box for the output of <code>ScaleOpImage</code>. This method satisfies the implementation of CRIF. */ public Rectangle2D getBounds2D(ParameterBlock paramBlock) { RenderableImage source = paramBlock.getRenderableSource(0); float scale_x = paramBlock.getFloatParameter(0); float scale_y = paramBlock.getFloatParameter(1); float trans_x = paramBlock.getFloatParameter(2); float trans_y = paramBlock.getFloatParameter(3); // Get the source dimensions float x0 = source.getMinX(); float y0 = source.getMinY(); float w = source.getWidth(); float h = source.getHeight(); // Forward map the source using x0, y0, w and h float d_x0 = x0 * scale_x + trans_x; float d_y0 = y0 * scale_y + trans_y; float d_w = w * scale_x; float d_h = h * scale_y; return new Rectangle2D.Float(d_x0, d_y0, d_w, d_h); }
/** * Gets the bounding box for the output of <code>ScaleOpImage</code>. This method satisfies the implementation of CRIF. */ public Rectangle2D getBounds2D(ParameterBlock paramBlock) { RenderableImage source = paramBlock.getRenderableSource(0); float scale_x = paramBlock.getFloatParameter(0); float scale_y = paramBlock.getFloatParameter(1); float trans_x = paramBlock.getFloatParameter(2); float trans_y = paramBlock.getFloatParameter(3); // Get the source dimensions float x0 = source.getMinX(); float y0 = source.getMinY(); float w = source.getWidth(); float h = source.getHeight(); // Forward map the source using x0, y0, w and h float d_x0 = x0 * scale_x + trans_x; float d_y0 = y0 * scale_y + trans_y; float d_w = w * scale_x; float d_h = h * scale_y; return new Rectangle2D.Float(d_x0, d_y0, d_w, d_h); }
/** * Validates the input parameters. * * <p> In addition to the standard checks performed by the * superclass method, this method checks that "xScale" and "yScale" * are both greater than 0. */ protected boolean validateParameters(ParameterBlock args, StringBuffer msg) { if (!super.validateParameters(args, msg)) { return false; } float xScale = args.getFloatParameter(0); float yScale = args.getFloatParameter(1); ROI roi = null; if(args.getNumParameters() > 5 && args.getObjectParameter(5) != null){ roi = (ROI) args.getObjectParameter(5); } if ((xScale <= 0 || yScale <= 0) && roi == null) { msg.append(getName() + " " + JaiI18N.getString("ScaleDescriptor6")); return false; } return true; }
source = paramBlock.getRenderedSource(0); float sx = (float) paramBlock.getFloatParameter(0); float sy = (float) paramBlock.getFloatParameter(1);
/** * Validates the input parameters. * * <p> In addition to the standard checks performed by the * superclass method, this method checks that "xScale" and "yScale" * are both greater than 0. */ protected boolean validateParameters(ParameterBlock args, StringBuffer msg) { if (!super.validateParameters(args, msg)) { return false; } float xScale = args.getFloatParameter(0); float yScale = args.getFloatParameter(1); ROI roi = null; if(args.getNumParameters() > 5 && args.getObjectParameter(5) != null){ roi = (ROI) args.getObjectParameter(5); } if ((xScale <= 0 || yScale <= 0) && roi == null) { msg.append(getName() + " " + JaiI18N.getString("ScaleDescriptor6")); return false; } return true; }
float tx = pb.getFloatParameter(0); float ty = pb.getFloatParameter(1);
float xScale = paramBlock.getFloatParameter(3); float yScale = paramBlock.getFloatParameter(4); float xTrans = paramBlock.getFloatParameter(5); float yTrans = paramBlock.getFloatParameter(6); float destNoData = paramBlock.getFloatParameter(9);
float x = paramBlock.getFloatParameter(CropDescriptor.X_ARG); float y = paramBlock.getFloatParameter(CropDescriptor.Y_ARG); float width = paramBlock.getFloatParameter(CropDescriptor.WIDTH_ARG); float height = paramBlock.getFloatParameter(CropDescriptor.HEIGHT_ARG); ROI roi = (ROI) paramBlock.getObjectParameter(CropDescriptor.ROI_ARG); Range noData = (Range) paramBlock.getObjectParameter(CropDescriptor.NO_DATA_ARG);
float x = paramBlock.getFloatParameter(CropDescriptor.X_ARG); float y = paramBlock.getFloatParameter(CropDescriptor.Y_ARG); float width = paramBlock.getFloatParameter(CropDescriptor.WIDTH_ARG); float height = paramBlock.getFloatParameter(CropDescriptor.HEIGHT_ARG); ROI roi = (ROI) paramBlock.getObjectParameter(CropDescriptor.ROI_ARG); Range noData = (Range) paramBlock.getObjectParameter(CropDescriptor.NO_DATA_ARG);
RenderedImage sSource = paramBlock.getRenderedSource(0); float xScale = paramBlock.getFloatParameter(0); float yScale = paramBlock.getFloatParameter(1); float xTrans = paramBlock.getFloatParameter(2); float yTrans = paramBlock.getFloatParameter(3); Interpolation sInterp = (Interpolation)paramBlock.getObjectParameter(4);