如何實現陰影
下面是從l 得到
的一些實現特種文字效果的代碼片斷
// Shadow
g
g
g
g
// Engrave
g
g
g
g
file://Outline
g
g
g
g
g
g
g
file://Hollow
g
g
g
g
g
g
g
file://Segment
int w = (g
int h = (g
int d = (g
g
g
g
for (int i =
g.drawLine(x, y + d - i, x + w, y + d - i);
file://3D Effects
Color top_color = new Color(200, 200, 0);
Color side_color = new Color(100, 100, 0);
for (int i = 0; i < 5; i++)
{
g.setColor(top_color);
g.drawString("3-Dimension", ShiftEast(x, i), ShiftNorth(ShiftSouth(y, i), 1));
g.setColor(side_color);
g.drawString("3-Dimension", ShiftWest(ShiftEast(x, i), 1), ShiftSouth(y, ii));
}
g.setColor(Color.yellow);
g.drawString("3-Dimension", ShiftEast(x, 5), ShiftSouth(y, 5));
file://Motion
for (int i = 0; i < 20; i++)
{
font_size = 12 + i;
g.setFont(new Font("TimesRoman", Font.PLAIN, font_size));
w = (g.getFontMetrics()).stringWidth("Motion");
g.setColor(new Color(0, 65 + i * 10, 0));
g.drawString("Motion", (width - w) / 2, ShiftSouth(y, speed * i));
}
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/11132.html