java 窗体阴影,如何在Java Swing中创建阴影,内部发光和外部发光?

I am generating some images using the Graphics2D interface, and occasionally I'd like to be able to draw some text on the image and apply to it effects like the ones in Adobe Photoshop.

Right now to generate a 'shadow' on the text I am drawing the text twice, once in the original color, and once in black with a slight (1px) x&y offset. Unfortunately this is overly simplistic as I need more control over the shadow (opacity,size, spread).

As for Inner Glows and Outer Glows, I am not really sure where to start; a mask/gradient paint/alpha blending?

Is there a Java library for producing these types of effects? If not how would you go about creating these effects?

解决方案

I would highly recommend the book Filthy Rich Clients. Chapter 16 talks about drop shadows. You also might be interested in the this blog post. Chapter 17 talks about the glowing effect. There is example code on the website for both. The rest of the book is well worth reading as well. I couldn't put the book down when I read it. There are many other fun effects explained and demonstrated in the book.

The jhlabs site is also a good site, as mentioned.

Edit:

For a library, I would look at Painters in the SwingX library. Here are several tutorials:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值