summaryrefslogtreecommitdiff
path: root/prototypes/fpgui2/tests
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-26 13:56:09 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-26 13:56:09 +0000
commit16f3f057a567b3fc539ed55521e2996b26bcb2c4 (patch)
treec5906158cd50feee56f855cbbeeee76a9d8c634d /prototypes/fpgui2/tests
parentc0a5ef4d7da723cb0f8831d907f397409d00912c (diff)
downloadfpGUI-16f3f057a567b3fc539ed55521e2996b26bcb2c4.tar.xz
* Updated the ThreeDee prototype with a new gradient function.
* Implemented a new fpgGetAvgColor function in gfxbase unit. * Supplied some more documentation for gfxbase unit.
Diffstat (limited to 'prototypes/fpgui2/tests')
-rw-r--r--prototypes/fpgui2/tests/frm_threedee.pas57
-rw-r--r--prototypes/fpgui2/tests/threedee.lpi3
2 files changed, 59 insertions, 1 deletions
diff --git a/prototypes/fpgui2/tests/frm_threedee.pas b/prototypes/fpgui2/tests/frm_threedee.pas
index e9b4735d..a31a829e 100644
--- a/prototypes/fpgui2/tests/frm_threedee.pas
+++ b/prototypes/fpgui2/tests/frm_threedee.pas
@@ -118,6 +118,57 @@ Const
190,190,190,190,190,190,190,176,176,176,176,176,176,176,176,176,176,
176,176);
+{ This procedure creates a sunken 3d effect in a rectangle with a color gradient }
+procedure FillRectGradient(Canvas: TfpgCanvas; X, Y, W, H: TfpgCoord;
+ Strip: Integer; Astart, Astop: TfpgColor);
+var
+ RGBStart: TRGBTriple;
+ RGBStop: TRGBTriple;
+ RDiff, GDiff, BDiff: Integer;
+ count: Integer;
+ i: Integer;
+ newcolor: TRGBTriple;
+ Hx, Hy: TfpgCoord; // Coordinates for Horizontal Lines
+ Vx, Vy: TfpgCoord; // Coordinates for Vertical Lines
+ avgcolor: TfpgColor;
+begin
+ RGBStart := fpgColorToRGBTriple(fpgColorToRGB(AStart));
+ RGBStop := fpgColorToRGBTriple(fpgColorToRGB(AStop));
+
+ count := Strip;
+ Hx := X;
+ Hy := Y;
+ Vx := X;
+ Vy := Y;
+
+ RDiff := RGBStop.Red - RGBStart.Red;
+ GDiff := RGBStop.Green - RGBStart.Green;
+ BDiff := RGBStop.Blue - RGBStart.Blue;
+
+// Changing;
+ Canvas.BeginDraw;
+ for i := 0 to count do
+ begin
+ newcolor.Red := RGBStart.Red + (i * RDiff) div count;
+ newcolor.Green := RGBStart.Green + (i * GDiff) div count;
+ newcolor.Blue := RGBStart.Blue + (i * BDiff) div count;
+
+ Canvas.SetLineStyle(1, lsSolid);
+ Canvas.SetColor(RGBTripleTofpgColor(newcolor));
+ Canvas.DrawLine(Hx, Hy, W+2, Hy); // Horizontal Line
+ Canvas.DrawLine(Vx, Vy, Vx, H+2); // Vertical Line
+ // next Horizontal Line: one pixel lower, one pixel shorter on the left
+ Hx := Hx + 1;
+ Hy := Hy + 1;
+ // Next Vertical Line: One pixel to the right, one pixel shorter on top
+ Vx := Vx + 1;
+ Vy := Vy + 1
+ end;
+
+ // Changed;
+ Canvas.EndDraw;
+end;
+
{@VFD_NEWFORM_IMPL}
@@ -219,6 +270,7 @@ begin
FontDesc := '#Edit1';
Text := '$800000';
OnChange := @edtThreeDeeChanged;
+ BackgroundColor := $F5F5F5;
end;
cbName1 := TfpgCheckBox.Create(self);
@@ -267,6 +319,7 @@ begin
SetPosition(48, 144, 120, 22);
FontDesc := '#Edit1';
Text := '$800000';
+ BackgroundColor := $B0C4DE
end;
Custom2 := TthreedeeEdit.Create(self);
@@ -276,6 +329,7 @@ begin
SetPosition(48, 80, 120, 22);
FontDesc := '#Edit1';
Text := '$800000';
+ BackgroundColor := $B0C4DE;
end;
lblName1 := TfpgLabel.Create(self);
@@ -308,6 +362,7 @@ procedure TthreedeeEdit.Draw3DControlShadow(ARect: TfpgRect);
var
r: TfpgRect;
begin
+(*
Canvas.DrawImage(ARect.Left, ARect.Top, FimgLeftTop);
// Canvas.StretchDraw(1, 8, 7, ARect.Height, FimgLeft);
r.SetRect(ARect.Left, 8, 8, ARect.Height);
@@ -315,6 +370,8 @@ begin
// Canvas.StretchDraw(8, 1, Width+5, 7, FimgTop);
r.SetRect(8, ARect.Top, Width+5, 8);
Canvas.GradientFill(r, clM2Grey, BackgroundColor, gdVertical);
+*)
+ FillRectGradient(Canvas, ARect.Left, ARect.Top, ARect.Width, ARect.Height, 7, TfpgColor($777777), BackgroundColor);
end;
procedure TthreedeeEdit.SetErrorColor(const AValue: TfpgColor);
diff --git a/prototypes/fpgui2/tests/threedee.lpi b/prototypes/fpgui2/tests/threedee.lpi
index 7bbed4b6..6a613a8c 100644
--- a/prototypes/fpgui2/tests/threedee.lpi
+++ b/prototypes/fpgui2/tests/threedee.lpi
@@ -6,6 +6,8 @@
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
+ <MainUnitHasCreateFormStatements Value="False"/>
+ <MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
@@ -17,7 +19,6 @@
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
- <IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>