summaryrefslogtreecommitdiff
path: root/examples/corelib
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-27 14:50:37 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-27 14:50:37 +0000
commit79f3d57b899e797fe9acc116146bf64e0327deb9 (patch)
treea02e2380024dc329a7872bc33e700f7f01f061dd /examples/corelib
parent3abd19af870b83175359c2e1e0af063123d14635 (diff)
downloadfpGUI-79f3d57b899e797fe9acc116146bf64e0327deb9.tar.xz
X11 only:
* Fixed a bug in the SetLineStyle which caused inaccurate line drawing. This eluded me for ages. * Started the process of removing TfpgRect and replacing it with the standard Object Pascal TRect. * Started updating some methods to rather use two sets of coordinates instead of width and height. * Added a new test to verify drawing accuracy * Implemented more line styles under X11 * Fixed up painting issues in widgets (Scrollbar and Memo are still outstanding) * Added three new helper functions for use with TRect in fpgfx.pas (InflateRect, CentrePoint, OffsetRect).
Diffstat (limited to 'examples/corelib')
-rw-r--r--examples/corelib/canvastest/fpgcanvas.lpi7
-rw-r--r--examples/corelib/canvastest/fpgcanvas.lpr41
2 files changed, 26 insertions, 22 deletions
diff --git a/examples/corelib/canvastest/fpgcanvas.lpi b/examples/corelib/canvastest/fpgcanvas.lpi
index 7f1c6c21..71f908fb 100644
--- a/examples/corelib/canvastest/fpgcanvas.lpi
+++ b/examples/corelib/canvastest/fpgcanvas.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
+ <PathDelim Value="/"/>
<Version Value="5"/>
<General>
<Flags>
@@ -9,7 +9,7 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value=".\"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=""/>
<Title Value="fpcanvas"/>
</General>
@@ -24,7 +24,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -43,7 +43,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/examples/corelib/canvastest/fpgcanvas.lpr b/examples/corelib/canvastest/fpgcanvas.lpr
index 2f9c37c4..23dbb03a 100644
--- a/examples/corelib/canvastest/fpgcanvas.lpr
+++ b/examples/corelib/canvastest/fpgcanvas.lpr
@@ -32,7 +32,7 @@ type
procedure TMainForm.HandlePaint;
var
- r: TfpgRect;
+ r: TRect;
fnt: TfpgFont;
y: integer;
c: TfpgColor;
@@ -46,36 +46,39 @@ begin
Canvas.SetColor(clBlack);
r.Top := 5;
r.Left := 60;
- r.Width := 50;
- r.Height := 50;
- Canvas.DrawRectangle(r);
+ r.Right := r.Left + 49;
+ r.Bottom := r.Top + 49;
+ Canvas.DrawRectangle(r); // 50x50
- r.Left := 120;
+ r.Left := 120;
+ r.Right := r.Left + 49;
Canvas.SetLineStyle(2, lsDash);
Canvas.DrawRectangle(r);
- r.Left := 180;
+ r.Left := 180;
+ r.Right := r.Left + 49;
Canvas.SetColor(clGreen);
Canvas.SetLineStyle(1, lsDot);
Canvas.DrawRectangle(r);
- r.Left := 240;
+ r.Left := 240;
+ r.Right := r.Left + 49;
Canvas.SetColor(clBlue);
Canvas.SetLineStyle(1, lsSolid);
Canvas.FillRectangle(r);
// Testing line drawing
- Canvas.DrawLine(5, 5, 50, 50);
+ Canvas.DrawLine(5, 5, 54, 54);
Canvas.SetColor(clBlue);
- Canvas.DrawLine(50, 5, 5, 50);
+ Canvas.DrawLine(54, 5, 5, 54);
Canvas.SetColor(clRed);
{ Diagonal line }
- Canvas.DrawLine(60, 5, 110, 55);
+ Canvas.DrawLine(60, 5, 109, 54);
{ Horizontal line }
- Canvas.DrawLine(60, 3, 110, 3);
+ Canvas.DrawLine(60, 3, 109, 3);
{ Vertical line }
- Canvas.DrawLine(58, 5, 58, 55);
+ Canvas.DrawLine(58, 5, 58, 54);
// Testing Text and Fonts
@@ -97,6 +100,7 @@ begin
// Testing basic style drawings
Canvas.Font := fpgApplication.DefaultFont;
+// Canvas.DrawButtonFace(0, 0, 6, 6, []);
Canvas.DrawString(320, 3, 'DrawButtonFace():');
Canvas.DrawButtonFace(300, 20, 75, 25, []);
Canvas.DrawString(385, 20, '= []');
@@ -112,8 +116,9 @@ begin
Canvas.DrawString(45, y, 'DrawControlFrame():');
y := y + Canvas.Font.Height;
Canvas.DrawControlFrame(5, y, 200, 23);
-
-
+// Canvas.DrawControlFrame(0, 0, 5, 5);
+
+
// Testing Bitmap painting
Canvas.DrawString(5, 180, 'Single BMP file:');
Canvas.DrawString(300, 210, '(mask enabled for all images)');
@@ -136,8 +141,8 @@ begin
Canvas.SetLineStyle(1, lsSolid);
r.Top := 302;
r.Left := 182;
- r.Width := 66;
- r.Height := 66;
+ r.Right := r.Left + 66;
+ r.Bottom := r.Top + 66;
Canvas.DrawRectangle(r);
Canvas.SetColor(clBlue);
@@ -156,11 +161,11 @@ begin
// Arc drawing tests
Canvas.SetColor(clBlack);
- Canvas.DrawRectangle(5, 235, 50, 50);
+ Canvas.DrawRectangle(5, 235, 55, 285);
Canvas.SetColor(clRed);
Canvas.DrawArc(5, 235, 50, 50, 0, 270); // should overlap rectangle pixels
Canvas.SetColor(clBlack);
- Canvas.DrawRectangle(5, 290, 50, 50);
+ Canvas.DrawRectangle(5, 290, 55, 340);
Canvas.SetColor(clRed);
Canvas.FillArc(5, 290, 50, 50, 0, 270); // should overlap rectangle pixels