g*****g 发帖数: 34805 | 1 If I want to reset a BufferedImage to a transparent empty image,
(so that I can change the content of image to paint)
I am doing a new BufferedImage(BufferedImage.INT_ARGB) now,
anyway I can fill the raster instead?
I am worried if this frequent memory allocation would be a big
burden for GC and degrade performance. | m******t 发帖数: 2416 | 2
Isn't this faster than actually painting it anyway?
I wouldn't worry about it. Speaking of object allocation and GC,
there is an ongoing thread on TSS that might be some good read:
http://www.theserverside.com/news/thread.tss?thread_id=36832
【在 g*****g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : If I want to reset a BufferedImage to a transparent empty image, : (so that I can change the content of image to paint) : I am doing a new BufferedImage(BufferedImage.INT_ARGB) now, : anyway I can fill the raster instead? : I am worried if this frequent memory allocation would be a big : burden for GC and degrade performance.
| c*****t 发帖数: 1879 | 3 in addition to what magicfat said, you can do direct DataBufferInt
manipulation to set all values to zeros. Of course, new a BufferedImage
is faster in every way you look at :P
【在 g*****g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : If I want to reset a BufferedImage to a transparent empty image, : (so that I can change the content of image to paint) : I am doing a new BufferedImage(BufferedImage.INT_ARGB) now, : anyway I can fill the raster instead? : I am worried if this frequent memory allocation would be a big : burden for GC and degrade performance.
|
|