本文整理汇总了Java中javax.media.jai.PlanarImage.getSampleModel方法的典型用法代码示例。如果您正苦于以下问题:Java PlanarImage.getSampleModel方法的具体用法?Java PlanarImage.getSampleModel怎么用?Java PlanarImage.getSampleModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.jai.PlanarImage
的用法示例。
在下文中一共展示了PlanarImage.getSampleModel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OrbitTiledImagePlanarImage
import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public OrbitTiledImagePlanarImage(PlanarImage image) throws Exception {
super("");
this.image = image;
this.width = image.getWidth();
this.height = image.getHeight();
this.tileWidth = image.getTileWidth();
this.tileHeight = image.getTileHeight();
this.tileGridXOffset = image.getTileGridXOffset();
this.tileGridYOffset = image.getTileGridYOffset();
this.minX = image.getMinX();
this.minY = image.getMinY();
this.numBands = image.getNumBands();
this.colorModel = image.getColorModel();
this.sampleModel = image.getSampleModel();
// if (numBands==1) this.colorModel = grayColorModel; else
// {
// this.colorModel = rgbColorModel;
// }
// this.colorModel = rgbColorModel; // an OrbitTiledImage is always a RGB image
// this.sampleModel = colorModel.createCompatibleSampleModel(tileWidth, tileHeight);
// bugfix 20.04.2012 Manuel: colorModel is now always defined by input image (overview image problem)
this.colorModel = image.getColorModel();
this.sampleModel = image.getSampleModel();
this.filename = "PlanarImage " + image.hashCode();
// better set useCache always to false here???
}
示例2: NDPIImageNative
import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public NDPIImageNative(String filename, int level) throws Exception {
super(filename, level, false);
logger.trace("loading NDPI image using native ndpi library: "+filename+" ["+level+"]");
BufferedImage bi = new BufferedImage(getTileWidth(), getTileHeight(), BufferedImage.TYPE_3BYTE_BGR);
PlanarImage image = PlanarImage.wrapRenderedImage(bi);
if (image.getSampleModel() != null && (!image.getSampleModel().equals(sampleModel))) {
this.sampleModel = image.getSampleModel();
}
if (level >= getNumLevels())
throw new OrbitImageServletException("level " + level + " >= numLevels (" + getNumLevels() + ")");
}
示例3: getTileData
import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
@Override
public Raster getTileData(int tileX, int tileY, boolean analysis) {
try {
byte[] data = null;
int i = 0;
while (data == null && i < NUM_TILE_TRIES) {
i++;
try {
data = getServer().getTile(filename, level, tileX, tileY);
} catch (Exception eio) {
logger.debug("error loading tile, retrying... (" + i + ")");
data = null;
long ms = GRIDMODE ? 5000 : 200;
Thread.sleep(ms);
}
}
if (GRIDMODE && data == null)
throw new RuntimeException("error loading tile (even after " + NUM_TILE_TRIES + " tries)");
//SeekableStream in = new ByteArraySeekableStream(data);
//BufferedImage bi = ImageIO.read(in);
BufferedImage bi = new BufferedImage(getTileWidth(), getTileHeight(), BufferedImage.TYPE_3BYTE_BGR);
// BufferedImage bi = new BufferedImage(getTileWidth(), getTileHeight(), BufferedImage.TYPE_INT_RGB);
getImageUtils().createImage(data, bi);
PlanarImage image = PlanarImage.wrapRenderedImage(bi);
if (image.getColorModel().getNumComponents() != 1) {
if (image.getSampleModel() != null && (!image.getSampleModel().equals(sampleModel))) {
this.sampleModel = image.getSampleModel();
}
} else {
originalWasGrayScale = true;
}
Raster r = image.getData().createTranslatedChild(PlanarImage.tileXToX(tileX, image.getTileGridXOffset(), tileWidth), PlanarImage.tileYToY(tileY, image.getTileGridYOffset(), tileHeight));
return r;
} catch (Exception e) {
return null;
}
}
示例4: getRenderingHints
import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
/**
* Defines RenderingHints for JAI create operations (otherwise JAI will use defaultTileSize tiling)
*
* @param image
* @return
*/
public static RenderingHints getRenderingHints(PlanarImage image) {
ImageLayout layout = new ImageLayout(image.getMinX(), image.getMinY(), image.getWidth(), image.getHeight(), image.getTileGridXOffset(), image.getTileGridYOffset(), image.getTileWidth(), image.getTileHeight(), image.getSampleModel(), image.getColorModel());
RenderingHints renderingHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
return renderingHints;
}