熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Javascript >> 正文

實現陰影、镂空、離散等特種文字效果

2022-06-13   來源: Javascript 

  如何實現陰影镂空離散等特種文字效果?
  
   下面是從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));
   }

From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/11132.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.