This commit is contained in:
Looly 2022-07-29 21:39:01 +08:00
parent 4344834ac2
commit 22259e568f
2 changed files with 2 additions and 5 deletions

View File

@ -1400,11 +1400,6 @@ public class ImgUtil {
// 先用背景色填充整张图片,也就是背景 // 先用背景色填充整张图片,也就是背景
g.setColor(backgroundColor); g.setColor(backgroundColor);
g.fillRect(0, 0, width, height); g.fillRect(0, 0, width, height);
}else{
// 如果没有设置背景色则设置为透明背景
g.dispose();
image = image.createGraphics().getDeviceConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT);
g = image.getGraphics();
} }
g.setColor(ObjectUtil.defaultIfNull(fontColor, Color.BLACK)); g.setColor(ObjectUtil.defaultIfNull(fontColor, Color.BLACK));

View File

@ -148,6 +148,7 @@ public class ImgUtilTest {
} }
@Test @Test
@Ignore
public void createImageTest() throws IORuntimeException, IOException { public void createImageTest() throws IORuntimeException, IOException {
ImgUtil.createImage( ImgUtil.createImage(
"版权所有", "版权所有",
@ -159,6 +160,7 @@ public class ImgUtilTest {
} }
@Test @Test
@Ignore
public void createTransparentImageTest() throws IORuntimeException, IOException { public void createTransparentImageTest() throws IORuntimeException, IOException {
ImgUtil.createTransparentImage( ImgUtil.createTransparentImage(
"版权所有", "版权所有",