Java 8 IIOParam - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 IIOParam class.

This code example shows how to use the following methods:getSourceRegion, setSourceRegion
     *         <code>false</code> otherwise. 
     */ 
    static boolean checkEmptySourceRegion(final ImageReadParam readParameters,
            final Rectangle dimensions) {
        Utilities.ensureNonNull("readDimension", dimensions);
        Utilities.ensureNonNull("readP", readParameters);
        final Rectangle sourceRegion = readParameters.getSourceRegion();
        Rectangle.intersect(sourceRegion, dimensions, sourceRegion);
        if (sourceRegion.isEmpty())
            return true; 
        readParameters.setSourceRegion(sourceRegion);
        return false; 
    } 
 
    /** 
     * Checks that a {@link File} is a real file, exists and is readable. 
     *  
     * @param file 
     *            the {@link File} instance to check. Must not be null. 
     *  
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSourceBands, getSourceRegion, getSourceXSubsampling, getSourceYSubsampling, getSubsamplingXOffset
    public static void computeRegions(final Rectangle sourceBounds,
            Dimension destSize, ImageWriteParam param) {
        int periodX = 1;
        int periodY = 1;
        if (param != null) {
            final int[] sourceBands = param.getSourceBands();
            if (sourceBands != null
                    && (sourceBands.length != 1 || sourceBands[0] != 0)) {
                throw new IllegalArgumentException("Cannot sub-band image!");
                // TODO: Actually, sourceBands is ignored!! 
            } 
 
            // //////////////////////////////////////////////////////////////// 
            // 
            // Get source region and subsampling settings 
            // 
            // //////////////////////////////////////////////////////////////// 
            Rectangle sourceRegion = param.getSourceRegion();
            if (sourceRegion != null) {
                // Clip to actual image bounds 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setSourceSubsampling
This code example shows how to use the following methods:setSourceRegion
			 * 图片裁剪区域。Rectangle 指定了坐标空间中的一个区域,通过 Rectangle 对象 
			 * 的左上顶点的坐标(x,y)、宽度和高度可以定义这个区域。 
			 */ 
			Rectangle rect = new Rectangle(intX, intY, intWidth, intHeight);
			// 提供一个 BufferedImage,将其用作解码像素数据的目标。 
			param.setSourceRegion(rect);
			/** 
			 * 使用所提供的 ImageReadParam 读取通过索引 imageIndex 指定的对象,并将 它作为一个完整的 
			 * BufferedImage 返回。 
			 */ 
			BufferedImage bi = reader.read(0, param);
			// 保存新图片 
			ImageIO.write(bi, "jpg", new File(strDst));
		} finally { 
			if (is != null)
				is.close();
			if (iis != null)
				iis.close();
		} 
	} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSourceRegion
	public int[] getSourceBands() { 
		return adaptee.getSourceBands();
	} 
 
	public Rectangle getSourceRegion() {
		return adaptee.getSourceRegion();
	} 
 
	public int getSourceXSubsampling() { 
		return adaptee.getSourceXSubsampling();
	} 
 
	public int getSourceYSubsampling() { 
		return adaptee.getSourceYSubsampling();
	} 
 
	public int getSubsamplingXOffset() { 
		return adaptee.getSubsamplingXOffset();
	} 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDestinationType, getDestination
This code example shows how to use the following methods:setSourceRegion
    public void setSourceBands(int[] sourceBands) {
        adaptee.setSourceBands(sourceBands);
    } 
 
    public void setSourceRegion(Rectangle sourceRegion) {
        adaptee.setSourceRegion(sourceRegion);
    } 
 
    public void setSourceSubsampling(int sourceXSubsampling,
            int sourceYSubsampling, int subsamplingXOffset,
            int subsamplingYOffset) {
        adaptee.setSourceSubsampling(sourceXSubsampling, sourceYSubsampling,
                subsamplingXOffset, subsamplingYOffset);
    } 
 
    /** 
     *  
     */ 
    public GDALImageWriteParam(final ImageWriteParam adaptee,
            final GDALCreateOptionsHandler optionsHandler) {
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setSourceRegion
    public static void setup() throws FileNotFoundException {
        // Definition of the url 
        granuleUrl = TestData.url(ReadTypeTest.class, "img.tiff");
        // Definition of the parameters 
        readParameters = new TIFFImageReadParam();
        readParameters.setSourceRegion(new Rectangle(0, 0, 40, 20));
        // Definition of the rasterDimensions 
        rasterDimensions = new Rectangle(0, 0, 20, 20);
        // Wrong Raster Dimensions 
        rasterDimensionsWrong = new Rectangle(41, 21, 2, 2);
    } 
 
    @Test
    public void testJAIReadType() throws IOException {
        // Definition of the reader 
        ImageReader reader = new TIFFImageReaderSpi().createReaderInstance();
        FileImageInputStream in = new FileImageInputStream(DataUtilities.urlToFile(granuleUrl));
 
        try { 
            reader.setInput(in);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDestinationOffset, getSourceRegion, getSourceXSubsampling, getSourceYSubsampling, getSubsamplingXOffset
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSourceRegion
            // factors are computed as the ratio between the cropped source 
            // region sizes and the read image sizes. The translate 
            // settings are represented by the offsets of the source region. 
            // 
            // // 
            final Rectangle sourceRegion = imageReadParam.getSourceRegion();
            final double scaleX = sourceRegion.width / (1.0 * ssWidth);
            final double scaleY = sourceRegion.height / (1.0 * ssHeight);
            final double translateX = sourceRegion.x;
            final double translateY = sourceRegion.y;
            return createCoverageFromImage(image, ConcatenatedTransform.create(
                    ProjectiveTransform.create(new AffineTransform(scaleX, 0,
                            0, scaleY, translateX, translateY)), raster2Model));
        } else { 
            // In case of no transformation is required (As an instance, 
            // when reading the whole image) 
            return createCoverageFromImage(image);
        } 
    } 
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 IIOParam Methods: