如何实现阴影镂空离散等特种文字效果? 下面是从l 得到 的一些实现特种文字效果的代码片断感兴趣的网友可以自己去看原文 // Shadow gsetColor(new Color( )); gdrawString(Shadow ShiftEast(x ) ShiftSouth(y )); gsetColor(new Color( )); gdrawString(Shadow x y); // Engrave gsetColor(new Color( )); gdrawString(Engrave ShiftEast(x ) ShiftSouth(y )); gsetColor(new Color( )); gdrawString(Engrave x y); file://Outline gsetColor(Colorred); gdrawString(Outline ShiftWest(x ) ShiftNorth(y )); gdrawString(Outline ShiftWest(x ) ShiftSouth(y )); gdrawString(Outline ShiftEast(x ) ShiftNorth(y )); gdrawString(Outline ShiftEast(x ) ShiftSouth(y )); gsetColor(Coloryellow); gdrawString(Outline x y); file://Hollow gsetColor(Colorblack); gdrawString(Hollow ShiftWest(x ) ShiftNorth(y )); gdrawString(Hollow ShiftWest(x ) ShiftSouth(y )); gdrawString(Hollow ShiftEast(x ) ShiftNorth(y )); gdrawString(Hollow ShiftEast(x ) ShiftSouth(y )); gsetColor(bg); gdrawString(Hollow x y); file://Segment int w = (ggetFontMetrics())stringWidth(Segment); int h = (ggetFontMetrics())getHeight(); int d = (ggetFontMetrics())getDescent(); gsetColor(new Color( )); gdrawString(Segment x y); gsetColor(bg); for (int i = ; i < h; i += 3) 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)); } |