本文整理汇总了Java中java.awt.image.RasterOp类的典型用法代码示例。如果您正苦于以下问题:Java RasterOp类的具体用法?Java RasterOp怎么用?Java RasterOp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RasterOp类属于java.awt.image包,在下文中一共展示了RasterOp类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runTest
import java.awt.image.RasterOp; //导入依赖的package包/类
public void runTest(Object ctx, int numReps) {
ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
RasterOp op = ictx.rasterOp;
Raster src = ictx.rasSrc;
WritableRaster dst = ictx.rasDst;
if (ictx.touchSrc) {
Graphics gSrc = ictx.bufSrc.getGraphics();
do {
gSrc.fillRect(0, 0, 1, 1);
op.filter(src, dst);
} while (--numReps > 0);
} else {
do {
op.filter(src, dst);
} while (--numReps > 0);
}
}
示例2: main
import java.awt.image.RasterOp; //导入依赖的package包/类
public static void main(String[] args) {
byte[][] data = new byte[1][10];
ByteLookupTable lut = new ByteLookupTable(0, data);
RasterOp op = new LookupOp(lut, null);
int[] bandOffsets = {0};
Point location = new Point(0, 0);
DataBuffer db = new DataBufferByte(10 * 10);
SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
10, 10, 1, 10,
bandOffsets);
Raster src = Raster.createRaster(sm, db, location);
op.filter(src, null); // this used to result in NullPointerException
}
示例3: filter
import java.awt.image.RasterOp; //导入依赖的package包/类
public static WritableRaster filter(RasterOp op, Raster src,
WritableRaster dst) {
if (useLib == false) {
return null;
}
// Create the destination tile
if (dst == null) {
dst = op.createCompatibleDestRaster(src);
}
WritableRaster retRaster = null;
switch (getNativeOpIndex(op.getClass())) {
case LOOKUP_OP:
// REMIND: Fix this!
LookupTable table = ((LookupOp)op).getTable();
if (table.getOffset() != 0) {
// Right now the native code doesn't support offsets
return null;
}
if (table instanceof ByteLookupTable) {
ByteLookupTable bt = (ByteLookupTable) table;
if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
retRaster = dst;
}
}
break;
case AFFINE_OP:
AffineTransformOp bOp = (AffineTransformOp) op;
double[] matrix = new double[6];
bOp.getTransform().getMatrix(matrix);
if (transformRaster(src, dst, matrix,
bOp.getInterpolationType()) > 0) {
retRaster = dst;
}
break;
case CONVOLVE_OP:
ConvolveOp cOp = (ConvolveOp) op;
if (convolveRaster(src, dst,
cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
retRaster = dst;
}
break;
default:
break;
}
if (retRaster != null) {
SunWritableRaster.markDirty(retRaster);
}
return retRaster;
}
示例4: filter
import java.awt.image.RasterOp; //导入依赖的package包/类
public static WritableRaster filter(RasterOp op, Raster src,
WritableRaster dst) {
return null;
}