本文整理汇总了Java中sun.awt.image.IntegerInterleavedRaster.getDataStorage方法的典型用法代码示例。如果您正苦于以下问题:Java IntegerInterleavedRaster.getDataStorage方法的具体用法?Java IntegerInterleavedRaster.getDataStorage怎么用?Java IntegerInterleavedRaster.getDataStorage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.awt.image.IntegerInterleavedRaster
的用法示例。
在下文中一共展示了IntegerInterleavedRaster.getDataStorage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: grayToBuffered
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public static void grayToBuffered(ImageUInt8 src, IntegerInterleavedRaster dst) {
final byte[] srcData = src.data;
final int[] dstData = dst.getDataStorage();
final int numBands = dst.getNumBands();
if (numBands == 3) {
int indexDst = 0;
for (int y = 0; y < src.height; y++) {
int indexSrc = src.startIndex + y * src.stride;
for (int x = 0; x < src.width; x++) {
int v = srcData[indexSrc++] & 0xFF;
dstData[indexDst++] = v << 16 | v << 8 | v;
}
}
} else {
throw new RuntimeException("Code more here");
}
}
示例2: Int
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public Int(IntegerInterleavedRaster srcRas, ColorModel cm,
AffineTransform xform, int maxw, boolean filter)
{
super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw);
this.srcRas = srcRas;
this.inData = srcRas.getDataStorage();
this.inSpan = srcRas.getScanlineStride();
this.inOff = srcRas.getDataOffset(0);
this.filter = filter;
}
示例3: makeRaster
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public WritableRaster makeRaster(int w, int h) {
WritableRaster ras = makeRaster(colorModel, srcRas, w, h);
IntegerInterleavedRaster iiRas = (IntegerInterleavedRaster) ras;
outData = iiRas.getDataStorage();
outSpan = iiRas.getScanlineStride();
outOff = iiRas.getDataOffset(0);
return ras;
}
示例4: Int
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public Int(IntegerInterleavedRaster srcRas, ColorModel cm,
AffineTransform xform, int maxw, boolean filter)
{
super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw);
this.srcRas = srcRas;
this.inData = srcRas.getDataStorage();
this.inSpan = srcRas.getScanlineStride();
this.inOff = srcRas.getDataOffset(0);
this.filter = filter;
}
示例5: bufferedToGray
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
/**
* A faster convert that works directly with a specific raster
*/
public static void bufferedToGray(IntegerInterleavedRaster src, ImageUInt8 dst) {
int[] srcData = src.getDataStorage();
byte[] data = dst.data;
int srcStride = src.getScanlineStride();
int srcOffset = src.getDataOffset(0)-src.getPixelStride()+1;
int srcStrideDiff = srcStride-src.getPixelStride()*dst.width;
int indexSrc = srcOffset;
for (int y = 0; y < dst.height; y++) {
int indexDst = dst.startIndex + y * dst.stride;
for (int x = 0; x < dst.width; x++) {
int rgb = srcData[indexSrc++];
int r = (rgb >>> 16) & 0xFF;
int g = (rgb >>> 8) & 0xFF;
int b = rgb & 0xFF;
int ave = (r + g + b) / 3;
data[indexDst++] = (byte) ave;
}
indexSrc += srcStrideDiff;
}
}
示例6: bufferedToMulti_U8
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
/**
* A faster convert that works directly with a specific raster
*/
public static void bufferedToMulti_U8(IntegerInterleavedRaster src, MultiSpectral<ImageUInt8> dst) {
int[] srcData = src.getDataStorage();
int srcStride = src.getScanlineStride();
int srcOffset = src.getDataOffset(0)-src.getPixelStride()+1;
int srcStrideDiff = srcStride-src.getPixelStride()*dst.width;
byte[] data1 = dst.getBand(0).data;
byte[] data2 = dst.getBand(1).data;
byte[] data3 = dst.getBand(2).data;
int indexSrc = srcOffset;
for (int y = 0; y < dst.height; y++) {
int indexDst = dst.startIndex + y * dst.stride;
for (int x = 0; x < dst.width; x++, indexDst++) {
int rgb = srcData[indexSrc++];
data1[indexDst] = (byte) (rgb >>> 16);
data2[indexDst] = (byte) (rgb >>> 8);
data3[indexDst] = (byte) rgb;
}
indexSrc += srcStrideDiff;
}
}
示例7: bufferedToMulti_F32
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
/**
* A faster convert that works directly with a specific raster
*/
public static void bufferedToMulti_F32(IntegerInterleavedRaster src, MultiSpectral<ImageFloat32> dst) {
int[] srcData = src.getDataStorage();
int srcStride = src.getScanlineStride();
int srcOffset = src.getDataOffset(0)-src.getPixelStride()+1;
int srcStrideDiff = srcStride-src.getPixelStride()*dst.width;
float[] data1 = dst.getBand(0).data;
float[] data2 = dst.getBand(1).data;
float[] data3 = dst.getBand(2).data;
int indexSrc = srcOffset;
for (int y = 0; y < dst.height; y++) {
int indexDst = dst.startIndex + y * dst.stride;
for (int x = 0; x < dst.width; x++, indexDst++) {
int rgb = srcData[indexSrc++];
data1[indexDst] = (rgb >>> 16) & 0xFF;
data2[indexDst] = (rgb >>> 8) & 0xFF;
data3[indexDst] = rgb & 0xFF;
}
indexSrc += srcStrideDiff;
}
}
示例8: multToBuffered_U8
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public static void multToBuffered_U8(MultiSpectral<ImageUInt8> src, IntegerInterleavedRaster dst) {
if (src.getNumBands() != dst.getNumBands())
throw new IllegalArgumentException("Unequal number of bands src = " + src.getNumBands() + " dst = " + dst.getNumBands());
final int[] dstData = dst.getDataStorage();
final int numBands = dst.getNumBands();
if (numBands == 3) {
final byte[] band1 = src.getBand(0).data;
final byte[] band2 = src.getBand(1).data;
final byte[] band3 = src.getBand(2).data;
int indexDst = 0;
for (int y = 0; y < src.height; y++) {
int indexSrc = src.startIndex + y * src.stride;
for (int x = 0; x < src.width; x++, indexSrc++) {
int c1 = band1[indexSrc] & 0xFF;
int c2 = band2[indexSrc] & 0xFF;
int c3 = band3[indexSrc] & 0xFF;
dstData[indexDst++] = c1 << 16 | c2 << 8 | c3;
}
}
} else {
throw new RuntimeException("Code more here");
}
}
示例9: multToBuffered_F32
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public static void multToBuffered_F32(MultiSpectral<ImageFloat32> src, IntegerInterleavedRaster dst) {
if (src.getNumBands() != dst.getNumBands())
throw new IllegalArgumentException("Unequal number of bands src = " + src.getNumBands() + " dst = " + dst.getNumBands());
final int[] dstData = dst.getDataStorage();
final int numBands = dst.getNumBands();
if (numBands == 3) {
final float[] band1 = src.getBand(0).data;
final float[] band2 = src.getBand(1).data;
final float[] band3 = src.getBand(2).data;
int indexDst = 0;
for (int y = 0; y < src.height; y++) {
int indexSrc = src.startIndex + y * src.stride;
for (int x = 0; x < src.width; x++, indexSrc++) {
int c1 = (int) band1[indexSrc];
int c2 = (int) band2[indexSrc];
int c3 = (int) band3[indexSrc];
dstData[indexDst++] = c1 << 16 | c2 << 8 | c3;
}
}
} else {
throw new RuntimeException("Code more here");
}
}
示例10: renderOrientation
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public static BufferedImage renderOrientation( ImageUInt8 direction , BufferedImage out ) {
if( out == null ) {
out = new BufferedImage(direction.getWidth(),direction.getHeight(),BufferedImage.TYPE_INT_RGB);
}
if( out.getRaster() instanceof IntegerInterleavedRaster) {
int colors[] = new int[4];
colors[0] = Color.RED.getRGB();
colors[1] = Color.GREEN.getRGB();
colors[2] = Color.BLUE.getRGB();
colors[3] = Color.BLACK.getRGB();
IntegerInterleavedRaster raster = (IntegerInterleavedRaster)out.getRaster();
int rasterIndex = 0;
int data[] = raster.getDataStorage();
int w = direction.getWidth();
int h = direction.getHeight();
for( int y = 0; y < h; y++ ) {
int indexSrc = direction.startIndex + y*direction.stride;
for( int x = 0; x < w; x++ ) {
data[rasterIndex++] = colors[direction.data[indexSrc++]];
}
}
} else {
throw new RuntimeException("Raster not supported yet");
}
return out;
}
示例11: renderOrientation4
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public static BufferedImage renderOrientation4( ImageSInt8 direction , ImageFloat32 intensity , float threshold , BufferedImage out ) {
if( out == null ) {
out = new BufferedImage(direction.getWidth(),direction.getHeight(),BufferedImage.TYPE_INT_RGB);
}
if( out.getRaster() instanceof IntegerInterleavedRaster) {
int colors[] = new int[4];
colors[0] = Color.RED.getRGB();
colors[1] = Color.GREEN.getRGB();
colors[2] = Color.BLUE.getRGB();
colors[3] = Color.BLACK.getRGB();
int white = Color.WHITE.getRGB();
IntegerInterleavedRaster raster = (IntegerInterleavedRaster)out.getRaster();
int rasterIndex = 0;
int data[] = raster.getDataStorage();
int w = direction.getWidth();
int h = direction.getHeight();
for( int y = 0; y < h; y++ ) {
int indexSrc = direction.startIndex + y*direction.stride;
int indexInten = intensity.startIndex + y*intensity.stride;
for( int x = 0; x < w; x++ , indexInten++ , indexSrc++, rasterIndex++) {
if( intensity.data[indexInten] >= threshold ) {
data[rasterIndex] = colors[direction.data[indexSrc]+1];
} else {
data[rasterIndex] = white;
}
}
}
} else {
throw new RuntimeException("Raster not supported yet");
}
return out;
}
示例12: renderLabeled
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
private static void renderLabeled(ImageSInt32 labelImage, int[] colors, IntegerInterleavedRaster raster) {
int rasterIndex = 0;
int data[] = raster.getDataStorage();
int w = labelImage.getWidth();
int h = labelImage.getHeight();
for( int y = 0; y < h; y++ ) {
int indexSrc = labelImage.startIndex + y*labelImage.stride;
for( int x = 0; x < w; x++ ) {
data[rasterIndex++] = colors[labelImage.data[indexSrc++]];
}
}
}