Fixes drawing of arcs in Windows with negative length and updates the parameter names in LCLIntf.Arc to the correct names which fully describes a arc: startangle and length

git-svn-id: trunk@29633 -
This commit is contained in:
sekelsenmat 2011-02-21 11:07:26 +00:00
parent aac7596990
commit 75192fa3f6
5 changed files with 16 additions and 11 deletions

View File

@ -28,7 +28,7 @@
//##apiwiz##sps## // Do not remove
function TWidgetSet.Arc(DC: HDC;
Left, Top, Right, Bottom, angle1, angle2: Integer): Boolean;
Left, Top, Right, Bottom, Angle16Deg, Angle16DegLength: Integer): Boolean;
var
Points : PPoint;
Count : Longint;
@ -36,7 +36,7 @@ begin
Result := False;
Points := nil;
Count := 0;
PolyBezierArcPoints(Left, Top, Right-Left, Bottom-Top, Angle1, Angle2, 0,
PolyBezierArcPoints(Left, Top, Right-Left, Bottom-Top, Angle16Deg, Angle16DegLength, 0,
Points, Count);
Polyline(DC, Points, Count);
ReallocMem(Points, 0);

View File

@ -33,9 +33,9 @@
******************************************************************************}
//##apiwiz##sps## // Do not remove
function Arc(DC: HDC; Left, Top, Right, Bottom, angle1, angle2: Integer): Boolean;
function Arc(DC: HDC; Left, Top, Right, Bottom, Angle16Deg, Angle16DegLength: Integer): Boolean;
begin
Result := WidgetSet.Arc(DC, Left, Top, Right, Bottom, angle1, angle2);
Result := WidgetSet.Arc(DC, Left, Top, Right, Bottom, Angle16Deg, Angle16DegLength);
end;
function AngleChord(DC: HDC; x1, y1, x2, y2, angle1, angle2: Integer): Boolean;

View File

@ -38,7 +38,7 @@
******************************************************************************}
//##apiwiz##sps## // Do not remove
function Arc(DC: HDC; Left,Top,Right,Bottom,angle1,angle2 : Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function Arc(DC: HDC; Left,Top,Right,Bottom,Angle16Deg, Angle16DegLength: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function AngleChord(DC: HDC; x1,y1,x2,y2,angle1,angle2 : Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function BeginPaint(Handle : hwnd; var PS : TPaintStruct): hdc; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}

View File

@ -46,8 +46,8 @@ const
Top - y-coordinate of bounding rectangle's upper-left corner
Right - x-coordinate of bounding rectangle's lower-right corner
Bottom - y-coordinate of bounding rectangle's lower-right corner
Angle1 - first angle
Angle2 - second angle
StartAngle - base angle
AngleLength - angle length
Returns: Whether the call was successful
Use Arc to draw an elliptically curved line with the current Pen.
@ -56,12 +56,17 @@ const
counter-clockwise while negative values mean clockwise direction.
Zero degrees is at the 3'o clock position.
------------------------------------------------------------------------------}
function TWin32WidgetSet.Arc(DC: HDC; Left, Top, Right, Bottom, Angle1, Angle2: Integer): Boolean;
function TWin32WidgetSet.Arc(DC: HDC; Left, Top, Right, Bottom, Angle16Deg, Angle16DegLength: Integer): Boolean;
var
SX, SY, EX, EY : Longint;
SX, SY, EX, EY, OldArcDirection: Longint;
begin
Angles2Coords(Left, Top, Right - Left, Bottom - Top, Angle1, Angle2, SX, SY, EX, EY);
if Angle16DegLength < 0 then OldArcDirection := Windows.SetArcDirection(DC, AD_CLOCKWISE)
else OldArcDirection := Windows.SetArcDirection(DC, AD_COUNTERCLOCKWISE);
Angles2Coords(Left, Top, Right - Left, Bottom - Top, Angle16Deg, Angle16DegLength, SX, SY, EX, EY);
Result := Boolean(Windows.Arc(DC, Left, Top, Right, Bottom, SX, SY, EX, EY));
// Revert the arc direction to the previous value
Windows.SetArcDirection(DC, OldArcDirection);
end;
{------------------------------------------------------------------------------

View File

@ -22,7 +22,7 @@
}
//##apiwiz##sps## // Do not remove
function Arc(DC: HDC; Left,Top, Right, Bottom, Angle1, Angle2: Integer): Boolean; override;
function Arc(DC: HDC; Left,Top, Right, Bottom, Angle16Deg, Angle16DegLength: Integer): Boolean; override;
function AngleChord(DC: HDC; x1, y1, x2, y2, angle1, angle2: Integer): Boolean; override;
function BeginPaint(Handle : hwnd; var PS : TPaintStruct): hdc; override;