mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
fix code
This commit is contained in:
@@ -299,7 +299,7 @@ public class BackgroundRemoval {
|
||||
}
|
||||
}
|
||||
|
||||
final Map<String, Integer> map = new HashMap<>(list.size());
|
||||
final Map<String, Integer> map = new HashMap<>(list.size(), 1);
|
||||
for (final String string : list) {
|
||||
Integer integer = map.get(string);
|
||||
if (integer == null) {
|
||||
@@ -309,7 +309,7 @@ public class BackgroundRemoval {
|
||||
}
|
||||
map.put(string, integer);
|
||||
}
|
||||
String max = "";
|
||||
String max = StrUtil.EMPTY;
|
||||
long num = 0;
|
||||
for (final Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||
final String key = entry.getKey();
|
||||
@@ -326,7 +326,7 @@ public class BackgroundRemoval {
|
||||
return ImgUtil.toHex(Integer.parseInt(strings[0]), Integer.parseInt(strings[1]),
|
||||
Integer.parseInt(strings[2]));
|
||||
}
|
||||
return "";
|
||||
return StrUtil.EMPTY;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------- private
|
||||
|
||||
@@ -1356,6 +1356,19 @@ public class ImgUtil {
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文字创建透明背景的PNG图片
|
||||
*
|
||||
* @param str 文字
|
||||
* @param font 字体{@link Font}
|
||||
* @param fontColor 字体颜色,默认黑色
|
||||
* @param out 图片输出地
|
||||
* @throws IORuntimeException IO异常
|
||||
*/
|
||||
public static void createTransparentImage(String str, Font font, Color fontColor, ImageOutputStream out) throws IORuntimeException {
|
||||
writePng(createImage(str, font, null, fontColor, BufferedImage.TYPE_INT_ARGB), out);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文字创建PNG图片
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user