diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-10-26 13:56:09 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-10-26 13:56:09 +0000 |
commit | 16f3f057a567b3fc539ed55521e2996b26bcb2c4 (patch) | |
tree | c5906158cd50feee56f855cbbeeee76a9d8c634d /src | |
parent | c0a5ef4d7da723cb0f8831d907f397409d00912c (diff) | |
download | fpGUI-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 'src')
-rw-r--r-- | src/corelib/gfxbase.pas | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/gfxbase.pas b/src/corelib/gfxbase.pas index 173b8017..41430d7a 100644 --- a/src/corelib/gfxbase.pas +++ b/src/corelib/gfxbase.pas @@ -400,6 +400,8 @@ function fpgGetRed(const AColor: TfpgColor): word; function fpgGetGreen(const AColor: TfpgColor): word; function fpgGetBlue(const AColor: TfpgColor): word; function fpgGetAlpha(const AColor: TfpgColor): word; +function fpgGetAvgColor(const AColor1, AColor2: TfpgColor): TfpgColor; + { Points } function PtInRect(const ARect: TfpgRect; const APoint: TPoint): Boolean; @@ -635,6 +637,20 @@ begin Result := Word((AColor shr 32) and $FF); end; +function fpgGetAvgColor(const AColor1, AColor2: TfpgColor): TfpgColor; +var + c1, c2: TRGBTriple; + avg: TRGBTriple; +begin + c1 := fpgColorToRGBTriple(AColor1); + c2 := fpgColorToRGBTriple(AColor2); + avg.Red := c1.Red + (c2.Red - c1.Red) div 2; + avg.Green := c1.Green + (c2.Green - c1.Green) div 2; + avg.Blue := c1.Blue + (c2.Blue - c1.Blue) div 2; + avg.Alpha := c1.Alpha + (c2.Alpha - c1.Alpha) div 2; + Result := RGBTripleTofpgColor(avg); +end; + function PtInRect(const ARect: TfpgRect; const APoint: TPoint): Boolean; begin Result := (APoint.x >= ARect.Left) and |