J
J2EE
Unregistered / Unconfirmed
GUEST, unregistred user!
//我用下面的方法只能简单的实现.
procedure TForm1.FormPaint(Sender: TObject);
var
r: TRect;
hRgn: Integer;
i, j: Integer;
n: Double;
c: TColor;
begin
BeginPath(Canvas.Handle);
r := GetClientRect;
Canvas.Brush.Style := bsClear;
Canvas.Font.Size := 60;
DrawText(Canvas.Handle, 'YWBTAXI@YEAH.NET', -1, r, DT_SINGLELINE or DT_CENTER or DT_VCENTER);
EndPath(Canvas.Handle);
hRgn := PathToRegion(Canvas.Handle);
GetRgnBox(hRgn, r);
n := (r.Right - r.Left) / 255;
for i := r.Left to r.Right do
begin
for j := r.Top to r.Bottom do
if PtInRegion(hRgn, i, j) then
begin
if n <= 1 then
c := RGB(255, (i - r.Left), 0)
else
c := RGB(255, Round((i - r.Left) / n), 0);
Canvas.Pixels[i, j] := c
end;
end;
end;
procedure TForm1.FormPaint(Sender: TObject);
var
r: TRect;
hRgn: Integer;
i, j: Integer;
n: Double;
c: TColor;
begin
BeginPath(Canvas.Handle);
r := GetClientRect;
Canvas.Brush.Style := bsClear;
Canvas.Font.Size := 60;
DrawText(Canvas.Handle, 'YWBTAXI@YEAH.NET', -1, r, DT_SINGLELINE or DT_CENTER or DT_VCENTER);
EndPath(Canvas.Handle);
hRgn := PathToRegion(Canvas.Handle);
GetRgnBox(hRgn, r);
n := (r.Right - r.Left) / 255;
for i := r.Left to r.Right do
begin
for j := r.Top to r.Bottom do
if PtInRegion(hRgn, i, j) then
begin
if n <= 1 then
c := RGB(255, (i - r.Left), 0)
else
c := RGB(255, Round((i - r.Left) / n), 0);
Canvas.Pixels[i, j] := c
end;
end;
end;