mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add method
This commit is contained in:
parent
dd1d30dc7c
commit
8f2400ed43
@ -3,11 +3,12 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.6.7 (2021-06-02)
|
||||
# 5.6.7 (2021-06-03)
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 CharSequenceUtil增加join重载(issue#I3TFJ5@Gitee)
|
||||
* 【http 】 HttpRequest增加form方法重载(pr#337@Gitee)
|
||||
* 【http 】 ImgUtil增加getMainColor方法(pr#338@Gitee)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复FileUtil.normalize去掉末尾空格问题(issue#1603@Github)
|
||||
|
@ -43,7 +43,11 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 图片处理工具类:<br>
|
||||
@ -1722,7 +1726,7 @@ public class ImgUtil {
|
||||
}
|
||||
|
||||
if (null == result) {
|
||||
throw new IllegalArgumentException("Image type of [" + imageUrl.toString() + "] is not supported!");
|
||||
throw new IllegalArgumentException("Image type of [" + imageUrl + "] is not supported!");
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -2006,6 +2010,7 @@ public class ImgUtil {
|
||||
* @param image {@link BufferedImage}
|
||||
* @param rgbFilters 过滤多种颜色
|
||||
* @return {@link String} #ffffff
|
||||
* @since 5.6.7
|
||||
*/
|
||||
public static String getMainColor(BufferedImage image, int[]... rgbFilters) {
|
||||
int r, g, b;
|
||||
@ -2040,10 +2045,10 @@ public class ImgUtil {
|
||||
maxCount = count;
|
||||
}
|
||||
}
|
||||
String[] splitRgbStr = maxColor.split("-");
|
||||
String rHex = Integer.toHexString(Integer.valueOf(splitRgbStr[0]));
|
||||
String gHex = Integer.toHexString(Integer.valueOf(splitRgbStr[1]));
|
||||
String bHex = Integer.toHexString(Integer.valueOf(splitRgbStr[2]));
|
||||
final String[] splitRgbStr = StrUtil.splitToArray(maxColor, '-');
|
||||
String rHex = Integer.toHexString(Integer.parseInt(splitRgbStr[0]));
|
||||
String gHex = Integer.toHexString(Integer.parseInt(splitRgbStr[1]));
|
||||
String bHex = Integer.toHexString(Integer.parseInt(splitRgbStr[2]));
|
||||
rHex = rHex.length() == 1 ? "0" + rHex : rHex;
|
||||
gHex = gHex.length() == 1 ? "0" + gHex : gHex;
|
||||
bHex = bHex.length() == 1 ? "0" + bHex : bHex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user