mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
fix scale with bg
This commit is contained in:
parent
fdcf383bfc
commit
814aa3d662
@ -13,6 +13,7 @@
|
||||
### Bug修复
|
||||
* 【core】 修复DateUtil.format使用DateTime时区失效问题(issue#I150I7@Gitee)
|
||||
* 【core】 修复ZipUtil解压目录遗留问题(issue#I14NO3@Gitee)
|
||||
* 【core】 修复等比缩放给定背景色无效问题(pr#625@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -279,14 +279,14 @@ public class Img implements Serializable {
|
||||
double widthRatio = NumberUtil.div(width, srcWidth);
|
||||
if (heightRatio == widthRatio) {
|
||||
// 长宽都按照相同比例缩放时,返回缩放后的图片
|
||||
return scale(width, height);
|
||||
}
|
||||
|
||||
// 宽缩放比例多就按照宽缩放,否则按照高缩放
|
||||
if (widthRatio < heightRatio) {
|
||||
scale(width, (int) (srcHeight * widthRatio));
|
||||
} else {
|
||||
scale((int) (srcWidth * heightRatio), height);
|
||||
scale(width, height);
|
||||
} else{
|
||||
// 宽缩放比例多就按照宽缩放,否则按照高缩放
|
||||
if (widthRatio < heightRatio) {
|
||||
scale(width, (int) (srcHeight * widthRatio));
|
||||
} else {
|
||||
scale((int) (srcWidth * heightRatio), height);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取缩放后的新的宽和高
|
||||
|
Loading…
Reference in New Issue
Block a user