mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-19 19:19:32 +01:00
+ added arc,ellipse,fillelipse,sector,pieslice
This commit is contained in:
parent
de9ddbbc7b
commit
f087270d00
@ -66,12 +66,7 @@ unit Graph;
|
|||||||
SetTextStyle
|
SetTextStyle
|
||||||
FillPoly
|
FillPoly
|
||||||
FloodFill
|
FloodFill
|
||||||
GetArcCoords
|
|
||||||
Arc
|
|
||||||
SetAspectRatio
|
SetAspectRatio
|
||||||
PieSlice
|
|
||||||
Sector
|
|
||||||
|
|
||||||
|
|
||||||
(please remove what you implement fom this list)
|
(please remove what you implement fom this list)
|
||||||
}
|
}
|
||||||
@ -1277,13 +1272,32 @@ end;
|
|||||||
|
|
||||||
{ Nonlinearly bounded primitives
|
{ Nonlinearly bounded primitives
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Var LastArcCoords : ArcCoordsType;
|
||||||
|
|
||||||
|
|
||||||
|
procedure SetArcCoords (X,y,xradius,yradius,Stangle,endangle : integer);
|
||||||
|
|
||||||
|
begin
|
||||||
|
LastArcCoords.X:=X;
|
||||||
|
LastArccOords.y:=y;
|
||||||
|
Lastarccoords.xstart:=x+round(xradius*cos(stangle*pi/180));
|
||||||
|
Lastarccoords.ystart:=y-round(yradius*sin(stangle*pi/180));
|
||||||
|
LastArccoords.xend:=x+round(xradius*cos(endangle*pi/180));
|
||||||
|
LastArccoords.yend:=y-round(yradius*sin(endangle*pi/180));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure GetArcCoords(var ArcCoords: ArcCoordsType);
|
procedure GetArcCoords(var ArcCoords: ArcCoordsType);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
ArcCoords:=LastArcCoords;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Arc(X, Y: Integer; StAngle, EndAngle, Radius: Word);
|
procedure Arc(X, Y: Integer; StAngle, EndAngle, Radius: Word);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Ellipse (X,y,stangle,endangle,Radius,radius);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Circle(X, Y: Integer; Radius: Word);
|
procedure Circle(X, Y: Integer; Radius: Word);
|
||||||
@ -1294,12 +1308,44 @@ end;
|
|||||||
|
|
||||||
procedure Ellipse(X, Y: Integer;
|
procedure Ellipse(X, Y: Integer;
|
||||||
StAngle, EndAngle: Word; XRadius, YRadius : Word);
|
StAngle, EndAngle: Word; XRadius, YRadius : Word);
|
||||||
|
|
||||||
|
Var I : longint;
|
||||||
|
tmpang : real;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
SetArcCoords (X,Y,xradius,yradius,Stangle,EndAngle);
|
||||||
|
For i:= StAngle To EndAngle Do
|
||||||
|
Begin
|
||||||
|
tmpAng:= i*Pi/180;
|
||||||
|
curX:= X + Round (xRadius*Cos (tmpAng));
|
||||||
|
curY:= Y - Round (YRadius*Sin (tmpAng));
|
||||||
|
PutPixel (curX, curY, TheColor);
|
||||||
|
End;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FillEllipse(X, Y: Integer; XRadius, YRadius : Word);
|
procedure FillEllipse(X, Y: Integer; XRadius, YRadius : Word);
|
||||||
|
|
||||||
|
Var I,tmpcolor : longint;
|
||||||
|
tmpang : real;
|
||||||
|
tmpx,tmpy : Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Bar(X - XRadius, Y - YRadius, X + XRadius, Y + YRadius);
|
tmpcolor:=Thecolor;
|
||||||
|
SetColor(TheFillColor);
|
||||||
|
For i:= 0 to 180 Do
|
||||||
|
Begin
|
||||||
|
tmpAng:= i*Pi/180;
|
||||||
|
curX:= Round (xRadius*Cos (tmpAng));
|
||||||
|
curY:= Round (YRadius*Sin (tmpAng));
|
||||||
|
tmpX:= X - curx;
|
||||||
|
tmpy:= Y + cury;
|
||||||
|
curx:=x+curx;
|
||||||
|
cury:=y-cury;
|
||||||
|
Line (curX, curY,tmpx,tmpy);
|
||||||
|
PutPixel (curx,cury,tmpcolor);
|
||||||
|
PutPixel (tmpx,tmpy,tmpcolor);
|
||||||
|
End;
|
||||||
|
SetColor(tmpcolor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure SetAspectRatio(Xasp, Yasp: Word);
|
procedure SetAspectRatio(Xasp, Yasp: Word);
|
||||||
@ -1307,12 +1353,47 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure PieSlice(X, Y: Integer; StAngle, EndAngle, Radius: Word);
|
procedure PieSlice(X, Y: Integer; StAngle, EndAngle, Radius: Word);
|
||||||
begin
|
|
||||||
|
Var i,tmpcolor: Word;
|
||||||
|
ac : arccoordstype;
|
||||||
|
|
||||||
|
Begin
|
||||||
|
tmpcolor:=thecolor;
|
||||||
|
setcolor(thefillcolor);
|
||||||
|
For i:= 0 To Radius Do
|
||||||
|
Arc (X, Y, StAngle, EndAngle, i);
|
||||||
|
setcolor(tmpcolor);
|
||||||
|
{ Border using current color}
|
||||||
|
arc (X,y,stangle,endangle,Radius);
|
||||||
|
getarccoords(ac);
|
||||||
|
Line (x,y,ac.xstart,ac.ystart);
|
||||||
|
Line (x,y,ac.xend,ac.yend);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Sector(X, Y: Integer;
|
procedure Sector(X, Y: Integer;
|
||||||
StAngle, EndAngle, XRadius, YRadius: Word);
|
StAngle, EndAngle, XRadius, YRadius: Word);
|
||||||
|
|
||||||
|
Var I,tmpcolor : longint;
|
||||||
|
tmpang : real;
|
||||||
|
tmpx,tmpy : Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
tmpcolor:=Thecolor;
|
||||||
|
SetColor(TheFillColor);
|
||||||
|
For i:= stangle to endangle Do
|
||||||
|
Begin
|
||||||
|
tmpAng:= i*Pi/180;
|
||||||
|
curX:= Round (xRadius*Cos (tmpAng));
|
||||||
|
curY:= Round (YRadius*Sin (tmpAng));
|
||||||
|
tmpX:= X - curx;
|
||||||
|
tmpy:= Y + cury;
|
||||||
|
curx:=x+curx;
|
||||||
|
cury:=y-cury;
|
||||||
|
Line (curX, curY,tmpx,tmpy);
|
||||||
|
PutPixel (curx,cury,tmpcolor);
|
||||||
|
PutPixel (tmpx,tmpy,tmpcolor);
|
||||||
|
End;
|
||||||
|
SetColor(tmpcolor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Color routines
|
{ Color routines
|
||||||
@ -1422,7 +1503,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 1998-08-10 09:01:58 michael
|
Revision 1.4 1998-08-12 13:25:33 michael
|
||||||
|
+ added arc,ellipse,fillelipse,sector,pieslice
|
||||||
|
|
||||||
|
Revision 1.3 1998/08/10 09:01:58 michael
|
||||||
+ Added some functions to improve compatibility
|
+ Added some functions to improve compatibility
|
||||||
|
|
||||||
Revision 1.2 1998/05/12 10:42:47 peter
|
Revision 1.2 1998/05/12 10:42:47 peter
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user