本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
}