Java Code Examples for java.awt.image.BufferedImage#TYPE_USHORT_565_RGB
The following examples show how to use
java.awt.image.BufferedImage#TYPE_USHORT_565_RGB .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageManufacture.java From MyBox with Apache License 2.0 | 6 votes |
public static boolean hasAlpha(BufferedImage source) { switch (source.getType()) { case BufferedImage.TYPE_3BYTE_BGR: case BufferedImage.TYPE_BYTE_BINARY: case BufferedImage.TYPE_BYTE_GRAY: case BufferedImage.TYPE_BYTE_INDEXED: case BufferedImage.TYPE_INT_BGR: case BufferedImage.TYPE_INT_RGB: case BufferedImage.TYPE_USHORT_555_RGB: case BufferedImage.TYPE_USHORT_565_RGB: case BufferedImage.TYPE_USHORT_GRAY: return false; default: if (source.getColorModel() != null) { return source.getColorModel().hasAlpha(); } else { return true; } } }
Example 2
Source File: ImageUtils.java From scrimage with Apache License 2.0 | 6 votes |
public static int nrChannels(BufferedImage img) { switch (img.getType()) { case BufferedImage.TYPE_3BYTE_BGR: case BufferedImage.TYPE_INT_BGR: case BufferedImage.TYPE_INT_RGB: case BufferedImage.TYPE_USHORT_555_RGB: case BufferedImage.TYPE_USHORT_565_RGB: return 3; case BufferedImage.TYPE_4BYTE_ABGR: case BufferedImage.TYPE_INT_ARGB: case BufferedImage.TYPE_CUSTOM: case BufferedImage.TYPE_4BYTE_ABGR_PRE: case BufferedImage.TYPE_INT_ARGB_PRE: return 4; case BufferedImage.TYPE_BYTE_GRAY: case BufferedImage.TYPE_USHORT_GRAY: return 1; } return 0; }
Example 3
Source File: BufferedImageIterator.java From pumpernickel with MIT License | 6 votes |
BufferedImageUnknownIterator(BufferedImage bi, boolean topDown) { super(bi, topDown); if (!(type == BufferedImage.TYPE_BYTE_BINARY || type == BufferedImage.TYPE_CUSTOM || type == BufferedImage.TYPE_USHORT_555_RGB || type == BufferedImage.TYPE_USHORT_565_RGB || type == BufferedImage.TYPE_USHORT_GRAY)) { throw new IllegalArgumentException("The image type " + getTypeName(type) + " is not supported."); } if (warning == false) { warning = true; System.err .println("The BufferedImageUnknownIterator is being used for an image of type " + getTypeName(type) + ". This is not recommended."); } }
Example 4
Source File: BMPSubsamplingTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private boolean canEncodeImage(String compression, ImageTypeSpecifier imgType, int rawType) { int biType = imgType.getBufferedImageType(); if ((!compression.equals("BI_BITFIELDS")) && ((rawType == BufferedImage.TYPE_USHORT_565_RGB) || (rawType == TYPE_USHORT_565_BGR))) { return false; } int bpp = imgType.getColorModel().getPixelSize(); if (compression.equals("BI_RLE4") && bpp != 4) { // only 4bpp images can be encoded as BI_RLE4 return false; } if (compression.equals("BI_RLE8") && bpp != 8) { // only 8bpp images can be encoded as BI_RLE8 return false; } if (compression.equals("BI_PNG") && ((rawType == TYPE_USHORT_555_GRB) || (rawType == TYPE_USHORT_555_BGR))) { return false; } return true; }
Example 5
Source File: BMPSubsamplingTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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); } }
Example 6
Source File: ImageValue.java From MyBox with Apache License 2.0 | 5 votes |
public static String imageType(int type) { switch (type) { case BufferedImage.TYPE_3BYTE_BGR: return "3BYTE_BGR"; case BufferedImage.TYPE_4BYTE_ABGR: return "4BYTE_ABGR"; case BufferedImage.TYPE_4BYTE_ABGR_PRE: return "4BYTE_ABGR_PRE"; case BufferedImage.TYPE_BYTE_BINARY: return "BYTE_BINARY"; case BufferedImage.TYPE_BYTE_GRAY: return "BYTE_GRAY"; case BufferedImage.TYPE_BYTE_INDEXED: return "BYTE_INDEXED"; case BufferedImage.TYPE_CUSTOM: return "CUSTOM"; case BufferedImage.TYPE_INT_ARGB: return "INT_ARGB"; case BufferedImage.TYPE_INT_ARGB_PRE: return "INT_ARGB_PRE"; case BufferedImage.TYPE_INT_BGR: return "INT_BGR"; case BufferedImage.TYPE_INT_RGB: return "INT_RGB"; case BufferedImage.TYPE_USHORT_555_RGB: return "USHORT_555_RGB"; case BufferedImage.TYPE_USHORT_565_RGB: return "USHORT_565_RGB"; } return type + ""; }
Example 7
Source File: BMPSubsamplingTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean canEncodeImage(String compression, ImageTypeSpecifier imgType, int rawType) { int biType = imgType.getBufferedImageType(); if ((!compression.equals("BI_BITFIELDS")) && ((rawType == BufferedImage.TYPE_USHORT_565_RGB) || (rawType == TYPE_USHORT_565_BGR))) { return false; } int bpp = imgType.getColorModel().getPixelSize(); if (compression.equals("BI_RLE4") && bpp != 4) { // only 4bpp images can be encoded as BI_RLE4 return false; } if (compression.equals("BI_RLE8") && bpp != 8) { // only 8bpp images can be encoded as BI_RLE8 return false; } if (compression.equals("BI_PNG") && ((rawType == TYPE_USHORT_555_GRB) || (rawType == TYPE_USHORT_555_BGR))) { return false; } return true; }
Example 8
Source File: ColConvTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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"; }
Example 9
Source File: ImageNew.java From openbd-core with GNU General Public License v3.0 | 5 votes |
/** * This determines the image type * * @param namedStringParam * @return * @throws cfmRunTimeException */ private int getImageType(cfSession _session, String imageType) throws cfmRunTimeException { imageType = imageType.toUpperCase().trim(); if (imageType.equals("3BYTE_BGR")) { return BufferedImage.TYPE_3BYTE_BGR; } else if (imageType.equals("4BYTE_ABGR")) { return BufferedImage.TYPE_4BYTE_ABGR; } else if (imageType.equals("4BYTE_ABGR_PRE")) { return BufferedImage.TYPE_4BYTE_ABGR_PRE; } else if (imageType.equals("BYTE_BINARY")) { return BufferedImage.TYPE_BYTE_BINARY; } else if (imageType.equals("BYTE_GRAY") || imageType.equals("GRAYSCALE")) { return BufferedImage.TYPE_BYTE_GRAY; } else if (imageType.equals("BYTE_INDEXED")) { return BufferedImage.TYPE_BYTE_INDEXED; } else if (imageType.equals("INT_ARGB") || imageType.equals("ARGB")) { return BufferedImage.TYPE_INT_ARGB; } else if (imageType.equals("INT_ARGB_PRE")) { return BufferedImage.TYPE_INT_ARGB_PRE; } else if (imageType.equals("INT_BGR")) { return BufferedImage.TYPE_INT_BGR; } else if (imageType.equals("INT_RGB") || imageType.equals("RGB")) { return BufferedImage.TYPE_INT_RGB; } else if (imageType.equals("USHORT_555_RGB")) { return BufferedImage.TYPE_USHORT_555_RGB; } else if (imageType.equals("USHORT_565_RGB")) { return BufferedImage.TYPE_USHORT_565_RGB; } else if (imageType.equals("USHORT_GRAY")) { return BufferedImage.TYPE_USHORT_GRAY; } else { throwException(_session, "invalid type specified: " + imageType); } return 0; }
Example 10
Source File: BMPSubsamplingTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private boolean canEncodeImage(String compression, ImageTypeSpecifier imgType, int rawType) { int biType = imgType.getBufferedImageType(); if ((!compression.equals("BI_BITFIELDS")) && ((rawType == BufferedImage.TYPE_USHORT_565_RGB) || (rawType == TYPE_USHORT_565_BGR))) { return false; } int bpp = imgType.getColorModel().getPixelSize(); if (compression.equals("BI_RLE4") && bpp != 4) { // only 4bpp images can be encoded as BI_RLE4 return false; } if (compression.equals("BI_RLE8") && bpp != 8) { // only 8bpp images can be encoded as BI_RLE8 return false; } if (compression.equals("BI_PNG") && ((rawType == TYPE_USHORT_555_GRB) || (rawType == TYPE_USHORT_555_BGR))) { return false; } return true; }
Example 11
Source File: NoExtraBytesTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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); } }
Example 12
Source File: BMPImageWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
protected int getPreferredCompressionType(ImageTypeSpecifier imageType) { if (imageType.getBufferedImageType() == BufferedImage.TYPE_USHORT_565_RGB) { return BI_BITFIELDS; } return BI_RGB; }
Example 13
Source File: SSD1351.java From diozero with MIT License | 4 votes |
public SSD1351(int controller, int chipSelect, DigitalOutputDevice dcPin, DigitalOutputDevice resetPin) { // Limit to 5-6-5 image type for now (65k colours) super(controller, chipSelect, dcPin, resetPin, WIDTH, HEIGHT, BufferedImage.TYPE_USHORT_565_RGB); }
Example 14
Source File: BMPImageWriter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
protected int getPreferredCompressionType(ImageTypeSpecifier imageType) { if (imageType.getBufferedImageType() == BufferedImage.TYPE_USHORT_565_RGB) { return BI_BITFIELDS; } return BI_RGB; }
Example 15
Source File: BMPImageWriter.java From Bytecoder with Apache License 2.0 | 4 votes |
protected int getPreferredCompressionType(ImageTypeSpecifier imageType) { if (imageType.getBufferedImageType() == BufferedImage.TYPE_USHORT_565_RGB) { return BI_BITFIELDS; } return BI_RGB; }
Example 16
Source File: PixelTests.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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(); }
Example 17
Source File: PixelTests.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
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(); }
Example 18
Source File: SSD1331.java From diozero with MIT License | 4 votes |
public SSD1331(int controller, int chipSelect, DigitalOutputDevice dcPin, DigitalOutputDevice resetPin) { super(controller, chipSelect, dcPin, resetPin, WIDTH, HEIGHT, BufferedImage.TYPE_USHORT_565_RGB); }
Example 19
Source File: ImageUtil.java From audiveris with GNU Affero General Public License v3.0 | 4 votes |
private static String typeOf (int type) { switch (type) { case BufferedImage.TYPE_CUSTOM: return "TYPE_CUSTOM"; case BufferedImage.TYPE_INT_RGB: return "TYPE_INT_RGB"; case BufferedImage.TYPE_INT_ARGB: return "TYPE_INT_ARGB"; case BufferedImage.TYPE_INT_ARGB_PRE: return "TYPE_INT_ARGB_PRE"; case BufferedImage.TYPE_INT_BGR: return "TYPE_INT_BGR"; 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_USHORT_565_RGB: return "TYPE_USHORT_565_RGB"; case BufferedImage.TYPE_USHORT_555_RGB: return "TYPE_USHORT_555_RGB"; case BufferedImage.TYPE_BYTE_GRAY: return "TYPE_BYTE_GRAY"; case BufferedImage.TYPE_USHORT_GRAY: return "TYPE_USHORT_GRAY"; case BufferedImage.TYPE_BYTE_BINARY: return "TYPE_BYTE_BINARY"; case BufferedImage.TYPE_BYTE_INDEXED: return "TYPE_BYTE_INDEXED"; default: return "?"; } }
Example 20
Source File: PixelTests.java From hottub with GNU General Public License v2.0 | 4 votes |
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(); }