diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2015-03-10 17:44:08 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2015-03-10 17:44:08 +0000 |
commit | 1fdff5e9409d875785ed11e35f4b11bfb3f9ea54 (patch) | |
tree | bc1990786f5a481147b378b2bcb30148e366df72 | |
parent | a2f72a6bf0ffa6978bd862cfb3a0c81f2aebc578 (diff) | |
download | fpGUI-1fdff5e9409d875785ed11e35f4b11bfb3f9ea54.tar.xz |
Removes deprecated TFPColor usage
- That includes any color conversion functions
- Projects using TFPColor
-rw-r--r-- | prototypes/fpgui2/tests/frm_threedee.pas | 12 | ||||
-rw-r--r-- | src/corelib/fpg_base.pas | 28 | ||||
-rw-r--r-- | src/corelib/fpg_imgutils.pas | 8 | ||||
-rw-r--r-- | src/corelib/fpg_main.pas | 11 | ||||
-rw-r--r-- | src/gui/colordialog.inc | 10 | ||||
-rw-r--r-- | src/gui/fpg_colormapping.pas | 10 | ||||
-rw-r--r-- | src/gui/fpg_toggle.pas | 3 |
7 files changed, 23 insertions, 59 deletions
diff --git a/prototypes/fpgui2/tests/frm_threedee.pas b/prototypes/fpgui2/tests/frm_threedee.pas index 5f6548ed..836de485 100644 --- a/prototypes/fpgui2/tests/frm_threedee.pas +++ b/prototypes/fpgui2/tests/frm_threedee.pas @@ -119,18 +119,18 @@ Const procedure FillRectGradient(Canvas: TfpgCanvas; X, Y, W, H: TfpgCoord; Strip: Integer; Astart, Astop: TfpgColor); var - RGBStart: TFPColor; - RGBStop: TFPColor; + RGBStart: TRGBTriple; + RGBStop: TRGBTriple; RDiff, GDiff, BDiff: Integer; count: Integer; i: Integer; - newcolor: TFPColor; + newcolor: TRGBTriple; Hx, Hy: TfpgCoord; // Coordinates for Horizontal Lines Vx, Vy: TfpgCoord; // Coordinates for Vertical Lines avgcolor: TfpgColor; begin - RGBStart := fpgColorToFPColor(fpgColorToRGB(AStart)); - RGBStop := fpgColorToFPColor(fpgColorToRGB(AStop)); + RGBStart := fpgColorToRGBTriple(fpgColorToRGB(AStart)); + RGBStop := fpgColorToRGBTriple(fpgColorToRGB(AStop)); count := Strip; Hx := X; @@ -151,7 +151,7 @@ begin newcolor.Blue := RGBStart.Blue + (i * BDiff) div count; Canvas.SetLineStyle(1, lsSolid); - Canvas.SetColor(FPColorTofpgColor(newcolor)); + 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 diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 4c107e93..4138dad9 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -49,14 +49,6 @@ type Alpha: byte; end; - // Same declaration as in FPImage unit, but we don't use FPImage yet, so declare it here - TFPColor = record - Red: byte; - Green: byte; - Blue: byte; - Alpha: byte; - end deprecated; - TWindowType = (wtChild, wtWindow, wtModalForm, wtPopup); TWindowAttribute = (waSizeable, waAutoPos, waScreenCenterPos, waStayOnTop, @@ -766,9 +758,7 @@ function CheckClipboardKey(AKey: Word; AShiftstate: TShiftState): TClipboardKe { Color } function fpgColorToRGBTriple(const AColor: TfpgColor): TRGBTriple; -function fpgColorToFPColor(const AColor: TfpgColor): TFPColor; deprecated; function RGBTripleTofpgColor(const AColor: TRGBTriple): TfpgColor; -function FPColorTofpgColor(const AColor: TFPColor): TfpgColor; deprecated; function fpgGetRed(const AColor: TfpgColor): byte; function fpgGetGreen(const AColor: TfpgColor): byte; function fpgGetBlue(const AColor: TfpgColor): byte; @@ -997,27 +987,11 @@ begin end end; -function fpgColorToFPColor(const AColor: TfpgColor): TFPColor; deprecated; -begin - with Result do - begin - Red := fpgGetRed(AColor); - Green := fpgGetGreen(AColor); - Blue := fpgGetBlue(AColor); - Alpha := fpgGetAlpha(AColor); - end -end; - function RGBTripleTofpgColor(const AColor: TRGBTriple): TfpgColor; begin Result := AColor.Blue or (AColor.Green shl 8) or (AColor.Red shl 16) or (AColor.Alpha shl 24); end; -function FPColorTofpgColor(const AColor: TFPColor): TfpgColor; deprecated; -begin - Result := AColor.Blue or (AColor.Green shl 8) or (AColor.Red shl 16) or (AColor.Alpha shl 24); -end; - function fpgGetRed(const AColor: TfpgColor): byte; var c: TfpgColor; diff --git a/src/corelib/fpg_imgutils.pas b/src/corelib/fpg_imgutils.pas index 97f33fb7..79892f5b 100644 --- a/src/corelib/fpg_imgutils.pas +++ b/src/corelib/fpg_imgutils.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -78,11 +78,11 @@ end; function fpgCalculateGray(const AFrom: TfpgColor; const ABrighter: boolean = False; const APercent: integer = 0): TfpgColor; var g: integer; - rgb: TFPColor; + rgb: TRGBTriple; begin with GrayConvMatrix do begin - rgb := fpgColorToFPColor(AFrom); + rgb := fpgColorToRGBTriple(AFrom); g := round(red*rgb.red + green*rgb.green + blue*rgb.blue); if ABrighter then @@ -97,7 +97,7 @@ begin rgb.Green := g; rgb.Blue := g; end; - Result := FPColorTofpgColor(rgb); + Result := RGBTripleTofpgColor(rgb); end; diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index 1bdbff2e..1f063cb5 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -467,7 +467,6 @@ operator - (const APoint: TfpgPoint; i: Integer) p: TfpgPoint; operator - (const ASize: TfpgSize; const APoint: TPoint) s: TfpgSize; operator - (const ASize: TfpgSize; const APoint: TfpgPoint) s: TfpgSize; operator - (const ASize: TfpgSize; i: Integer) s: TfpgSize; -operator = (const AColor1, AColor2: TFPColor) b: Boolean; deprecated; operator = (const AColor1, AColor2: TRGBTriple) b: Boolean; @@ -1181,14 +1180,6 @@ begin s.h := ASize.h - i; end; -operator = (const AColor1, AColor2: TFPColor) b: Boolean; -begin - b := (AColor1.Red = AColor2.Red) - and (AColor1.Green = AColor2.Green) - and (AColor1.Blue = AColor2.Blue) - and (AColor1.Alpha = AColor2.Alpha); -end; - operator = (const AColor1, AColor2: TRGBTriple) b: Boolean; begin b := (AColor1.Red = AColor2.Red) diff --git a/src/gui/colordialog.inc b/src/gui/colordialog.inc index 0ef8c3bb..763c8b7f 100644 --- a/src/gui/colordialog.inc +++ b/src/gui/colordialog.inc @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -265,14 +265,14 @@ end; procedure TfpgColorSelectDialog.RGBChanged(Sender: TObject); var - rgb: TFPColor; + rgb: TRGBTriple; c: TfpgColor; begin FViaRGB := True; // prevent recursive updates rgb.Red := edR.Value; rgb.Green := edG.Value; rgb.Blue := edB.Value; - c := FPColorTofpgColor(rgb); + c := RGBTripleTofpgColor(rgb); ColorWheel.SetSelectedColor(c); // This will trigger ColorWheel and ValueBar OnChange event FViaRGB := False; // keep text readable based on background color @@ -286,11 +286,11 @@ end; procedure TfpgColorSelectDialog.UpdateRGBComponents; var - rgb: TFPColor; + rgb: TRGBTriple; c: TfpgColor; begin c := ValueBar.SelectedColor; - rgb := fpgColorToFPColor(c); + rgb := fpgColorToRGBTriple(c); edR.Value := rgb.Red; edG.Value := rgb.Green; edB.Value := rgb.Blue; diff --git a/src/gui/fpg_colormapping.pas b/src/gui/fpg_colormapping.pas index b915bd93..a22b949e 100644 --- a/src/gui/fpg_colormapping.pas +++ b/src/gui/fpg_colormapping.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -45,9 +45,9 @@ var r, g, b: longint; hi, lo: longint; d: longint; - rgb: TFPColor; + rgb: TRGBTriple; begin - rgb := fpgColorToFPColor(C); + rgb := fpgColorToRGBTriple(C); r := rgb.Red; g := rgb.Green; b := rgb.Blue; @@ -78,7 +78,7 @@ end; function HSVToRGB(const H: longint; const S, V: double): TfpgColor; var r, g, b: longint; - rgb: TFPColor; + rgb: TRGBTriple; begin if (h < 0) or (h > 1535) or (S < 0) or (S > 1) or (V < 0) or (V > 1) then begin @@ -130,7 +130,7 @@ begin rgb.Red := r; rgb.Green := g; rgb.Blue := b; - Result := FPColorTofpgColor(rgb); + Result := RGBTripleTofpgColor(rgb); end; diff --git a/src/gui/fpg_toggle.pas b/src/gui/fpg_toggle.pas index b35ca661..9cdfe3af 100644 --- a/src/gui/fpg_toggle.pas +++ b/src/gui/fpg_toggle.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -158,7 +158,6 @@ end; procedure TfpgToggle.HandlePaint; var ToggleText: TfpgString; - PaintColor: TFPColor; TextEnabled: TfpgTextFlags; BvlWdth: TfpgCoord; ButtonRect: TfpgRect; |