mirror of
https://gitee.com/dromara/hutool.git
synced 2025-07-17 01:46:22 +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)
|
* 【core 】 CharSequenceUtil增加join重载(issue#I3TFJ5@Gitee)
|
||||||
* 【http 】 HttpRequest增加form方法重载(pr#337@Gitee)
|
* 【http 】 HttpRequest增加form方法重载(pr#337@Gitee)
|
||||||
|
* 【http 】 ImgUtil增加getMainColor方法(pr#338@Gitee)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复FileUtil.normalize去掉末尾空格问题(issue#1603@Github)
|
* 【core 】 修复FileUtil.normalize去掉末尾空格问题(issue#1603@Github)
|
||||||
|
@ -43,7 +43,11 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URL;
|
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>
|
* 图片处理工具类:<br>
|
||||||
@ -1722,7 +1726,7 @@ public class ImgUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null == result) {
|
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;
|
return result;
|
||||||
@ -2006,6 +2010,7 @@ public class ImgUtil {
|
|||||||
* @param image {@link BufferedImage}
|
* @param image {@link BufferedImage}
|
||||||
* @param rgbFilters 过滤多种颜色
|
* @param rgbFilters 过滤多种颜色
|
||||||
* @return {@link String} #ffffff
|
* @return {@link String} #ffffff
|
||||||
|
* @since 5.6.7
|
||||||
*/
|
*/
|
||||||
public static String getMainColor(BufferedImage image, int[]... rgbFilters) {
|
public static String getMainColor(BufferedImage image, int[]... rgbFilters) {
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
@ -2040,10 +2045,10 @@ public class ImgUtil {
|
|||||||
maxCount = count;
|
maxCount = count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String[] splitRgbStr = maxColor.split("-");
|
final String[] splitRgbStr = StrUtil.splitToArray(maxColor, '-');
|
||||||
String rHex = Integer.toHexString(Integer.valueOf(splitRgbStr[0]));
|
String rHex = Integer.toHexString(Integer.parseInt(splitRgbStr[0]));
|
||||||
String gHex = Integer.toHexString(Integer.valueOf(splitRgbStr[1]));
|
String gHex = Integer.toHexString(Integer.parseInt(splitRgbStr[1]));
|
||||||
String bHex = Integer.toHexString(Integer.valueOf(splitRgbStr[2]));
|
String bHex = Integer.toHexString(Integer.parseInt(splitRgbStr[2]));
|
||||||
rHex = rHex.length() == 1 ? "0" + rHex : rHex;
|
rHex = rHex.length() == 1 ? "0" + rHex : rHex;
|
||||||
gHex = gHex.length() == 1 ? "0" + gHex : gHex;
|
gHex = gHex.length() == 1 ? "0" + gHex : gHex;
|
||||||
bHex = bHex.length() == 1 ? "0" + bHex : bHex;
|
bHex = bHex.length() == 1 ? "0" + bHex : bHex;
|
||||||
|
Loading…
Reference in New Issue
Block a user