git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1595 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
yangjixian
2011-04-22 13:35:22 +00:00
parent 8a6f96b85d
commit 9141eaa707
2 changed files with 50 additions and 1 deletions

View File

@ -88,6 +88,7 @@ procedure SprayPoints(DLBmp: TDLBitmap; X, Y: integer; Radians: integer; PColor:
function GetRColor(const Color: TColor): Byte;
function GetGColor(const Color: TColor): Byte;
function GetBColor(const Color: TColor): Byte;
procedure SprayPoints(aCanvas: TCanvas; X, Y: integer; Radians: Integer; PColor: TColor);
implementation
@ -377,7 +378,7 @@ end;
procedure TDLBitmap.Spray(x, y, radian: integer; PColor: TColor);
begin
SprayPoints(Self, x, y, radian, PColor);
SprayPoints(Self.Canvas, x, y, radian, PColor);
end;
procedure TDLBitmap.FillEllipse(X1, Y1, X2, Y2: integer);

View File

@ -558,5 +558,53 @@ begin
Result := (Color and $FF0000) shr 16;
end;
procedure SprayPoints(aCanvas: TCanvas; X, Y: integer; Radians: Integer; PColor: TColor);
var
i, a, b, temp, ci, center: Integer;
begin
if aCanvas = nil then
Exit;
Randomize;
for i := 0 to Radians do
begin
temp := Random(100);
a := Random(Round(Radians * 0.65));
if (temp < 50) then a := 0 - a;
temp := Random(100);
b := Random(Round(Radians * 0.65));
if (temp < 50) then b := 0 - b;
if (a * a + b * b < Sqr(Round(Radians * 0.65))) then
begin
aCanvas.Pixels[X + a, Y + b] := PColor;
end;
end;
for i := 0 to Radians div 3 do
begin
temp := Random(100);
a := Random(Round(Radians * 0.65));
if (temp < 50) then a := 0 - a;
temp := Random(100);
b := Random(Round(Radians * 0.65));
if (temp < 50) then b := 0 - b;
if (a * a + b * b < Sqr(Round(Radians * 0.65))) then
begin
aCanvas.Pixels[X + a, Y + b] := PColor;
end;
end;
for i := 0 to Radians * 2 div 3 do
begin
temp := Random(100);
a := Random(Round(Radians * 0.65));
if (temp < 50) then a := 0 - a;
temp := Random(100);
b := Random(Round(Radians * 0.65));
if (temp < 50) then b := 0 - b;
if (a * a + b * b < Sqr(Round(Radians * 0.65))) then
begin
aCanvas.Pixels[X + a, Y + b] := PColor;
end;
end;
end;