本文整理匯總了Java中java.awt.image.ConvolveOp.EDGE_ZERO_FILL屬性的典型用法代碼示例。如果您正苦於以下問題:Java ConvolveOp.EDGE_ZERO_FILL屬性的具體用法?Java ConvolveOp.EDGE_ZERO_FILL怎麽用?Java ConvolveOp.EDGE_ZERO_FILL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.image.ConvolveOp
的用法示例。
在下文中一共展示了ConvolveOp.EDGE_ZERO_FILL屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: enableConvolveOp
private static void enableConvolveOp(RenderQueue rq,
SurfaceData srcData,
ConvolveOp cop)
{
// assert rq.lock.isHeldByCurrentThread();
boolean edgeZero =
cop.getEdgeCondition() == ConvolveOp.EDGE_ZERO_FILL;
Kernel kernel = cop.getKernel();
int kernelWidth = kernel.getWidth();
int kernelHeight = kernel.getHeight();
int kernelSize = kernelWidth * kernelHeight;
int sizeofFloat = 4;
int totalBytesRequired = 4 + 8 + 12 + (kernelSize * sizeofFloat);
RenderBuffer buf = rq.getBuffer();
rq.ensureCapacityAndAlignment(totalBytesRequired, 4);
buf.putInt(ENABLE_CONVOLVE_OP);
buf.putLong(srcData.getNativeOps());
buf.putInt(edgeZero ? 1 : 0);
buf.putInt(kernelWidth);
buf.putInt(kernelHeight);
buf.put(kernel.getKernelData(null));
}
示例2: negativeBufferedImage
/**
* Negative the sourceImage
*
* @param sourceImage
* @return blurred output
*/
public BufferedImage negativeBufferedImage(Image sourceImage) {
// Create a buffered image from the source image with a format that's
// compatible with the screen
BufferedImage image = getImage(sourceImage);
float[] matrix1 = new float[16];
for (int i = 0; i < 16; i++) {
matrix1[i] = .20f;
}
// again, this time with feeling
BufferedImageOp op = new ConvolveOp(new Kernel(4, 4, matrix1),
ConvolveOp.EDGE_ZERO_FILL, null);
image = op.filter((BufferedImage) sourceImage, image);
BufferedImageOp op2 = new ConvolveOp(new Kernel(4, 4, matrix1),
ConvolveOp.EDGE_ZERO_FILL, null);
image = op2.filter(image, null);
return image;
}
示例3: overexposeBufferedImage
/**
* washes out the sourceImage as if overexposed
*
* @param sourceImage
* @return blurred output
*/
public BufferedImage overexposeBufferedImage(Image sourceImage) {
// Create a buffered image from the source image with a format that's
// compatible with the screen
BufferedImage image = getImage(sourceImage);
float[] matrix1 = new float[16];
for (int i = 0; i < 16; i++)
matrix1[i] = 1.0f / 3.0f;
// again, this time with feeling
BufferedImageOp op = new ConvolveOp(new Kernel(4, 4, matrix1),
ConvolveOp.EDGE_ZERO_FILL, null);
image = op.filter((BufferedImage) sourceImage, image);
return image;
}
示例4: blurBufferedImage
/**
* Blur the sourceImage
*
* @param sourceImage
* @return blurred output
*/
public BufferedImage blurBufferedImage(Image sourceImage) {
BufferedImage image = getImage(sourceImage);
int sqblurLevel = blurLevel * blurLevel;
float[] matrix = new float[sqblurLevel];
for (int i = 0; i < sqblurLevel; i++)
matrix[i] = 1.0f / sqblurLevel;
BufferedImageOp op = new ConvolveOp(new Kernel(blurLevel, blurLevel,
matrix), ConvolveOp.EDGE_ZERO_FILL, null);
image = op.filter((BufferedImage) sourceImage, image);
// and a quick soften blur over that
sqblurLevel = 16;
blurLevel = 4;
float[] matrix1 = new float[sqblurLevel];
for (int i = 0; i < sqblurLevel; i++)
matrix1[i] = IMGD1 / IMGD2;
BufferedImageOp op1 = new ConvolveOp(new Kernel(blurLevel, blurLevel,
matrix1), ConvolveOp.EDGE_ZERO_FILL, null);
image = op1.filter(image, null);
return image;
}
示例5: convolution
public static SerializableImage convolution(SerializableImage src, float[] matrix, int w, int h) {
BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), src.getType());
BufferedImageOp op = new ConvolveOp(new Kernel(w, h, matrix), ConvolveOp.EDGE_ZERO_FILL, new RenderingHints(null));
op.filter(src.getBufferedImage(), dst);
return new SerializableImage(dst);
}