随机颜色范围会导致255取不到

This commit is contained in:
neko 2020-09-29 11:07:58 +08:00 committed by GitHub
parent 322c95fde2
commit 699e14acac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,12 @@ public class ImgUtil {
public static final String IMAGE_TYPE_BMP = "bmp";// 英文Bitmap位图的简写它是Windows操作系统中的标准图像文件格式
public static final String IMAGE_TYPE_PNG = "png";// 可移植网络图形
public static final String IMAGE_TYPE_PSD = "psd";// Photoshop的专用格式Photoshop
/**
* RGB颜色范围上限
*/
private static final int RGB_COLOR_BOUND = 256;
// ---------------------------------------------------------------------------------------------------------------------- scale
@ -1952,7 +1958,7 @@ public class ImgUtil {
if (null == random) {
random = RandomUtil.getRandom();
}
return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
return new Color(random.nextInt(RGB_COLOR_BOUND), random.nextInt(RGB_COLOR_BOUND), random.nextInt(RGB_COLOR_BOUND));
}
/**