本文整理汇总了Java中java.awt.image.Kernel.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Kernel.getHeight方法的具体用法?Java Kernel.getHeight怎么用?Java Kernel.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.Kernel
的用法示例。
在下文中一共展示了Kernel.getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableConvolveOp
import java.awt.image.Kernel; //导入方法依赖的package包/类
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: convolve
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve a block of pixels.
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction)
{
if(kernel.getHeight() == 1)
{
convolveH(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
}
else if(kernel.getWidth() == 1)
{
convolveV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
}
else
{
convolveHV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
}
}
示例3: isConvolveOpValid
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**************************** ConvolveOp support ****************************/
public static boolean isConvolveOpValid(ConvolveOp cop) {
Kernel kernel = cop.getKernel();
int kw = kernel.getWidth();
int kh = kernel.getHeight();
// REMIND: we currently can only handle 3x3 and 5x5 kernels,
// but hopefully this is just a temporary restriction;
// see native shader comments for more details
if (!(kw == 3 && kh == 3) && !(kw == 5 && kh == 5)) {
return false;
}
return true;
}
示例4: convolve
import java.awt.image.Kernel; //导入方法依赖的package包/类
public static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
if (kernel.getHeight() == 1)
convolveH(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
else if (kernel.getWidth() == 1)
convolveV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
else
convolveHV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
}
示例5: convolveHV
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve with a 2D kernel
*
* @param kernel the kernel to apply
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width of the image
* @param height the height of the image
* @param alpha whether alpha is present
* @param edgeAction one of the edge constants
*/
public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData( null );
int rows = kernel.getHeight();
int cols = kernel.getWidth();
int rows2 = rows/2;
int cols2 = cols/2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
for (int row = -rows2; row <= rows2; row++) {
int iy = y+row;
int ioffset;
if (0 <= iy && iy < height)
ioffset = iy*width;
else if ( edgeAction == CLAMP_EDGES )
ioffset = y*width;
else if ( edgeAction == WRAP_EDGES )
ioffset = ((iy+height) % height) * width;
else
continue;
int moffset = cols*(row+rows2)+cols2;
for (int col = -cols2; col <= cols2; col++) {
float f = matrix[moffset+col];
if (f != 0) {
int ix = x+col;
if (!(0 <= ix && ix < width)) {
if ( edgeAction == CLAMP_EDGES )
ix = x;
else if ( edgeAction == WRAP_EDGES )
ix = (x+width) % width;
else
continue;
}
int rgb = inPixels[ioffset+ix];
a += f * ((rgb >> 24) & 0xff);
r += f * ((rgb >> 16) & 0xff);
g += f * ((rgb >> 8) & 0xff);
b += f * (rgb & 0xff);
}
}
}
int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff;
int ir = PixelUtils.clamp((int)(r+0.5));
int ig = PixelUtils.clamp((int)(g+0.5));
int ib = PixelUtils.clamp((int)(b+0.5));
outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib;
}
}
}
示例6: convolveV
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve with a kernel consisting of one column
* @param kernel the kernel to apply
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width of the image
* @param height the height of the image
* @param alpha whether alpha is present
* @param edgeAction one of the edge constants
*/
public static void convolveV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData( null );
int rows = kernel.getHeight();
int rows2 = rows/2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
for (int row = -rows2; row <= rows2; row++) {
int iy = y+row;
int ioffset;
if ( iy < 0 ) {
if ( edgeAction == CLAMP_EDGES )
ioffset = 0;
else if ( edgeAction == WRAP_EDGES )
ioffset = ((y+height) % height)*width;
else
ioffset = iy*width;
} else if ( iy >= height) {
if ( edgeAction == CLAMP_EDGES )
ioffset = (height-1)*width;
else if ( edgeAction == WRAP_EDGES )
ioffset = ((y+height) % height)*width;
else
ioffset = iy*width;
} else
ioffset = iy*width;
float f = matrix[row+rows2];
if (f != 0) {
int rgb = inPixels[ioffset+x];
a += f * ((rgb >> 24) & 0xff);
r += f * ((rgb >> 16) & 0xff);
g += f * ((rgb >> 8) & 0xff);
b += f * (rgb & 0xff);
}
}
int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff;
int ir = PixelUtils.clamp((int)(r+0.5));
int ig = PixelUtils.clamp((int)(g+0.5));
int ib = PixelUtils.clamp((int)(b+0.5));
outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib;
}
}
}
示例7: convolveHV
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve with a 2D kernel.
*
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData(null);
int rows = kernel.getHeight();
int cols = kernel.getWidth();
int rows2 = rows / 2;
int cols2 = cols / 2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
for (int row = -rows2; row <= rows2; row++) {
int iy = y + row;
int ioffset;
if (0 <= iy && iy < height) {
ioffset = iy * width;
} else if (edgeAction == CLAMP_EDGES) {
ioffset = y * width;
} else if (edgeAction == WRAP_EDGES) {
ioffset = ((iy + height) % height) * width;
} else {
continue;
}
int moffset = cols * (row + rows2) + cols2;
for (int col = -cols2; col <= cols2; col++) {
float f = matrix[moffset + col];
if (f != 0) {
int ix = x + col;
if (!(0 <= ix && ix < width)) {
if (edgeAction == CLAMP_EDGES) {
ix = x;
} else if (edgeAction == WRAP_EDGES) {
ix = (x + width) % width;
} else {
continue;
}
}
int rgb = inPixels[ioffset + ix];
a += f * ((rgb >> 24) & 0xff);
r += f * ((rgb >> 16) & 0xff);
g += f * ((rgb >> 8) & 0xff);
b += f * (rgb & 0xff);
}
}
}
int ia = alpha ? PixelUtils.clamp((int) (a + 0.5)) : 0xff;
int ir = PixelUtils.clamp((int) (r + 0.5));
int ig = PixelUtils.clamp((int) (g + 0.5));
int ib = PixelUtils.clamp((int) (b + 0.5));
outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib;
}
}
}
示例8: convolveV
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve with a kernel consisting of one column.
*
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolveV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData(null);
int rows = kernel.getHeight();
int rows2 = rows / 2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
for (int row = -rows2; row <= rows2; row++) {
int iy = y + row;
int ioffset;
if (iy < 0) {
if (edgeAction == CLAMP_EDGES) {
ioffset = 0;
} else if (edgeAction == WRAP_EDGES) {
ioffset = ((y + height) % height) * width;
} else {
ioffset = iy * width;
}
} else if (iy >= height) {
if (edgeAction == CLAMP_EDGES) {
ioffset = (height - 1) * width;
} else if (edgeAction == WRAP_EDGES) {
ioffset = ((y + height) % height) * width;
} else {
ioffset = iy * width;
}
} else {
ioffset = iy * width;
}
float f = matrix[row + rows2];
if (f != 0) {
int rgb = inPixels[ioffset + x];
a += f * ((rgb >> 24) & 0xff);
r += f * ((rgb >> 16) & 0xff);
g += f * ((rgb >> 8) & 0xff);
b += f * (rgb & 0xff);
}
}
int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff;
int ir = PixelUtils.clamp((int)(r+0.5));
int ig = PixelUtils.clamp((int)(g+0.5));
int ib = PixelUtils.clamp((int)(b+0.5));
outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib;
}
}
}
示例9: convolveHV
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve with a 2D kernel.
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData( null );
int rows = kernel.getHeight();
int cols = kernel.getWidth();
int rows2 = rows/2;
int cols2 = cols/2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
for (int row = -rows2; row <= rows2; row++) {
int iy = y+row;
int ioffset;
if (0 <= iy && iy < height)
ioffset = iy*width;
else if ( edgeAction == CLAMP_EDGES )
ioffset = y*width;
else if ( edgeAction == WRAP_EDGES )
ioffset = ((iy+height) % height) * width;
else
continue;
int moffset = cols*(row+rows2)+cols2;
for (int col = -cols2; col <= cols2; col++) {
float f = matrix[moffset+col];
if (f != 0) {
int ix = x+col;
if (!(0 <= ix && ix < width)) {
if ( edgeAction == CLAMP_EDGES )
ix = x;
else if ( edgeAction == WRAP_EDGES )
ix = (x+width) % width;
else
continue;
}
int rgb = inPixels[ioffset+ix];
a += f * ((rgb >> 24) & 0xff);
r += f * ((rgb >> 16) & 0xff);
g += f * ((rgb >> 8) & 0xff);
b += f * (rgb & 0xff);
}
}
}
int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff;
int ir = PixelUtils.clamp((int)(r+0.5));
int ig = PixelUtils.clamp((int)(g+0.5));
int ib = PixelUtils.clamp((int)(b+0.5));
outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib;
}
}
}
示例10: convolveV
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve with a kernel consisting of one column.
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolveV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData( null );
int rows = kernel.getHeight();
int rows2 = rows/2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
for (int row = -rows2; row <= rows2; row++) {
int iy = y+row;
int ioffset;
if ( iy < 0 ) {
if ( edgeAction == CLAMP_EDGES )
ioffset = 0;
else if ( edgeAction == WRAP_EDGES )
ioffset = ((y+height) % height)*width;
else
ioffset = iy*width;
} else if ( iy >= height) {
if ( edgeAction == CLAMP_EDGES )
ioffset = (height-1)*width;
else if ( edgeAction == WRAP_EDGES )
ioffset = ((y+height) % height)*width;
else
ioffset = iy*width;
} else
ioffset = iy*width;
float f = matrix[row+rows2];
if (f != 0) {
int rgb = inPixels[ioffset+x];
a += f * ((rgb >> 24) & 0xff);
r += f * ((rgb >> 16) & 0xff);
g += f * ((rgb >> 8) & 0xff);
b += f * (rgb & 0xff);
}
}
int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff;
int ir = PixelUtils.clamp((int)(r+0.5));
int ig = PixelUtils.clamp((int)(g+0.5));
int ib = PixelUtils.clamp((int)(b+0.5));
outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib;
}
}
}
示例11: convolveHV
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve with a 2D kernel.
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData( null );
int rows = kernel.getHeight();
int cols = kernel.getWidth();
int rows2 = rows/2;
int cols2 = cols/2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
for (int row = -rows2; row <= rows2; row++) {
int iy = y+row;
int ioffset;
if (0 <= iy && iy < height) {
ioffset = iy*width;
} else if ( edgeAction == CLAMP_EDGES ) {
ioffset = y*width;
} else if ( edgeAction == WRAP_EDGES ) {
ioffset = ((iy+height) % height) * width;
} else {
continue;
}
int moffset = cols*(row+rows2)+cols2;
for (int col = -cols2; col <= cols2; col++) {
float f = matrix[moffset+col];
if (f != 0) {
int ix = x+col;
if (!(0 <= ix && ix < width)) {
if ( edgeAction == CLAMP_EDGES ) {
ix = x;
} else if ( edgeAction == WRAP_EDGES ) {
ix = (x+width) % width;
} else {
continue;
}
}
int rgb = inPixels[ioffset+ix];
a += f * ((rgb >> 24) & 0xff);
r += f * ((rgb >> 16) & 0xff);
g += f * ((rgb >> 8) & 0xff);
b += f * (rgb & 0xff);
}
}
}
int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff;
int ir = PixelUtils.clamp((int)(r+0.5));
int ig = PixelUtils.clamp((int)(g+0.5));
int ib = PixelUtils.clamp((int)(b+0.5));
outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib;
}
}
}
示例12: convolveV
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve with a kernel consisting of one column.
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolveV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData( null );
int rows = kernel.getHeight();
int rows2 = rows/2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
for (int row = -rows2; row <= rows2; row++) {
int iy = y+row;
int ioffset;
if ( iy < 0 ) {
if ( edgeAction == CLAMP_EDGES ) {
ioffset = 0;
} else if ( edgeAction == WRAP_EDGES ) {
ioffset = ((y+height) % height)*width;
} else {
ioffset = iy*width;
}
} else if ( iy >= height) {
if ( edgeAction == CLAMP_EDGES ) {
ioffset = (height-1)*width;
} else if ( edgeAction == WRAP_EDGES ) {
ioffset = ((y+height) % height)*width;
} else {
ioffset = iy*width;
}
} else {
ioffset = iy*width;
}
float f = matrix[row+rows2];
if (f != 0) {
int rgb = inPixels[ioffset+x];
a += f * ((rgb >> 24) & 0xff);
r += f * ((rgb >> 16) & 0xff);
g += f * ((rgb >> 8) & 0xff);
b += f * (rgb & 0xff);
}
}
int ia = alpha ? PixelUtils.clamp((int)(a+0.5)) : 0xff;
int ir = PixelUtils.clamp((int)(r+0.5));
int ig = PixelUtils.clamp((int)(g+0.5));
int ib = PixelUtils.clamp((int)(b+0.5));
outPixels[index++] = (ia << 24) | (ir << 16) | (ig << 8) | ib;
}
}
}
示例13: convolve
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve a block of pixels.
*
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
if (kernel.getHeight() == 1) {
convolveH(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
} else if (kernel.getWidth() == 1) {
convolveV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
} else {
convolveHV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
}
}
示例14: convolve
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve a block of pixels.
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
if (kernel.getHeight() == 1)
convolveH(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
else if (kernel.getWidth() == 1)
convolveV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
else
convolveHV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
}
示例15: convolve
import java.awt.image.Kernel; //导入方法依赖的package包/类
/**
* Convolve a block of pixels.
* @param kernel the kernel
* @param inPixels the input pixels
* @param outPixels the output pixels
* @param width the width
* @param height the height
* @param alpha include alpha channel
* @param edgeAction what to do at the edges
*/
public static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
if (kernel.getHeight() == 1) {
convolveH(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
} else if (kernel.getWidth() == 1) {
convolveV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
} else {
convolveHV(kernel, inPixels, outPixels, width, height, alpha, edgeAction);
}
}