日期:2014-05-17  浏览次数:20859 次

XP可用的GDI+发光字画法...
本帖最后由 qq6648208281 于 2012-08-14 11:06:46 编辑
可以再XP下也能绘制发光字...

效果还不是很好.. 有些偏移.



算法还能改进

 public void Luminous(Graphics g, int Fuzzy, Rectangle Rect, string Text, Rectangle Textrect, Font Font, int FontColor, int ShadowColor)
        {

            Bitmap Bit1 = new Bitmap(Rect .Width , Rect .Height , System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            Graphics g1 = Graphics.FromImage(Bit1);
            g1.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g1.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
            g1.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.AssumeLinear;
            Bitmap Bit2 = new Bitmap(Rect.Width / Fuzzy, Rect.Height / Fuzzy, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            Graphics g2 = Graphics.FromImage(Bit2);
            g2.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            g2.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
            //布局
            
            int cb = ShadowColor / 65536;
            int cg = (ShadowColor - cb* 65536) / 256;
            int cr = ShadowColor  - (cb * 65536) - (cg * 256);

            SolidBrush B = new SolidBrush (Color .FromArgb (255,cr,cg,cb));
            GraphicsPath path = new GraphicsPath();

            path.AddString(Text, Font.FontFamily, (int)(FontStyle.Bold), Font.Size, Textrect , new StringFormat());
            g1.FillPath(B, path);
            path.Dispose();
            //绘制文字

            Auxiliary_Console.ts1(Fuzzy.ToString());
            g2.DrawImage(Bit1 ,0,0,Rect .Width / Fuzzy ,Rect .Height /Fuzzy );
            g1