当前位置: 首页>>代码示例>>Java>>正文


Java RenderedOp.getData方法代码示例

本文整理汇总了Java中javax.media.jai.RenderedOp.getData方法的典型用法代码示例。如果您正苦于以下问题:Java RenderedOp.getData方法的具体用法?Java RenderedOp.getData怎么用?Java RenderedOp.getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.jai.RenderedOp的用法示例。


在下文中一共展示了RenderedOp.getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMosaicUpdate

import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
@Test
public void testMosaicUpdate() {
    final RenderedOp firstImage = MosaicDescriptor.create(Arrays.copyOf(sourceImages1, 3),
                                                          MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
                                                          Arrays.copyOf(alphaImages, 3), null, null, null, null);
    final PlanarImage[] alphaUpdateImages = {
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{6.0f}, null)),
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{4.0f}, null))
    };
    final RenderedImage[] sourceUpdateImages = {firstImage, sourceImages1[3]};
    final RenderedOp updatedImage = MosaicDescriptor.create(sourceUpdateImages,
                                                            MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
                                                            alphaUpdateImages, null, null, null, null);

    final Raster data = updatedImage.getData();
    float sample = data.getSampleFloat(0, 0, 0);
    assertEquals(2.0f, sample, 0.0f);
    sample = data.getSampleFloat(5, 5, 0);
    assertEquals(2.0f, sample, 0.0f);
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:21,代码来源:S2tbxMosaicOpImageTest.java

示例2: testMosaicUpdateWithNewSourceImages

import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
@Test
public void testMosaicUpdateWithNewSourceImages() {
    final RenderedOp firstImage = MosaicDescriptor.create(Arrays.copyOf(sourceImages2, 3),
            MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
            Arrays.copyOf(alphaImages, 3), null, null, null, null);
    final PlanarImage[] alphaUpdateImages = {
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{6.0f}, null)),
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{4.0f}, null))
    };
    final RenderedImage[] sourceUpdateImages = {firstImage, sourceImages2[3]};
    final RenderedOp updatedImage = MosaicDescriptor.create(sourceUpdateImages,
            MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
            alphaUpdateImages, null, null, null, null);

    final Raster data = updatedImage.getData();
    float sample = data.getSampleFloat(0, 0, 0);
    assertEquals(7.0f, sample, 0.0f);
    sample = data.getSampleFloat(5, 5, 0);
    assertEquals(7.0f, sample, 0.0f);
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:21,代码来源:S2tbxMosaicOpImageTest.java

示例3: testAveraging

import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
@Test
public void testAveraging() {

    final RenderedOp mosaicImage = MosaicDescriptor.create(sourceImages1, MosaicDescriptor.MOSAIC_TYPE_BLEND,
                                                           alphaImages, null, null, null, null);
    final Raster data = mosaicImage.getData();
    float sample = data.getSampleFloat(0, 0, 0);
    assertEquals(5.1f, sample, 0.0f);
    sample = data.getSampleFloat(5, 5, 0);
    assertEquals(5.1f, sample, 0.0f);
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:12,代码来源:S2tbxMosaicOpImageTest.java

示例4: rescaleImageViaPlanarImage

import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
private static BufferedImage rescaleImageViaPlanarImage(
		final Interpolation interpolation,
		final double rescaleX,
		final double rescaleY,
		final BufferedImage image ) {
	final PlanarImage planarImage = new TiledImage(
			image,
			image.getWidth(),
			image.getHeight());
	final ImageWorker w = new ImageWorker(
			planarImage);
	w.scale(
			(float) rescaleX,
			(float) rescaleY,
			0.0f,
			0.0f,
			interpolation);
	final RenderedOp result = w.getRenderedOperation();
	final Raster raster = result.getData();
	final WritableRaster scaledImageRaster;
	if (raster instanceof WritableRaster) {
		scaledImageRaster = (WritableRaster) raster;
	}
	else {
		scaledImageRaster = raster.createCompatibleWritableRaster();
		scaledImageRaster.setDataElements(
				0,
				0,
				raster);
	}
	final ColorModel colorModel = image.getColorModel();
	try {
		final BufferedImage scaledImage = new BufferedImage(
				colorModel,
				scaledImageRaster,
				image.isAlphaPremultiplied(),
				null);

		return scaledImage;
	}
	catch (final IllegalArgumentException e) {
		LOGGER.warn(
				"Unable to rescale image",
				e);
		return image;
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:48,代码来源:RasterUtils.java


注:本文中的javax.media.jai.RenderedOp.getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。