本文整理汇总了Java中java.awt.image.BufferedImage.TYPE_USHORT_GRAY属性的典型用法代码示例。如果您正苦于以下问题:Java BufferedImage.TYPE_USHORT_GRAY属性的具体用法?Java BufferedImage.TYPE_USHORT_GRAY怎么用?Java BufferedImage.TYPE_USHORT_GRAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.image.BufferedImage
的用法示例。
在下文中一共展示了BufferedImage.TYPE_USHORT_GRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getType
@Override
public int getType(boolean oneBand) {
int nBand = getNBand();
if (oneBand | nBand == 1) {
//if (td.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS).getAsInt(0) == 1) {
// return BufferedImage.TYPE_BYTE_GRAY;
//} else if (td.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS).getAsInt(0) == 2) {
return BufferedImage.TYPE_USHORT_GRAY;
//}
} else if (nBand == 2) {
return BufferedImage.TYPE_BYTE_GRAY;
} else if (nBand == 3) {
return BufferedImage.TYPE_INT_RGB;
} else if (nBand == 4) {
return BufferedImage.TYPE_INT_RGB;
}
return BufferedImage.TYPE_BYTE_GRAY;
}
示例2: createOverview
/**
* create a quicklook image from the GeoImageReader
* @param gir the source image
* @param width the output width
* @param height the output height
* @return a BufferedImage representing the quicklook
*/
public static BufferedImage createOverview(GeoImageReader gir, int width, int height,int band){
int nPass=gir.getHeight()/Constant.GEOIMAGE_TILE_SIZE;
int xstep=gir.getWidth()/width;
int ystep=gir.getHeight()/height;
width=gir.getWidth()/xstep;
height= gir.getHeight()/ystep;
BufferedImage out=new BufferedImage(width,height, BufferedImage.TYPE_USHORT_GRAY);
WritableRaster raster=out.getRaster();
for(int i=0;i<nPass;i++){
int[] t=gir.readTile(0, i*Constant.GEOIMAGE_TILE_SIZE, gir.getWidth(), Constant.GEOIMAGE_TILE_SIZE,band);
for(int x=0;x<width;x++){
for(int y=i*height/nPass;y<(i+1)*height/nPass;y++){
raster.setSample(x, y, 0, t[x*xstep*(y-i*height/nPass)*ystep]);
}
}
}
return out;
}
示例3: getType
@Override
public int getType(boolean oneBand) {
int nBand = getNBand();
/*if (oneBand | nBand == 1) {
return BufferedImage.TYPE_USHORT_GRAY;
} else if (nBand == 2) {
return BufferedImage.TYPE_BYTE_GRAY;
} else if (nBand == 3) {
return BufferedImage.TYPE_INT_RGB;
} else if (nBand == 4) {
return BufferedImage.TYPE_INT_ARGB;
}
return BufferedImage.TYPE_USHORT_GRAY;*/
if(oneBand || bands.size()<2) return BufferedImage.TYPE_USHORT_GRAY;
else return BufferedImage.TYPE_INT_RGB;
}
示例4: getImageTypeName
static String getImageTypeName(int type) {
switch(type) {
case BufferedImage.TYPE_INT_ARGB:
return "TYPE_INT_ARGB";
case BufferedImage.TYPE_INT_RGB:
return "TYPE_INT_RGB";
case BufferedImage.TYPE_INT_BGR:
return "TYPE_INT_BGR";
case BufferedImage.TYPE_INT_ARGB_PRE:
return "TYPE_INT_ARGB_PRE";
case BufferedImage.TYPE_3BYTE_BGR:
return "TYPE_3BYTE_BGR";
case BufferedImage.TYPE_4BYTE_ABGR:
return "TYPE_4BYTE_ABGR";
case BufferedImage.TYPE_4BYTE_ABGR_PRE:
return "TYPE_4BYTE_ABGR_PRE";
case BufferedImage.TYPE_BYTE_BINARY:
return "TYPE_BYTE_BINARY";
case BufferedImage.TYPE_BYTE_GRAY:
return "TYPE_BYTE_GRAY";
case BufferedImage.TYPE_BYTE_INDEXED:
return "TYPE_BYTE_INDEXED";
case BufferedImage.TYPE_USHORT_555_RGB:
return "TYPE_USHORT_555_RGB";
case BufferedImage.TYPE_USHORT_565_RGB:
return "TYPE_USHORT_565_RGB";
case BufferedImage.TYPE_USHORT_GRAY:
return "TYPE_USHORT_GRAY";
}
return "UNKNOWN";
}
示例5: getType
@Override
public int getType(boolean oneBand) {
if (oneBand || polarizations.size() < 2)
return BufferedImage.TYPE_USHORT_GRAY;
else
return BufferedImage.TYPE_INT_RGB;
}
示例6: getType
@Override
public int getType(boolean oneBand) {
if (oneBand || bands.length < 2) {
return BufferedImage.TYPE_USHORT_GRAY;
} else {
return BufferedImage.TYPE_INT_RGB;
}
}
示例7: getType
@Override
public int getType(boolean oneBand) {
//only one band
if (numberOfBytes == 1) {
return BufferedImage.TYPE_BYTE_GRAY;
} else {
return BufferedImage.TYPE_USHORT_GRAY;
}
}
示例8: getType
@Override
public int getType(boolean oneBand) {
////if (oneBand || bands.length < 2) {
return BufferedImage.TYPE_USHORT_GRAY;
//} else {
// return BufferedImage.TYPE_INT_RGB;
//}
}
示例9: getType
@Override
public int getType(boolean oneBand) {
if(oneBand || polarizations.size()<2) return BufferedImage.TYPE_USHORT_GRAY;
else return BufferedImage.TYPE_INT_RGB;
}
示例10: getType
@Override
public int getType(boolean oneBand) {
return BufferedImage.TYPE_USHORT_GRAY;
}
示例11: getType
@Override
public int getType(boolean oneBand) {
if(oneBand || polarizations.size()<2) return BufferedImage.TYPE_USHORT_GRAY;
else return BufferedImage.TYPE_INT_RGB;
}
示例12: getType
@Override
public int getType(boolean oneBand) {
if(oneBand || bands.length<2) return BufferedImage.TYPE_USHORT_GRAY;
else return BufferedImage.TYPE_INT_RGB;
}
示例13: getType
public int getType(boolean oneBand) {
return BufferedImage.TYPE_USHORT_GRAY;
}
示例14: init
public static void init() {
pixelroot = new Group("pixel", "Pixel Access Benchmarks");
pixeloptroot = new Group(pixelroot, "opts", "Pixel Access Options");
doRenderTo = new Option.Toggle(pixeloptroot, "renderto",
"Render to Image before test",
Option.Toggle.Off);
doRenderFrom = new Option.Toggle(pixeloptroot, "renderfrom",
"Render from Image before test",
Option.Toggle.Off);
// BufferedImage Sources
bufimgsrcroot = new Group.EnableSet(pixelroot, "src",
"BufferedImage Sources");
new BufImg(BufferedImage.TYPE_BYTE_BINARY, 1);
new BufImg(BufferedImage.TYPE_BYTE_BINARY, 2);
new BufImg(BufferedImage.TYPE_BYTE_BINARY, 4);
new BufImg(BufferedImage.TYPE_BYTE_INDEXED);
new BufImg(BufferedImage.TYPE_BYTE_GRAY);
new BufImg(BufferedImage.TYPE_USHORT_555_RGB);
new BufImg(BufferedImage.TYPE_USHORT_565_RGB);
new BufImg(BufferedImage.TYPE_USHORT_GRAY);
new BufImg(BufferedImage.TYPE_3BYTE_BGR);
new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
new BufImg(BufferedImage.TYPE_INT_RGB);
new BufImg(BufferedImage.TYPE_INT_BGR);
new BufImg(BufferedImage.TYPE_INT_ARGB);
// BufferedImage Tests
bufimgtestroot = new Group(pixelroot, "bimgtests",
"BufferedImage Tests");
new BufImgTest.GetRGB();
new BufImgTest.SetRGB();
// Raster Tests
rastertestroot = new Group(pixelroot, "rastests",
"Raster Tests");
new RasTest.GetDataElements();
new RasTest.SetDataElements();
new RasTest.GetPixel();
new RasTest.SetPixel();
// DataBuffer Tests
dbtestroot = new Group(pixelroot, "dbtests",
"DataBuffer Tests");
new DataBufTest.GetElem();
new DataBufTest.SetElem();
}
示例15: main
public static void main(String[] args) throws IOException {
UshortOutOfMemoryTest t = new UshortOutOfMemoryTest(
BufferedImage.TYPE_USHORT_GRAY);
t.testGetAsTree();
}