diff --git a/lcl/include/intfbasewinapi.inc b/lcl/include/intfbasewinapi.inc index 0a542ecef9..12b9d92b64 100644 --- a/lcl/include/intfbasewinapi.inc +++ b/lcl/include/intfbasewinapi.inc @@ -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); diff --git a/lcl/include/winapi.inc b/lcl/include/winapi.inc index 90dfac3bac..c4dd92e0ee 100644 --- a/lcl/include/winapi.inc +++ b/lcl/include/winapi.inc @@ -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; diff --git a/lcl/include/winapih.inc b/lcl/include/winapih.inc index adfec07d8f..5b9f06c4d1 100644 --- a/lcl/include/winapih.inc +++ b/lcl/include/winapih.inc @@ -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} diff --git a/lcl/interfaces/win32/win32winapi.inc b/lcl/interfaces/win32/win32winapi.inc index bef24b9e08..d3bd8057b1 100644 --- a/lcl/interfaces/win32/win32winapi.inc +++ b/lcl/interfaces/win32/win32winapi.inc @@ -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; {------------------------------------------------------------------------------ diff --git a/lcl/interfaces/win32/win32winapih.inc b/lcl/interfaces/win32/win32winapih.inc index 1df91a9152..aaba1e391f 100644 --- a/lcl/interfaces/win32/win32winapih.inc +++ b/lcl/interfaces/win32/win32winapih.inc @@ -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;