From 00a414548d158932704bab15dcad259bf7c9b13c Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 15 Mar 2012 18:32:15 +0200 Subject: 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. --- src/corelib/fpg_main.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/corelib') 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; -- cgit v1.2.3-70-g09d2