更改BufferedImage的Alpha值? [英] Change the alpha value of a BufferedImage?
本文介绍了更改BufferedImage的Alpha值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Java中更改BufferedImage的全局Alpha值? (IE让图像中每个具有100的alpha值的像素都具有80的alpha值)
解决方案
相信有一个简单的命令来做到这一点。有几个选项:
li>
第一个是最简单的实现,IMO。
How do I change the global alpha value of a BufferedImage in Java? (I.E. make every pixel in the image that has a alpha value of 100 have a alpha value of 80)
解决方案
I don't believe there's a single simple command to do this. A few options:
- copy into another image with an AlphaComposite specified (downside: not converted in place)
- directly manipulate the raster (downside: can lead to unmanaged images)
- use a filter or BufferedImageOp
The first is the simplest to implement, IMO.
这篇关于更改BufferedImage的Alpha值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文