public static void main(String[] args) { RenderedImage image = JAI.create("fileload", "estacaosp.jpg"); float scale=(float) 0.5; ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(scale); pb.add(scale); pb.add(1.0F); pb.add(1.0F); pb.add(new InterpolationNearest() );// ;InterpolationBilinear()); image = JAI.create("scale", pb); // Create an instance of DisplayJAI. DisplayJAI srcdj = new DisplayJAI(image); JScrollPane srcScrollPaneImage = new JScrollPane(srcdj); // Use a label to display the image JFrame frame = new JFrame(); frame.getContentPane().add(srcScrollPaneImage, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }
srcBounds = new Rectangle( src.getMinX() + interp.getLeftPadding(), src.getMinY() + interp.getTopPadding(), src.getWidth() - interp.getWidth() + 1, src.getHeight() - interp.getHeight() + 1); } else { srcBounds =
private Interpolation interpolation = new InterpolationNearest();
final InterpolationNearest nearest = new InterpolationNearest();
public void makeMosaic(String fileName) throws IOException{ // Make a black image in memory RenderedImage blackImage = ConstantDescriptor.create(256f,256f,new Byte[]{0x00,0x00,0x00},null); // Make a white image in memory RenderedImage whiteImage = ConstantDescriptor.create(256f, 256f, new Byte[]{(byte) 0xff, (byte) 0xff, (byte) 0xff},null); // Translate the white image to shift it 256 pixels to the right RenderedImage translatedWhiteImage = TranslateDescriptor.create(whiteImage, 256f, 0f, new InterpolationNearest(), null); // Now you can mosaic the two images. No need to supply an ImageLayout hint or pre-mosaic the black image. RenderedImage mosaic = MosaicDescriptor.create(new RenderedImage[]{blackImage,translatedWhiteImage}, MosaicDescriptor.MOSAIC_TYPE_OVERLAY, null, null, null, null, null); // Write out the output image. Should be 256 pixels tall and 512 pixels wide with black tile on left and white tile on right. ImageIO.write(mosaic, "PNG", new File(fileName)); }
interpolation != null ? interpolation : new InterpolationNearest();
@Override public void setValue(Object aValue) { this.value = null; this.expression = null; if (aValue instanceof LiteralExpressionImpl) { String displayName = ((Expression) aValue).toString(); if (InterpolationNearest.class.getSimpleName().compareTo(displayName) == 0) { value = new InterpolationNearest(); } else if (InterpolationBilinear.class.getSimpleName().compareTo(displayName) == 0) { value = new InterpolationBilinear(); } else if (displayName.startsWith(InterpolationBicubic2.class.getSimpleName())) { sampleBits = extractSampleBits(INTERPOLATION_BICUBIC2_PATTERN_MATCH, displayName); value = new InterpolationBicubic2(sampleBits); } else if (displayName.startsWith(InterpolationBicubic.class.getSimpleName())) { sampleBits = extractSampleBits(INTERPOLATION_BICUBIC_PATTERN_MATCH, displayName); value = new InterpolationBicubic(sampleBits); } } else if ((aValue instanceof AttributeExpressionImpl) || (aValue instanceof FunctionExpressionImpl) || (aValue instanceof MathExpressionImpl)) { this.expression = (Expression) aValue; } }
"ELEVATION", "An elevation value", List.class, null, false); static final Interpolation DEFAULT_INTERPOLATION = new InterpolationNearest();
pm.addSource(srcImage); pm.add(warp); pm.add(new InterpolationNearest());
public static RenderedImage rotateImage(RenderedImage image, int degree) { // Create the rotation angle and convert to radians. float angle = (float) (degree * (Math.PI / 180.0F)); // Create a ParameterBlock and specify the source and parameters ParameterBlock pb = new ParameterBlock(); pb.addSource(image); // The source image float centerX = image.getWidth() / 2f; float centerY = image.getHeight() / 2f; pb.add(centerX); // The x origin pb.add(centerY); // The y origin pb.add(angle); // The rotation angle pb.add(new InterpolationNearest()); // The interpolation // Create the rotate operation RenderedImage result = JAI.create("Rotate", pb, null); return result; }
image = renderer.renderImage(gc, rs, new InterpolationNearest(), null, 256, 256); assertNotNull(image); assertNotNull(PlanarImage.wrapRenderedImage(image));
pb.setParameter("scaleY", new Integer(downsampleStep)); pb.setParameter("qsFilterArray", lowPassFilter); pb.setParameter("Interpolation", new InterpolationNearest()); return JAI.create("filteredsubsample", pb,newHints);
break; case Nearest: newImage = Utils.subsample(currentImage,baseTC, new InterpolationNearest(),downsampleStep,borderExtender); break; default:
public static RenderedOp createRotateOp(RenderedImage src, double xOrigin, double yOrigin, double angle) { angle *= Math.PI / 180.0; ParameterBlock pb = new ParameterBlock(); pb.addSource(src); // The source image pb.add((float) xOrigin); // The x origin pb.add((float) yOrigin); // The y origin pb.add((float) angle); // The rotation angle in RAD pb.add(new javax.media.jai.InterpolationNearest()); // The interpolation return JAI.create("rotate", pb, null); }
if (doReprojection) { preSymbolizer = resample(preResample, destinationCRS, interpolation == null ? new InterpolationNearest() : interpolation, destinationEnvelope); if (LOGGER.isLoggable(Level.FINE))
public static RenderedOp createRectifyOp(RenderedImage src, int degree, RectificationGrid grid, Interpolation interp) { WarpPolynomial warp = WarpPolynomial.createWarp(grid.sourceCoords, 0, grid.destCoords, 0, grid.numCoords, 1.0F, 1.0F, 1.0F, 1.0F, degree); if (interp == null) { interp = new InterpolationNearest(); } ParameterBlock pb = new ParameterBlock(); pb.addSource(src); pb.add(warp); pb.add(interp); return JAI.create("warp", pb); }
param.parameter("scaleY").setValue(new Integer((int) scaleFactor)); param.parameter("qsFilterArray").setValue(new float[] { 0.5F, 1.0F / 3.0F, 0.0F,-1.0F / 12.0F }); param.parameter("Interpolation").setValue(new InterpolationNearest()); gc = (GridCoverage2D) CoverageToolsConstants.FILTERED_SUBSAMPLE_FACTORY.doOperation(param, new Hints()); } else if (scaleAlgorithm.equalsIgnoreCase("bil")) {
.resample(cov.coverage, extent.getEnvelope(), new InterpolationNearest()); .resample(this.coverage, this.crs, this.gridGeometry, new InterpolationNearest());
interp = new javax.media.jai.InterpolationNearest(); } else if (param instanceof InterpolationBilinear) { InterpolationBilinear bil = (InterpolationBilinear) param;
interp = new javax.media.jai.InterpolationNearest(); } else if (param instanceof InterpolationBilinear) { InterpolationBilinear bil = (InterpolationBilinear) param;