mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 06:19:17 +02:00
+ Added Polygon(), PolyLine(), PolyBezier() into qtwinapi.
* BUGFIX ClientToScreen() TPoint -> TQtPoint. git-svn-id: trunk@11508 -
This commit is contained in:
parent
16c9905f94
commit
bb25ce3e56
@ -90,10 +90,18 @@ end;
|
|||||||
Returns:
|
Returns:
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TQtWidgetSet.ClientToScreen(Handle: HWND; var P: TPoint) : Boolean;
|
function TQtWidgetSet.ClientToScreen(Handle: HWND; var P: TPoint) : Boolean;
|
||||||
|
var
|
||||||
|
APoint: TQtPoint;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
if Handle <> 0 then
|
if Handle <> 0 then
|
||||||
QWidget_mapToGlobal(TQtWidget(Handle).Widget, @P, @P);
|
begin
|
||||||
|
APoint.x := P.X;
|
||||||
|
APoint.y := P.Y;
|
||||||
|
QWidget_mapToGlobal(TQtWidget(Handle).Widget, @APoint, @APoint);
|
||||||
|
P.X := APoint.x;
|
||||||
|
P.Y := APoint.y;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -2376,6 +2384,63 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Function: PolyBezier
|
||||||
|
Params: DC: HDC; Points: PPoint; NumPts: Integer; Filled: Boolean;
|
||||||
|
Continuous: Boolean
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TQtWidgetSet.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer;
|
||||||
|
Filled, Continuous: Boolean): Boolean;
|
||||||
|
begin
|
||||||
|
{$ifdef VerboseQtWinAPI}
|
||||||
|
WriteLn('[WinAPI PolyBezier] DC: ', dbghex(DC));
|
||||||
|
{$endif}
|
||||||
|
Result := inherited PolyBezier(DC, Points, NumPts, Filled, Continuous);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Function: Polygon
|
||||||
|
Params: DC: HDC; Points: PPoint; NumPts: Integer; Winding: Boolean
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TQtWidgetSet.Polygon(DC: HDC; Points: PPoint; NumPts: Integer;
|
||||||
|
Winding: Boolean): boolean;
|
||||||
|
var
|
||||||
|
ARect: TRect;
|
||||||
|
ADC : TQtDeviceContext;
|
||||||
|
begin
|
||||||
|
{$ifdef VerboseQtWinAPI}
|
||||||
|
WriteLn('[WinAPI Polygon] DC: ', dbghex(DC));
|
||||||
|
{$endif}
|
||||||
|
Result := IsValidDC(DC);
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
{TODO: discuss with other developers about antialiasing by default}
|
||||||
|
// QPainter_setRenderHint(TQtDeviceContext(DC).Widget, QPainterAntialiasing, True);
|
||||||
|
if Winding
|
||||||
|
then
|
||||||
|
QPainter_drawPolygon(TQtDeviceContext(DC).Widget, PQtPoint(Points), NumPts, QtWindingFill)
|
||||||
|
else
|
||||||
|
QPainter_drawPolygon(TQtDeviceContext(DC).Widget, PQtPoint(Points), NumPts, QtOddEvenFill);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Function: Polyline
|
||||||
|
Params: DC: HDC; Points: PPoint; NumPts: Integer
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TQtWidgetSet.Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean;
|
||||||
|
begin
|
||||||
|
{$ifdef VerboseQtWinAPI}
|
||||||
|
WriteLn('[WinAPI Polyline] DC: ', dbghex(DC));
|
||||||
|
{$endif}
|
||||||
|
Result := IsValidDC(DC);
|
||||||
|
if Result then
|
||||||
|
QPainter_drawPolyline(TQtDeviceContext(DC).Widget, PQtPoint(Points), NumPts);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: Rectangle
|
Function: Rectangle
|
||||||
Params: DC: HDC; X1, Y1, X2, Y2: Integer
|
Params: DC: HDC; X1, Y1, X2, Y2: Integer
|
||||||
|
@ -95,6 +95,10 @@ function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
|
|||||||
|
|
||||||
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
||||||
|
|
||||||
|
function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
|
||||||
|
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;
|
||||||
|
function Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean; override;
|
||||||
|
|
||||||
function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; override;
|
function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; override;
|
||||||
function ReleaseDC(hWnd: HWND; DC: HDC): Integer; override;
|
function ReleaseDC(hWnd: HWND; DC: HDC): Integer; override;
|
||||||
function RestoreDC(DC: HDC; SavedDC: Integer): Boolean; override;
|
function RestoreDC(DC: HDC; SavedDC: Integer): Boolean; override;
|
||||||
|
Loading…
Reference in New Issue
Block a user