本文整理汇总了Java中javax.media.jai.ImageLayout.setHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ImageLayout.setHeight方法的具体用法?Java ImageLayout.setHeight怎么用?Java ImageLayout.setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.jai.ImageLayout
的用法示例。
在下文中一共展示了ImageLayout.setHeight方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: layoutHelper
import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
private static ImageLayout layoutHelper(RenderedImage source,
double scaleX,
double scaleY,
ImageLayout il) {
if(scaleX <= 0.0 || scaleX > 1.0) {
throw new IllegalArgumentException
(JaiI18N.getString("SubsampleAverageOpImage0"));
} else if(scaleY <= 0.0 || scaleY > 1.0) {
throw new IllegalArgumentException
(JaiI18N.getString("SubsampleAverageOpImage1"));
}
ImageLayout layout = (il == null) ?
new ImageLayout() : (ImageLayout)il.clone();
layout.setMinX((int)Math.floor(source.getMinX()*scaleX));
layout.setMinY((int)Math.floor(source.getMinY()*scaleY));
layout.setWidth((int)(source.getWidth()*scaleX));
layout.setHeight((int)(source.getHeight()*scaleY));
return layout;
}
示例2: crop
import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
private RenderedImage crop(RenderedImage source, Rectangle cropArea) {
ImageLayout layout = new ImageLayout();
layout.setMinX(cropArea.x);
layout.setMinY(cropArea.y);
layout.setWidth(cropArea.width);
layout.setHeight(cropArea.height);
return CropDescriptor.create(source, (float) cropArea.getX(), (float) cropArea.getY(),
(float) cropArea.getWidth(), (float) cropArea.getHeight(),
new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout)).getRendering();
}
示例3: layoutHelper
import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
* Sets up the image layout information for this Op.
* The minX, minY, width, and height are calculated based on
* the source's dimension and padding values. Any of these
* values specified in the layout parameter is ignored.
* All other variables are taken from the layout parameter or
* inherited from the source.
*/
private static ImageLayout layoutHelper(ImageLayout layout,
RenderedImage source,
int leftPad,
int rightPad,
int topPad,
int bottomPad) {
ImageLayout il = layout == null ?
new ImageLayout() : (ImageLayout)layout.clone();
// Set the image bounds according to the padding.
il.setMinX(source.getMinX() - leftPad);
il.setMinY(source.getMinY() - topPad);
il.setWidth(source.getWidth() + leftPad + rightPad);
il.setHeight(source.getHeight() + topPad + bottomPad);
// Set tile grid offset to minimize the probability that a
// tile's bounds does not intersect the source image bounds.
if(!il.isValid(ImageLayout.TILE_GRID_X_OFFSET_MASK)) {
il.setTileGridXOffset(il.getMinX(null));
}
if (!il.isValid(ImageLayout.TILE_GRID_Y_OFFSET_MASK)) {
il.setTileGridYOffset(il.getMinY(null));
}
// Force inheritance of source image SampleModel and ColorModel.
il.setSampleModel(source.getSampleModel());
il.setColorModel(source.getColorModel());
return il;
}
示例4: layoutHelper
import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/** <p> <code>layoutHelper</code> validates input and returns an
* <code>ImageLayout</code> object.
*
* @param source a RenderedImage object.
* @param interp an Interpolation object.
* @param scaleX an int downsample factor.
* @param scaleY an int downsample factor.
* @param filterSize an int representing the size of the combined
* filter and resample kernel.
* @param il an ImageLayout object.
* @return validated ImageLayout object.
*/
private static final ImageLayout layoutHelper(RenderedImage source,
Interpolation interp,
int scaleX,
int scaleY,
int filterSize,
ImageLayout il) {
if (scaleX < 1 || scaleY < 1 ) {
throw new IllegalArgumentException(
JaiI18N.getString("FilteredSubsample1"));
}
if (filterSize < 1) {
throw new IllegalArgumentException(
JaiI18N.getString("FilteredSubsample2"));
}
// Set the bounds to the scaled source bounds.
Rectangle bounds =
forwardMapRect(source.getMinX(), source.getMinY(),
source.getWidth(), source.getHeight(),
scaleX, scaleY);
// If the user has supplied a layout, use it
ImageLayout layout = (il == null) ?
new ImageLayout(bounds.x, bounds.y, bounds.width, bounds.height) :
(ImageLayout)il.clone();
// Override dimensions if user passed a hint
if (il != null) {
layout.setWidth(bounds.width);
layout.setHeight(bounds.height);
layout.setMinX(bounds.x);
layout.setMinY(bounds.y);
}
return layout;
}
示例5: layoutHelper
import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
* Force the destination image to be single-banded.
*/
private static ImageLayout layoutHelper(ImageLayout layout,
RenderedImage source) {
// Create or clone the layout.
ImageLayout il = layout == null ?
new ImageLayout() : (ImageLayout)layout.clone();
// Force the destination and source origins and dimensions to coincide.
il.setMinX(source.getMinX());
il.setMinY(source.getMinY());
il.setWidth(source.getWidth());
il.setHeight(source.getHeight());
// Get the SampleModel.
SampleModel sm = il.getSampleModel(source);
// Make sure that this OpImage is single-banded.
if (sm.getNumBands() != 1) {
sm =
RasterFactory.createComponentSampleModel(sm,
sm.getTransferType(),
sm.getWidth(),
sm.getHeight(),
1);
il.setSampleModel(sm);
}
il.setColorModel(null);
return il;
}
示例6: getImageLayout
import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
@Override
public ImageLayout getImageLayout(String name) throws IOException
{
log.fine("Getting JAI layout for: " + name);
if (!checkName(name)) {
throw new IllegalArgumentException("The specified coverage " + name + "is not found");
}
// get the pixel size of the base image
try
{
MrsImageDataProvider dp = DataProviderFactory
.getMrsImageDataProvider(name, DataProviderFactory.AccessMode.READ, providerProperties);
MrsPyramidMetadata meta = dp.getMetadataReader().read();
LongRectangle bounds = meta.getPixelBounds(meta.getMaxZoomLevel());
ImageLayout layout = new ImageLayout();
layout.setMinX(0);
layout.setMinY(0);
layout.setWidth((int)bounds.getWidth());
layout.setHeight((int)bounds.getHeight());
// only 1 tile!
layout.setTileGridXOffset(0);
layout.setTileGridYOffset(0);
layout.setTileWidth((int)bounds.getWidth());
layout.setTileHeight((int)bounds.getHeight());
MrsImageReader r = dp.getMrsTileReader(meta.getMaxZoomLevel());
final Iterator<MrGeoRaster> it = r.get();
try
{
Raster raster = it.next().toRaster();
layout.setColorModel(RasterUtils.createColorModel(raster));
layout.setSampleModel(raster.getSampleModel());
}
finally
{
if (!r.canBeCached() && it instanceof Closeable)
{
((Closeable) it).close();
r.close();
}
}
return layout;
}
catch (IOException e)
{
e.printStackTrace();
}
return null;
}
示例7: layoutHelper
import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
* Override the dimension specification for the destination such that it
* has width and height which are equal to non-negative powers of 2.
*/
private static ImageLayout layoutHelper(ImageLayout layout,
RenderedImage source) {
// Create an ImageLayout or clone the one passed in.
ImageLayout il = layout == null ?
new ImageLayout() : (ImageLayout)layout.clone();
// Force the origin to coincide with that of the source.
il.setMinX(source.getMinX());
il.setMinY(source.getMinY());
// Recalculate the non-unity dimensions to be a positive power of 2.
// XXX This calculation should not be effected if an implementation
// of the FCT which supports arbitrary dimensions is used.
boolean createNewSampleModel = false;
int w = il.getWidth(source);
if(w > 1) {
int newWidth = MathJAI.nextPositivePowerOf2(w);
if(newWidth != w) {
il.setWidth(w = newWidth);
createNewSampleModel = true;
}
}
int h = il.getHeight(source);
if(h > 1) {
int newHeight = MathJAI.nextPositivePowerOf2(h);
if(newHeight != h) {
il.setHeight(h = newHeight);
createNewSampleModel = true;
}
}
// Force the image to contain floating point data.
SampleModel sm = il.getSampleModel(source);
int dataType = sm.getTransferType();
if(dataType != DataBuffer.TYPE_FLOAT &&
dataType != DataBuffer.TYPE_DOUBLE) {
dataType = DataBuffer.TYPE_FLOAT;
createNewSampleModel = true;
}
// Create a new SampleModel for the destination.
if(createNewSampleModel) {
sm = RasterFactory.createComponentSampleModel(sm, dataType, w, h,
sm.getNumBands());
il.setSampleModel(sm);
// Clear the ColorModel mask if needed.
ColorModel cm = il.getColorModel(null);
if(cm != null &&
!JDKWorkarounds.areCompatibleDataModels(sm, cm)) {
// Clear the mask bit if incompatible.
il.unsetValid(ImageLayout.COLOR_MODEL_MASK);
}
}
return il;
}