diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-03-15 18:32:15 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-03-15 18:32:15 +0200 |
commit | 00a414548d158932704bab15dcad259bf7c9b13c (patch) | |
tree | b697ef91826b815f6e02548dc73d207b4cb00e9b /src/corelib | |
parent | b92eb552900ac23aaa6495a19a9356cf00c5acca (diff) | |
download | fpGUI-00a414548d158932704bab15dcad259bf7c9b13c.tar.xz |
Fixes the checking of named colors.
Now that we use the Alpha channel in TfpgColor and TRGBTriple, we
need to improve the algorithm to check if a color is a named color.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/fpg_main.pas | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index 76595ea0..1742ea98 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -1126,7 +1126,7 @@ end; function fpgColorToRGB(col: TfpgColor): TfpgColor; begin - if (col and cl_BaseNamedColor) <> 0 then + if (((col shr 24) and $FF) = $80) and ((col and $FFFFFF) <= $FF) then Result := fpgNamedColors[col and $FF] or (col and $7F000000)// named color keeping alpha else Result := col; @@ -1153,7 +1153,10 @@ end; function fpgIsNamedColor(col: TfpgColor): boolean; begin - Result := (col and cl_BaseNamedColor) <> 0; + if (((col shr 24) and $FF) = $80) and ((col and $FFFFFF) <= $FF) then + Result := True + else + Result := False; end; function fpgGetNamedFontDesc(afontid: string): string; |