gtk1/2 intf: fixed Arc

git-svn-id: trunk@9472 -
This commit is contained in:
mattias 2006-06-22 02:41:09 +00:00
parent 486838638b
commit 9b52c9bc1d
4 changed files with 11 additions and 5 deletions

View File

@ -978,7 +978,7 @@ type
NumPts: Integer = -1); NumPts: Integer = -1);
procedure Polygon(Points: PPoint; NumPts: Integer; procedure Polygon(Points: PPoint; NumPts: Integer;
Winding: boolean = False); virtual; Winding: boolean = False); virtual;
Procedure Polygon(const Points: array of TPoint); // already in fpcanvas procedure Polygon(const Points: array of TPoint); // already in fpcanvas
procedure Polyline(const Points: array of TPoint; procedure Polyline(const Points: array of TPoint;
StartIndex: Integer; StartIndex: Integer;
NumPts: Integer = -1); NumPts: Integer = -1);

View File

@ -36,7 +36,8 @@ begin
Result := False; Result := False;
Points := nil; Points := nil;
Count := 0; Count := 0;
PolyBezierArcPoints(Left, Top, Right-Left, Bottom-Top, Angle1, Angle2, 0, Points, Count); PolyBezierArcPoints(Left, Top, Right-Left, Bottom-Top, Angle1, Angle2, 0,
Points, Count);
Polygon(DC, Points, Count, False); Polygon(DC, Points, Count, False);
ReallocMem(Points, 0); ReallocMem(Points, 0);
Result := True; Result := True;
@ -1451,4 +1452,4 @@ begin
Result := 0; Result := 0;
end; end;
//##apiwiz##eps## // Do not remove //##apiwiz##eps## // Do not remove

View File

@ -165,7 +165,7 @@ var
ImgIndex: integer; ImgIndex: integer;
TS: TTextStyle; TS: TTextStyle;
begin begin
//DebugLn('TToolButton.Paint A ',Name,' FToolBar=',DbgS(FToolBar),' ',ClientWidth,',',ClientHeight,' ',ord(Style)); //DebugLn(['TToolButton.Paint A ',DbgSName(Self),' FToolBar=',DbgSName(FToolBar),' ',ClientWidth,',',ClientHeight,' ',ord(Style)]);
if (FToolBar<>nil) and (ClientWidth>0) and (ClientHeight>0) then begin if (FToolBar<>nil) and (ClientWidth>0) and (ClientHeight>0) then begin
PaintRect:=ClientRect; // the whole paint area PaintRect:=ClientRect; // the whole paint area

View File

@ -48,6 +48,9 @@ const
circle equals 5760 (16*360). Positive values of Angle and AngleLength mean circle equals 5760 (16*360). Positive values of Angle and AngleLength mean
counter-clockwise while negative values mean clockwise direction. counter-clockwise while negative values mean clockwise direction.
Zero degrees is at the 3'o clock position. Zero degrees is at the 3'o clock position.
Angle1 is the starting angle. Angle2 is relative to Angle1 (added).
Example:
Angle1 = 10*16, Angle2 = 30*16 will draw an arc from 10 to 40 degree.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TGtkWidgetSet.Arc(DC: HDC; function TGtkWidgetSet.Arc(DC: HDC;
@ -75,9 +78,11 @@ begin
DCOrigin:=GetDCOffset(TDeviceContext(DC)); DCOrigin:=GetDCOffset(TDeviceContext(DC));
inc(Left,DCOrigin.X); inc(Left,DCOrigin.X);
inc(Top,DCOrigin.Y); inc(Top,DCOrigin.Y);
inc(Right,DCOrigin.X);
inc(Bottom,DCOrigin.Y);
{$IFDEF DebugGDKTraps}BeginGDKErrorTrap;{$ENDIF} {$IFDEF DebugGDKTraps}BeginGDKErrorTrap;{$ENDIF}
gdk_draw_arc(Drawable, GC, 0, left, top, right - left, bottom - top, gdk_draw_arc(Drawable, GC, 0, left, top, right - left, bottom - top,
Angle1 shl 2, Angle2 shl 2); Angle1*4, Angle2*4);
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF} {$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
end else end else
Result:=false; Result:=false;