本文整理汇总了Java中java.awt.image.BufferedImage.TYPE_4BYTE_ABGR_PRE属性的典型用法代码示例。如果您正苦于以下问题:Java BufferedImage.TYPE_4BYTE_ABGR_PRE属性的具体用法?Java BufferedImage.TYPE_4BYTE_ABGR_PRE怎么用?Java BufferedImage.TYPE_4BYTE_ABGR_PRE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.image.BufferedImage
的用法示例。
在下文中一共展示了BufferedImage.TYPE_4BYTE_ABGR_PRE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: updateImage
/**
* Updates the image
*/
private void updateImage() {
RenderingOptions options = VISNode.get().getModel().getUserPreferences().getRenderingOptions();
BufferedImage image = ImageConverter.toBufferedImage(value, options);
int size = Math.max(image.getWidth(), image.getHeight());
int newWidth = THUMBNAIL_SIZE * image.getWidth() / size;
int newHeight = THUMBNAIL_SIZE * image.getHeight() / size;
int x = (THUMBNAIL_SIZE - newWidth) / 2;
int y = (THUMBNAIL_SIZE - newHeight) / 2;
BufferedImage newImage = new BufferedImage(THUMBNAIL_SIZE, THUMBNAIL_SIZE, BufferedImage.TYPE_4BYTE_ABGR_PRE);
java.awt.Image scaledImage = image.getScaledInstance(newWidth, newHeight, BufferedImage.SCALE_SMOOTH);
newImage.getGraphics().drawImage(scaledImage, x, y, null);
icon.setImage(newImage);
repaint();
}
示例3: convertImage
/**
* this method convert supplied image to suitable type
* it is needed because we need bytes of array so TYPE_INT images must be
* converted to BYTE_BGR or so
* @param originalImage loaded from file-chooser
* @return
*/
public BufferedImage convertImage(BufferedImage originalImage) {
int newImageType = originalImage.getType();
/**
* Converting int to byte since byte array is needed later to modify
* the image
*/
if (newImageType == BufferedImage.TYPE_INT_RGB
|| newImageType == BufferedImage.TYPE_INT_BGR) {
newImageType = BufferedImage.TYPE_3BYTE_BGR;
} else if (newImageType == BufferedImage.TYPE_INT_ARGB ||
newImageType == BufferedImage.TYPE_CUSTOM) {
newImageType = BufferedImage.TYPE_4BYTE_ABGR;
} else if (newImageType == BufferedImage.TYPE_INT_ARGB_PRE) {
newImageType = BufferedImage.TYPE_4BYTE_ABGR_PRE;
} else {
// no need to convert original image
return null;
}
BufferedImage newImage = new BufferedImage(originalImage.getWidth(),
originalImage.getHeight(), newImageType);
Graphics g = newImage.getGraphics();
g.drawImage(originalImage, 0, 0, null);
g.dispose();
return newImage;
}
示例4: createBufferedImage
private static BufferedImage createBufferedImage() {
BufferedImage image = new BufferedImage(128, 128,
BufferedImage.TYPE_4BYTE_ABGR_PRE);
Graphics2D graph = image.createGraphics();
graph.setPaintMode();
graph.setColor(Color.orange);
graph.fillRect(32, 32, 64, 64);
graph.dispose();
return image;
}
示例5: init
public static void init() {
destroot = new Group.EnableSet(TestEnvironment.globaloptroot,
"dest", "Output Destination Options");
new Screen();
new OffScreen();
if (GraphicsTests.hasGraphics2D) {
if (ImageTests.hasCompatImage) {
compatimgdestroot =
new Group.EnableSet(destroot, "compatimg",
"Compatible Image Destinations");
compatimgdestroot.setHorizontal();
new CompatImg();
new CompatImg(Transparency.OPAQUE);
new CompatImg(Transparency.BITMASK);
new CompatImg(Transparency.TRANSLUCENT);
}
if (ImageTests.hasVolatileImage) {
volimgdestroot = new Group.EnableSet(destroot, "volimg",
"Output to Volatile Image");
volimgdestroot.setHorizontal();
new VolatileImg();
if (ImageTests.hasTransparentVolatileImage) {
new VolatileImg(Transparency.OPAQUE);
new VolatileImg(Transparency.BITMASK);
new VolatileImg(Transparency.TRANSLUCENT);
}
}
bufimgdestroot = new Group.EnableSet(destroot, "bufimg",
"BufferedImage Destinations");
new BufImg(BufferedImage.TYPE_INT_RGB);
new BufImg(BufferedImage.TYPE_INT_ARGB);
new BufImg(BufferedImage.TYPE_INT_ARGB_PRE);
new BufImg(BufferedImage.TYPE_3BYTE_BGR);
new BufImg(BufferedImage.TYPE_BYTE_INDEXED);
new BufImg(BufferedImage.TYPE_BYTE_GRAY);
new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
new BufImg(BufferedImage.TYPE_4BYTE_ABGR_PRE);
new CustomImg();
}
}