summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-12-03 09:46:23 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-12-03 09:46:23 +0000
commit01601bb83634f1c734422215ac1317c2713bccd1 (patch)
treeba4e2a8a6fc2ae6236402580f525c9b6661fc870
parent4ebc4cdebd8f866c38e19fc36edb95c28c8440c4 (diff)
downloadfpGUI-01601bb83634f1c734422215ac1317c2713bccd1.tar.xz
* Minor painting fixed to Gauge and ProgressBar frame painting.
* Minor fix to VerticalBar gauge painting where it oversheets the outer frame. * Implemented anti-aliased line drawing in Needle Gauge and Dial Gauge, but it's only experimental.
-rw-r--r--examples/gui/gauges/gaugetest.lpi11
-rw-r--r--examples/gui/gauges/gaugetest.lpr3
-rw-r--r--src/gui/gui_gauge.pas51
-rw-r--r--src/gui/gui_progressbar.pas2
4 files changed, 45 insertions, 22 deletions
diff --git a/examples/gui/gauges/gaugetest.lpi b/examples/gui/gauges/gaugetest.lpi
index ffc0b224..7c26a800 100644
--- a/examples/gui/gauges/gaugetest.lpi
+++ b/examples/gui/gauges/gaugetest.lpi
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
- <Version Value="5"/>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value=".\"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
@@ -17,15 +17,13 @@
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
- <DestinationDirectory Value="$(TestDir)\publishedproject\"/>
- <IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<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">
@@ -42,7 +40,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<AllowLabel Value="False"/>
diff --git a/examples/gui/gauges/gaugetest.lpr b/examples/gui/gauges/gaugetest.lpr
index 1ab55c21..837dd414 100644
--- a/examples/gui/gauges/gaugetest.lpr
+++ b/examples/gui/gauges/gaugetest.lpr
@@ -16,7 +16,6 @@ uses
gui_trackbar,
gui_label,
gfx_imgfmt_bmp,
- fpgui_package,
gui_edit,
gui_bevel,
gui_gauge;
@@ -82,7 +81,7 @@ begin
with Gauge do
begin
Name := 'Gauge';
- SetPosition(124, 104, 151, 25);
+ SetPosition(124, 104, 150, 25);
Kind := gkHorizontalBar;
end;
diff --git a/src/gui/gui_gauge.pas b/src/gui/gui_gauge.pas
index c998e232..3d0317c8 100644
--- a/src/gui/gui_gauge.pas
+++ b/src/gui/gui_gauge.pas
@@ -104,6 +104,9 @@ function CreateGauge (AOwner: TComponent; ALeft, ATop, AWidth,
implementation
+uses
+ gfx_wuline;
+
{ This procedure draws a filled arc with a color gradient -
to be moved in CanvasBase? }
procedure FillArcGradient(canvas: TfpgCanvas; X,Y,W,H: TfpgCoord; a1,a2: double; Astart,Astop: TfpgColor);
@@ -168,7 +171,7 @@ end;
{ TfpgGauge }
{ Drawing procedures - they're called from HandlePaint, which takes care of
- canvas.BeginDraw and Canvas.EndDraw - Shouldn't be used otherwise. }
+ Canvas.BeginDraw and Canvas.EndDraw - Shouldn't be used otherwise. }
procedure TfpgGauge.BackgroundDraw;
begin
{common Background for all kinds }
@@ -199,12 +202,12 @@ begin
{ Round frame for the Pie }
Canvas.SetLineStyle(2, lsSolid);
Canvas.SetColor(TfpgColor($98b2ed));
- Canvas.DrawArc(Left, Top, Width, Height , 0, 360);
+ Canvas.DrawArc(Left, Top, Width, Height, 0, 360);
end;
gkNeedle:
begin
{ Half a filled circle background for needle }
- FillArcGradient (Canvas,Left, Top, Width, Height * 2 -1, 0, 180,TfpgColor($425d9b),TfpgColor($98b2ed));
+ FillArcGradient(Canvas,Left, Top, Width, Height * 2 -1, 0, 180,TfpgColor($425d9b),TfpgColor($98b2ed));
Canvas.SetLineStyle(2, lsSolid);
//Canvas.SetColor(TfpgColor($3b4c71));
Canvas.SetColor(TfpgColor($98b2ed));
@@ -269,7 +272,7 @@ begin
// right bottom
Canvas.SetColor(TfpgColor($3b4c71));
Canvas.DrawLine(Right, Top, Right, Bottom); // right
- Canvas.DrawLine(Right, Bottom, Left-1, Bottom); // bottom
+ Canvas.DrawLine(Right, Bottom, Left, Bottom); // bottom
// inside gradient fill
InflateRect(FClientRect, -1, -1);
Canvas.GradientFill(FClientRect, TfpgColor($425d9b), TfpgColor($97b0e8), gdVertical);
@@ -282,7 +285,7 @@ begin
begin
if BarLength > Height then
BarLength := Height;
- Top := Height - BarLength;
+ Top := Height - BarLength+1;
Height := BarLength;
// left top
Canvas.SetColor(TfpgColor($98b2ed));
@@ -291,7 +294,7 @@ begin
// right bottom
Canvas.SetColor(TfpgColor($3b4c71));
Canvas.DrawLine(Right, Top, Right, Bottom); // right
- Canvas.DrawLine(Right, Bottom, Left-1, Bottom); // bottom
+ Canvas.DrawLine(Right, Bottom, Left, Bottom); // bottom
// inside gradient fill
InflateRect(FClientRect, -1, -1);
Canvas.GradientFill(FClientRect, TfpgColor($425d9b), TfpgColor($97b0e8), gdHorizontal);
@@ -334,9 +337,21 @@ begin
Angle := (Pi * ((Percentage / 100.0))); // percentage to radiants
Canvas.SetColor(TfpgColor($3b4c71));
Canvas.SetLineStyle(2,lsSolid);
- Canvas.DrawLine(Center.X, FClientRect.Bottom,
- Integer(round(Center.X - (Radius.X * Cos(Angle)))),
- Integer(round((FClientRect.Bottom) - (Radius.Y * Sin(Angle)))));
+ //Canvas.DrawLine(Center.X, FClientRect.Bottom,
+ //Integer(round(Center.X - (Radius.X * Cos(Angle)))),
+ //Integer(round((FClientRect.Bottom) - (Radius.Y * Sin(Angle)))));
+
+ { *** Experimental *** }
+ WuLine(Canvas,
+ Point(Center.X, FClientRect.Bottom),
+ Point(Integer(round(Center.X - (Radius.X * Cos(Angle)))),
+ Integer(round((FClientRect.Bottom) - (Radius.Y * Sin(Angle))))),
+ Canvas.Color);
+ WuLine(Canvas,
+ Point(Center.X+1, FClientRect.Bottom),
+ Point(Integer(round(Center.X+1 - (Radius.X * Cos(Angle)))),
+ Integer(round((FClientRect.Bottom) - (Radius.Y * Sin(Angle))))),
+ Canvas.Color);
end;
end;
end;
@@ -367,9 +382,21 @@ begin
{ draw needle }
Angle := (Pi * ((Percentage / (100 * 2 / 3)) + -0.25));
Canvas.SetLineStyle(2,lsSolid);
- Canvas.DrawLine(Center.X, Center.Y,
- Integer(round(Center.X - ( Radius.X * cos(Angle)))),
- Integer(round((Center.Y) - (Radius.Y * Sin(Angle)))));
+ //Canvas.DrawLine(Center.X, Center.Y,
+ //Integer(round(Center.X - ( Radius.X * cos(Angle)))),
+ //Integer(round((Center.Y) - (Radius.Y * Sin(Angle)))));
+
+ { *** Experimental *** }
+ WuLine(Canvas,
+ Point(Center.X, Center.Y),
+ Point(Integer(round(Center.X - ( Radius.X * cos(Angle)))),
+ Integer(round((Center.Y) - (Radius.Y * Sin(Angle))))),
+ Canvas.Color);
+ WuLine(Canvas,
+ Point(Center.X+1, Center.Y),
+ Point(Integer(round(Center.X+1 - ( Radius.X * cos(Angle)))),
+ Integer(round((Center.Y) - (Radius.Y * Sin(Angle))))),
+ Canvas.Color);
end; { if }
end; { with }
end;
diff --git a/src/gui/gui_progressbar.pas b/src/gui/gui_progressbar.pas
index eab57685..2177f4ed 100644
--- a/src/gui/gui_progressbar.pas
+++ b/src/gui/gui_progressbar.pas
@@ -189,7 +189,7 @@ begin
// right bottom
Canvas.SetColor(TfpgColor($3b4c71));
Canvas.DrawLine(r.Right, r.Top, r.Right, r.Bottom); // right
- Canvas.DrawLine(r.Right, r.Bottom, r.Left-1, r.Bottom); // bottom
+ Canvas.DrawLine(r.Right, r.Bottom, r.Left, r.Bottom); // bottom
// inside gradient fill
InflateRect(r, -1, -1);
Canvas.GradientFill(r, TfpgColor($425d9b), TfpgColor($97b0e8), gdVertical);