mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-02 20:18:15 +02:00
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:
parent
aac7596990
commit
75192fa3f6
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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}
|
||||
|
@ -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;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user