本文整理汇总了Java中javax.media.jai.BorderExtender类的典型用法代码示例。如果您正苦于以下问题:Java BorderExtender类的具体用法?Java BorderExtender怎么用?Java BorderExtender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BorderExtender类属于javax.media.jai包,在下文中一共展示了BorderExtender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBorder
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* add a border to image
* @param thickness
* @param color
* @param borderType
*/
public void addBorder(int thickness, Color color, int borderType) throws ExpressionException{
double colorArray[] = {color.getRed(), color.getGreen(), color.getBlue()};
BorderExtender borderExtender = new BorderExtenderConstant(colorArray);
ParameterBlock params = new ParameterBlock();
params.addSource(image());
params.add(thickness);
params.add(thickness);
params.add(thickness);
params.add(thickness);
if(BORDER_TYPE_CONSTANT==borderType) params.add(borderExtender);
else params.add(BorderExtender.createInstance(borderType));
//else if(BORDER_TYPE_WRAP==borderType)params.add(BorderExtender.createInstance(BorderExtender.BORDER_REFLECT));
image((JAI.create("border", params)).getAsBufferedImage());
}
示例2: translate
import javax.media.jai.BorderExtender; //导入依赖的package包/类
public void translate(int xtrans, int ytrans, Object interpolation) throws ExpressionException {
RenderingHints hints = new RenderingHints(RenderingHints.KEY_INTERPOLATION,interpolation);
if(interpolation!=RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR) {
hints.add(new RenderingHints(JAI.KEY_BORDER_EXTENDER, BorderExtender.createInstance(1)));
}
ParameterBlock pb = new ParameterBlock();
pb.addSource(image());
BufferedImage img = JAI.create("translate", pb).getAsBufferedImage();
Graphics2D graphics = img.createGraphics();
graphics.clearRect(0, 0, img.getWidth(), img.getHeight());
AffineTransform at = new AffineTransform();
at.setToIdentity();
graphics.drawImage(image(), new AffineTransformOp(at, hints), xtrans, ytrans);
graphics.dispose();
image(img);
}
示例3: call
import javax.media.jai.BorderExtender; //导入依赖的package包/类
public static String call(PageContext pc, Object name, double thickness, String color, String strBorderType) throws PageException {
//if(name instanceof String) name=pc.getVariable(Caster.toString(name));
strBorderType=strBorderType.trim().toLowerCase();
int borderType=Image.BORDER_TYPE_CONSTANT;
if("zero".equals(strBorderType)) borderType=BorderExtender.BORDER_ZERO;
else if("constant".equals(strBorderType)) borderType=Image.BORDER_TYPE_CONSTANT;
else if("copy".equals(strBorderType)) borderType=BorderExtender.BORDER_COPY;
else if("reflect".equals(strBorderType)) borderType=BorderExtender.BORDER_REFLECT;
else if("wrap".equals(strBorderType)) borderType=BorderExtender.BORDER_WRAP;
Image image=Image.toImage(pc,name);
image.addBorder((int)thickness,ColorCaster.toColor(color),borderType);
return null;
}
示例4: blur
import javax.media.jai.BorderExtender; //导入依赖的package包/类
public void blur(int blurFactor) throws ExpressionException{
ParameterBlock params = new ParameterBlock();
params.addSource(image());
params.add(blurFactor);
RenderingHints hint= new RenderingHints(JAI.KEY_BORDER_EXTENDER,BorderExtender.createInstance(1));
image(JAI.create("boxfilter", params, hint).getAsBufferedImage());
}
示例5: computeTileStack
import javax.media.jai.BorderExtender; //导入依赖的package包/类
@Override
public void computeTileStack(Map<Band, Tile> targetTiles, Rectangle tarRec, ProgressMonitor pm) throws OperatorException {
Rectangle srcRec = new Rectangle(tarRec.x - OFF, tarRec.y - OFF, tarRec.width + BOX, tarRec.height + BOX);
BorderExtender borderExtender = BorderExtender.createInstance(BorderExtender.BORDER_ZERO);
Tile latTile = getSourceTile(aotProduct.getBand("latitude"), srcRec, borderExtender);
Tile aotTile = getSourceTile(aotProduct.getBand(AotConsts.aot.name), srcRec, borderExtender);
Tile aotErrTile = getSourceTile(aotProduct.getBand(AotConsts.aotErr.name), srcRec, borderExtender);
Tile tarAotTile = targetTiles.get(targetProduct.getBand(AotConsts.aot.name));
Tile tarAotErrTile = targetTiles.get(targetProduct.getBand(AotConsts.aotErr.name));
Tile tarAotFlagsTile = targetTiles.get(targetProduct.getBand(AotConsts.aotFlags.name));
double noDataVal = aotTile.getRasterDataNode().getGeophysicalNoDataValue();
float aotPixel;
float aotErrPixel;
for (int y = tarRec.y; y < tarRec.y + tarRec.height; y++) {
for (int x = tarRec.x; x < tarRec.x + tarRec.width; x++) {
double climAot = calcClimAot(latTile.getSampleFloat(x, y));
aotPixel = aotTile.getSampleFloat(x, y);
aotErrPixel = aotErrTile.getSampleFloat(x, y);
if (Double.compare(noDataVal, aotPixel) != 0) {
tarAotTile.setSample(x, y, aotPixel);
tarAotErrTile.setSample(x, y, aotErrPixel);
tarAotFlagsTile.setSample(x, y, 0);
} else {
float[] fillResult = new float[2];
int flagPixel = fillPixel(x, y, aotTile, aotErrTile, climAot, noDataVal, fillResult);
tarAotTile.setSample(x, y, fillResult[0]);
tarAotErrTile.setSample(x, y, fillResult[1]);
tarAotFlagsTile.setSample(x, y, flagPixel);
}
}
}
}
示例6: Convolve3x3OpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Creates a Convolve3x3OpImage given a ParameterBlock containing the image
* source and a pre-rotated convolution kernel. The image dimensions
* are derived
* from the source image. The tile grid layout, SampleModel, and
* ColorModel may optionally be specified by an ImageLayout
* object.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param kernel the pre-rotated convolution KernelJAI.
* @param cobbleSources a boolean indicating whether computeRect()
* expects contiguous sources.
*/
public Convolve3x3OpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
KernelJAI kernel) {
super(source,
layout,
config,
true,
extender,
kernel.getLeftPadding(),
kernel.getRightPadding(),
kernel.getTopPadding(),
kernel.getBottomPadding());
this.kernel = kernel;
if ((kernel.getWidth() != 3) ||
(kernel.getHeight() != 3) ||
(kernel.getXOrigin() != 1) ||
(kernel.getYOrigin() != 1)) {
throw new RuntimeException(JaiI18N.getString("Convolve3x3OpImage0"));
}
if (sampleModel.getDataType() == DataBuffer.TYPE_BYTE) {
float kdata[] = kernel.getKernelData();
float k0 = kdata[0],
k1 = kdata[1],
k2 = kdata[2],
k3 = kdata[3],
k4 = kdata[4],
k5 = kdata[5],
k6 = kdata[6],
k7 = kdata[7],
k8 = kdata[8];
for (int j = 0; j < 256; j++) {
byte b = (byte)j;
float f = (float)j;
tables[0][b+128] = k0*f+0.5f;
tables[1][b+128] = k1*f;
tables[2][b+128] = k2*f;
tables[3][b+128] = k3*f;
tables[4][b+128] = k4*f;
tables[5][b+128] = k5*f;
tables[6][b+128] = k6*f;
tables[7][b+128] = k7*f;
tables[8][b+128] = k8*f;
}
}
}
示例7: DilateOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Creates a DilateOpImage given a ParameterBlock containing the image
* source and pre-rotated dilation kernel. The image dimensions are
* derived
* from the source image. The tile grid layout, SampleModel, and
* ColorModel may optionally be specified by an ImageLayout
* object.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param kernel the pre-rotated dilation KernelJAI.
*/
public DilateOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
KernelJAI kernel) {
super(source,
layout,
config,
true,
extender,
kernel.getLeftPadding(),
kernel.getRightPadding(),
kernel.getTopPadding(),
kernel.getBottomPadding());
this.kernel = kernel;
kw = kernel.getWidth();
kh = kernel.getHeight();
kx = kernel.getXOrigin();
ky = kernel.getYOrigin();
kdata = kernel.getKernelData();
}
示例8: AffineBicubicOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Constructs an AffineBicubicOpImage from a RenderedImage source,
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param interp an Interpolation object to use for resampling
* @param transform the desired AffineTransform.
*/
public AffineBicubicOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
AffineTransform transform,
Interpolation interp,
double[] backgroundValues) {
super(source,
extender,
config,
layout,
transform,
interp,
backgroundValues);
}
示例9: MinFilterOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Creates a MinFilterOpImage given an image source, an
* optional BorderExtender, a maskType and maskSize. The image
* dimensions are derived the source image. The tile grid layout,
* SampleModel, and ColorModel may optionally be specified by an
* ImageLayout object.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param maskType the filter mask type.
* @param maskSize the filter mask size.
*/
public MinFilterOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
MinFilterShape maskType,
int maskSize) {
super(source,
layout,
config,
true,
extender,
(maskSize-1)/2,
(maskSize-1)/2,
(maskSize/2),
(maskSize/2));
this.maskType = maskType;
this.maskSize = maskSize;
}
示例10: MedianFilterOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Creates a MedianFilterOpImage given an image source, an
* optional BorderExtender, a maskType and maskSize. The image
* dimensions are derived the source image. The tile grid layout,
* SampleModel, and ColorModel may optionally be specified by an
* ImageLayout object.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param maskType the filter mask type.
* @param maskSize the filter mask size.
*/
public MedianFilterOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
MedianFilterShape maskType,
int maskSize) {
super(source,
layout,
config,
true,
extender,
(maskSize-1)/2,
(maskSize-1)/2,
(maskSize/2),
(maskSize/2));
this.maskType = maskType;
this.maskSize = maskSize;
}
示例11: AffineBilinearOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Constructs an AffineBilinearOpImage from a RenderedImage source,
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param interp an Interpolation object to use for resampling
* @param transform the desired AffineTransform.
*/
public AffineBilinearOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
AffineTransform transform,
Interpolation interp,
double[] backgroundValues) {
super(source,
extender,
config,
layout,
transform,
interp,
backgroundValues);
}
示例12: MaxFilterOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Creates a MaxFilterOpImage given an image source, an
* optional BorderExtender, a maskType and maskSize. The image
* dimensions are derived the source image. The tile grid layout,
* SampleModel, and ColorModel may optionally be specified by an
* ImageLayout object.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param maskType the filter mask type.
* @param maskSize the filter mask size.
*/
public MaxFilterOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
MaxFilterShape maskType,
int maskSize) {
super(source,
layout,
config,
true,
extender,
(maskSize-1)/2,
(maskSize-1)/2,
(maskSize/2),
(maskSize/2));
this.maskType = maskType;
this.maskSize = maskSize;
}
示例13: DilateBinaryOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Creates a DilateBinaryOpImage given a ParameterBlock containing the
* image source and pre-rotated dilation kernel. The image dimensions
* are derived from the source image. The tile grid layout, SampleModel,
* and ColorModel may optionally be specified by an ImageLayout object.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param kernel the pre-rotated dilation KernelJAI.
*/
public DilateBinaryOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
KernelJAI kernel) {
super(source,
layout,
configHelper(config),
true,
extender,
kernel.getLeftPadding(),
kernel.getRightPadding(),
kernel.getTopPadding(),
kernel.getBottomPadding());
this.kernel = kernel;
kw = kernel.getWidth();
kh = kernel.getHeight();
kx = kernel.getXOrigin();
ky = kernel.getYOrigin();
kwPack = (kw+31)/32;
kdataPack = packKernel(kernel);
}
示例14: ConvolveOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Creates a ConvolveOpImage given a ParameterBlock containing the image
* source and pre-rotated convolution kernel. The image dimensions are
* derived
* from the source image. The tile grid layout, SampleModel, and
* ColorModel may optionally be specified by an ImageLayout
* object.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param kernel the pre-rotated convolution KernelJAI.
*/
public ConvolveOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
KernelJAI kernel) {
super(source,
layout,
config,
true,
extender,
kernel.getLeftPadding(),
kernel.getRightPadding(),
kernel.getTopPadding(),
kernel.getBottomPadding());
this.kernel = kernel;
kw = kernel.getWidth();
kh = kernel.getHeight();
kx = kernel.getXOrigin();
ky = kernel.getYOrigin();
}
示例15: BorderOpImage
import javax.media.jai.BorderExtender; //导入依赖的package包/类
/**
* Constructor.
*
* @param source The source image.
* @param layout The destination image layout.
* @param leftPad The amount of padding to the left of the source.
* @param rightPad The amount of padding to the right of the source.
* @param topPad The amount of padding to the top of the source.
* @param bottomPad The amount of padding to the bottom of the source.
* @param type The border type.
* @param constants The constants used with border type
* <code>BorderDescriptor.BORDER_CONST_FILL</code>,
* stored as reference.
*/
public BorderOpImage(RenderedImage source,
Map config,
ImageLayout layout,
int leftPad,
int rightPad,
int topPad,
int bottomPad,
BorderExtender extender) {
super(vectorize(source),
layoutHelper(layout, source,
leftPad, rightPad, topPad, bottomPad),
config, true);
this.extender = extender;
}