summaryrefslogtreecommitdiff
path: root/src/corelib/x11
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-10-05 21:47:13 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-10-05 21:47:13 +0000
commit8571f99a9f8e21d8e96999da505f9139621943b1 (patch)
treeef609a9c392b0d27eee20989fe9d30114acff0d3 /src/corelib/x11
parentff87ebe7afdf27042b7963ca04246963adbdcaab (diff)
downloadfpGUI-8571f99a9f8e21d8e96999da505f9139621943b1.tar.xz
* 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.
Diffstat (limited to 'src/corelib/x11')
-rw-r--r--src/corelib/x11/fpg_x11.pas29
-rw-r--r--src/corelib/x11/fpgui_toolkit.lpk6
-rw-r--r--src/corelib/x11/fpgui_toolkit.pas2
3 files changed, 28 insertions, 9 deletions
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 @@
<License Value="Modified LGPL
"/>
<Version Minor="6" Release="3"/>
- <Files Count="72">
+ <Files Count="73">
<Item1>
<Filename Value="../stdimages.inc"/>
<Type Value="Include"/>
@@ -318,6 +318,10 @@
<Filename Value="../../gui/fpg_spinedit.pas"/>
<UnitName Value="fpg_spinedit"/>
</Item72>
+ <Item73>
+ <Filename Value="../fpg_extgraphics.pas"/>
+ <UnitName Value="fpg_extgraphics"/>
+ </Item73>
</Files>
<LazDoc Paths="../../../docs/xml/corelib/;../../../docs/xml/corelib/x11/;../../../docs/xml/corelib/gdi/;../../../docs/xml/gui/"/>
<RequiredPkgs Count="1">
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