From 8571f99a9f8e21d8e96999da505f9139621943b1 Mon Sep 17 00:00:00 2001 From: graemeg Date: Sun, 5 Oct 2008 21:47:13 +0000 Subject: * Added a new Canvas.DrawPolygon() method * Added a new unit fpg_extgraphics.pas with extensive shape drawing methods * Added a new conversion method called fpgRectToRect() * Replaced the implementation of TfpgStyle.DrawDirectionArrow to use the new fpg_extgraphics.PaintTriangle() method instead. * Adjusted ComboBox painting of internal button to accomodate the new fpg_extgraphics unit. * Added Jean-Marc's new fpg_spinedit unit. * Made some further improvements and minor fixes to the SpinEdit and SpinEditFloat components. * renamed the fpdoc file fpgfx.xml to fpg_main.xml as per the new unit names. --- src/corelib/x11/fpg_x11.pas | 29 ++++++++++++++++++++++------- src/corelib/x11/fpgui_toolkit.lpk | 6 +++++- src/corelib/x11/fpgui_toolkit.pas | 2 +- 3 files changed, 28 insertions(+), 9 deletions(-) (limited to 'src/corelib/x11') diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index 4c7fa049..010fda63 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -195,6 +195,7 @@ type procedure SetPixel(X, Y: integer; const AValue: TfpgColor); override; procedure DoDrawArc(x, y, w, h: TfpgCoord; a1, a2: Extended); override; procedure DoFillArc(x, y, w, h: TfpgCoord; a1, a2: Extended); override; + procedure DoDrawPolygon(Points: PPoint; NumPts: Integer; Winding: boolean=False); override; property DCHandle: TfpgDCHandle read FDrawHandle; public constructor Create; override; @@ -1918,6 +1919,23 @@ begin Trunc(64 * a1), Trunc(64 * a2)); end; +procedure TfpgCanvasImpl.DoDrawPolygon(Points: fpg_base.PPoint; NumPts: Integer; Winding: boolean); +var + PointArray: PXPoint; + i: integer; +begin + { convert TPoint to TXPoint } + GetMem(PointArray, SizeOf(TXPoint)*(NumPts+1)); // +1 for return line + for i := 0 to NumPts-1 do + begin + PointArray[i].x := Points[i].x; + PointArray[i].y := Points[i].y; + end; + XFillPolygon(xapplication.display, FDrawHandle, Fgc, PointArray, NumPts, CoordModeOrigin, X.Complex); + if PointArray <> nil then + FreeMem(PointArray); +end; + procedure TfpgCanvasImpl.BufferFreeTimer(Sender: TObject); begin {$IFDEF DEBUG} @@ -2039,14 +2057,11 @@ procedure TfpgCanvasImpl.DoFillTriangle(x1, y1, x2, y2, x3, y3: TfpgCoord); var pts: array[1..3] of TXPoint; begin - pts[1].x := x1; - pts[1].y := y1; - pts[2].x := x2; - pts[2].y := y2; - pts[3].x := x3; - pts[3].y := y3; + pts[1].x := x1; pts[1].y := y1; + pts[2].x := x2; pts[2].y := y2; + pts[3].x := x3; pts[3].y := y3; - XFillPolygon(xapplication.display, FDrawHandle, Fgc, @pts, 3, 0, 0); + XFillPolygon(xapplication.display, FDrawHandle, Fgc, @pts, 3, CoordModeOrigin, X.Complex); end; procedure TfpgCanvasImpl.DoDrawRectangle(x, y, w, h: TfpgCoord); diff --git a/src/corelib/x11/fpgui_toolkit.lpk b/src/corelib/x11/fpgui_toolkit.lpk index 7329a3bb..55614af2 100644 --- a/src/corelib/x11/fpgui_toolkit.lpk +++ b/src/corelib/x11/fpgui_toolkit.lpk @@ -29,7 +29,7 @@ - + @@ -318,6 +318,10 @@ + + + + diff --git a/src/corelib/x11/fpgui_toolkit.pas b/src/corelib/x11/fpgui_toolkit.pas index 953d2aa1..b7c3da23 100644 --- a/src/corelib/x11/fpgui_toolkit.pas +++ b/src/corelib/x11/fpgui_toolkit.pas @@ -17,7 +17,7 @@ uses fpg_iniutils, fpg_label, fpg_listbox, fpg_listview, fpg_memo, fpg_menu, fpg_mru, fpg_panel, fpg_popupcalendar, fpg_progressbar, fpg_radiobutton, fpg_scrollbar, fpg_style, fpg_tab, fpg_trackbar, fpg_tree, fpgui_db, - fpg_splitter, fpg_hint, fpg_spinedit; + fpg_splitter, fpg_hint, fpg_spinedit, fpg_extgraphics; implementation -- cgit v1.2.3-70-g09d2