一个很笨的字体勾边的方法(这个方法简单聪明,而且通用)

[delphi] view plain copy
 
 print?
  1. unit Unit1;  
  2.   
  3. interface  
  4.   
  5. uses  
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  
  7.   Dialogs, StdCtrls, ExtCtrls;  
  8.   
  9. type  
  10.   TForm1 = class(TForm)  
  11.     img_1: TImage;  
  12.     Btn_1: TButton;  
  13.     Btn_2: TButton;  
  14.     procedure Btn_1Click(Sender: TObject);  
  15.     procedure Btn_2Click(Sender: TObject);  
  16.   private  
  17.     { Private declarations }  
  18.   public  
  19.     { Public declarations }  
  20.   end;  
  21.   
  22. var  
  23.   Form1: TForm1;  
  24.   
  25. implementation  
  26.   
  27. {$R *.dfm}  
  28.   
  29. procedure TForm1.Btn_1Click(Sender: TObject);  
  30. begin  
  31.   img_1.Canvas.Font.Size :=140;  
  32.   img_1.Canvas.Font.Name := '华文行楷';  
  33.   img_1.Canvas.TextOut( 5,5,'罗韵睿');  
  34. end;  
  35.   
  36. procedure TForm1.Btn_2Click(Sender: TObject);  
  37.   procedure SetPointerColor(x,y:Integer);  
  38.   begin  
  39.     if img_1.Canvas.Pixels[x,y] <>clBlack then  
  40.       img_1.Canvas.Pixels[x,y] := clRed;  
  41.   end;  
  42. var  
  43.   i,j :Integer;  
  44.   p:Pointer;  
  45. begin  
  46.   for I := to img_1.Width -do  
  47.   for j := to img_1.Height - do begin  
  48.     if img_1.Canvas.Pixels[i,j] =clBlack then begin  
  49.       SetPointerColor(i-1,j);  
  50.       SetPointerColor(i+1,j);  
  51.       SetPointerColor(i,j-1);  
  52.       SetPointerColor(i,j+1);  
  53.       SetPointerColor(i+1,j+1);  
  54.       SetPointerColor(i-1,j-1);  
  55.       SetPointerColor(i-1,j+1);  
  56.       SetPointerColor(i+1,j-1);  
  57.     end;  
  58.   end;  
  59. end;  
  60.   
  61. end.  

http://blog.csdn.net/aroc_lo/article/details/46976957

原文地址:https://www.cnblogs.com/findumars/p/5400232.html