// Win95/NT4.0 ºÎÅÍ º£Áê(Bezier) °î¼±À» ±×¸± ¼ö ÀÖ´Â API°¡ Ãß°¡µÇ¾ú½À´Ï´Ù
// ±×·¯³ª, Delphi ÀÇ TCanvas ¿¡¼´Â Áö¿øµÇÁö ¾Ê½À´Ï´Ù
// ¹°·Ð API ¸¦ Á÷Á¢ È£ÃâÇÏ¸é »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù
// ¾Æ·¡ ¿¹Á¦´Â PolyBezierTo() API ¸¦ »ç¿ëÇØ Ÿ¿øÀ» ±×¸®´Â ¿¹Á¦ÀÔ´Ï´Ù
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure DrawCircle(dc: HDC; x, y, rx, ry: Integer);
var
pt: array [0..2] of TPoint;
cx, cy: Integer;
begin
cx := rx * 55 div 100;
cy := ry * 55 div 100;
MoveToEx(dc, x, y - ry, nil);
pt[0] := Point(x + cx, y - ry);
pt[1] := Point(x + rx, y - cy);
pt[2] := Point(x + rx, y );
PolyBezierTo(dc, pt, 3);
pt[0] := Point(x + rx, y + cy);
pt[1] := Point(x + cx, y + ry);
pt[2] := Point(x , y + ry);
PolyBezierTo(dc, pt, 3);
pt[0] := Point(x - cx, y + ry);
pt[1] := Point(x - rx, y + cy);
pt[2] := Point(x - rx, y );
PolyBezierTo(dc, pt, 3);
pt[0] := Point(x - rx, y - cy);
pt[1] := Point(x - cx, y - ry);
pt[2] := Point(x , y - ry);
PolyBezierTo(dc, pt, 3);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DrawCircle(Image1.Canvas.Handle, 50, 50, 40, 30);
end;
end. |
|