本文整理汇总了Java中java.awt.image.BufferedImage.TYPE_USHORT_555_RGB属性的典型用法代码示例。如果您正苦于以下问题:Java BufferedImage.TYPE_USHORT_555_RGB属性的具体用法?Java BufferedImage.TYPE_USHORT_555_RGB怎么用?Java BufferedImage.TYPE_USHORT_555_RGB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.image.BufferedImage
的用法示例。
在下文中一共展示了BufferedImage.TYPE_USHORT_555_RGB属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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";
}
示例2: getImageTypeName
static String getImageTypeName(int type) {
switch(type) {
case BufferedImage.TYPE_INT_RGB:
return "TYPE_INT_RGB";
case BufferedImage.TYPE_3BYTE_BGR:
return "TYPE_3BYTE_BGR";
case BufferedImage.TYPE_USHORT_555_RGB:
return "TYPE_USHORT_555_RGB";
case BufferedImage.TYPE_BYTE_GRAY:
return "TYPE_BYTE_GRAY";
case BufferedImage.TYPE_BYTE_BINARY:
return "TYPE_BYTE_BINARY";
default:
return "TBD";
}
}
示例3: getImageTypeName
private String getImageTypeName(int t) {
switch(t) {
case BufferedImage.TYPE_INT_RGB:
return "TYPE_INT_RGB";
case BufferedImage.TYPE_INT_BGR:
return "TYPE_INT_BGR";
case TYPE_INT_GRB:
return "TYPE_INT_GRB";
case TYPE_INT_GBR:
return "TYPE_INT_GBR";
case TYPE_INT_RBG:
return "TYPE_INT_RBG";
case TYPE_INT_BRG:
return "TYPE_INT_BRG";
case BufferedImage.TYPE_USHORT_555_RGB:
return "TYPE_USHORT_555_RGB";
case BufferedImage.TYPE_USHORT_565_RGB:
return "TYPE_USHORT_565_RGB";
case TYPE_USHORT_555_GRB:
return "TYPE_USHORT_555_GRB";
case TYPE_USHORT_555_BGR:
return "TYPE_USHORT_555_BGR";
case TYPE_USHORT_565_BGR:
return "TYPE_USHORT_565_BGR";
case BufferedImage.TYPE_3BYTE_BGR:
return "TYPE_3BYTE_BGR";
case TYPE_3BYTE_RGB:
return "TYPE_3BYTE_RGB";
case TYPE_3BYTE_GRB:
return "TYPE_3BYTE_GRB";
case BufferedImage.TYPE_BYTE_INDEXED:
return "TYPE_BYTE_INDEXED";
case TYPE_4BPP_INDEXED:
return "TYPE_BYTE_INDEXED (4bpp)";
default:
throw new IllegalArgumentException("Unknown image type: " + t);
}
}
示例4: getImageTypeName
private static String getImageTypeName(int t) {
switch(t) {
case BufferedImage.TYPE_INT_RGB:
return "TYPE_INT_RGB";
case BufferedImage.TYPE_INT_BGR:
return "TYPE_INT_BGR";
case BufferedImage.TYPE_3BYTE_BGR:
return "TYPE_3BYTE_BGR";
case BufferedImage.TYPE_USHORT_555_RGB:
return "TYPE_USHORT_555_RGB";
case BufferedImage.TYPE_USHORT_565_RGB:
return "TYPE_USHORT_565_RGB";
case TYPE_INT_GRB:
return "TYPE_INT_GRB";
case TYPE_INT_GBR:
return "TYPE_INT_GBR";
case TYPE_INT_RBG:
return "TYPE_INT_RBG";
case TYPE_INT_BRG:
return "TYPE_INT_BRG";
case TYPE_INT_555_GRB:
return "TYPE_INT_555_GRB";
case TYPE_3BYTE_RGB:
return "TYPE_3BYTE_RGB";
case TYPE_3BYTE_GRB:
return "TYPE_3BYTE_GRB";
default:
throw new IllegalArgumentException("Unknown image type: " + t);
}
}
示例5: doTest
private void doTest() {
BufferedImage src = createTestImage(type);
System.out.println("Sample model is " + src.getSampleModel());
BufferedImage dst = doModification(src);
Object dstPixel = dst.getRaster().getDataElements(width/2, height/2, null);
Object srcPixel = src.getRaster().getDataElements(width/2, height/2, null);
if (src.getType() == BufferedImage.TYPE_USHORT_555_RGB ||
src.getType() == BufferedImage.TYPE_USHORT_565_RGB ) {
Color cmpColor = new Color(dst.getColorModel().getRed(dstPixel),
dst.getColorModel().getGreen(dstPixel),
dst.getColorModel().getBlue(dstPixel));
BufferedImage cmp = createTestImage(src.getType(), cmpColor);
Object cmpPixel = cmp.getRaster().getDataElements(width/2, height/2, null);
dst = cmp;
dstPixel = cmpPixel;
}
if ( (src.getColorModel().getRed(srcPixel) != dst.getColorModel().getRed(dstPixel)) ||
(src.getColorModel().getGreen(srcPixel) != dst.getColorModel().getGreen(dstPixel)) ||
(src.getColorModel().getBlue(srcPixel) != dst.getColorModel().getBlue(dstPixel)) ||
(src.getColorModel().getAlpha(srcPixel) != dst.getColorModel().getAlpha(dstPixel)) ) {
showPixel(src, width/2, height/2);
showPixel(dst, width/2, height/2);
showRes(dst, src);
throw new RuntimeException(
"Colors are different: " +
Integer.toHexString(src.getColorModel().getRGB(srcPixel)) + " and " +
Integer.toHexString(dst.getColorModel().getRGB(dstPixel)));
}
}
示例6: main
public static void main(String[] args) throws IOException {
// buffered image types listed below can be saved as BI_BITFIELDS BMP
int[] types = {BufferedImage.TYPE_3BYTE_BGR,
BufferedImage.TYPE_USHORT_555_RGB,
BufferedImage.TYPE_USHORT_565_RGB,
BufferedImage.TYPE_BYTE_GRAY,
BufferedImage.TYPE_BYTE_BINARY,
BufferedImage.TYPE_BYTE_INDEXED,
BufferedImage.TYPE_INT_BGR,
BufferedImage.TYPE_INT_RGB};
for (int i = 0; i < types.length; i++) {
System.out.println("Test image " + types[i]);
TestCompressionBI_BITFIELDS t = new TestCompressionBI_BITFIELDS();
BufferedImage src =
t.createTestImage(types[i]);
System.out.println("Image for test: " + src);
System.out.println("SampleModel: " + src.getSampleModel());
BufferedImage dst = null;
try {
dst = t.writeAndRead(src);
} catch (IOException e) {
e.printStackTrace(System.out);
}
t.compareImages(src, dst);
}
}
示例7: 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();
}