Here you can find the source of checkImageType(BufferedImage img, String name)
Parameter | Description |
---|---|
img | a parameter |
name | a parameter |
Parameter | Description |
---|---|
IllegalArgumentException | when image type is invalid |
public static void checkImageType(BufferedImage img, String name) throws IllegalArgumentException
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { public static final int IMAGE_TYPE = BufferedImage.TYPE_INT_ARGB; private static final boolean CHECK_TYPE = false; /**//from w w w. ja v a 2 s . c o m * Check image type. * * @param img * @param name * @throws IllegalArgumentException when image type is invalid */ public static void checkImageType(BufferedImage img, String name) throws IllegalArgumentException { if (CHECK_TYPE && img.getType() != IMAGE_TYPE) { throw new IllegalArgumentException( String.format("Invalid %s.type=%s, expected %s", name, img.getType(), IMAGE_TYPE)); } } }