Ignore:
Timestamp:
Apr 17, 2019, 12:58:41 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Propagate project build mode options to used packages.
  • Added: Check memory leaks using heaptrc.
  • Modified: Update BGRABitmap package.
Location:
GraphicTest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest

    • Property svn:ignore
      •  

        old new  
        88GraphicTest.lps
        99GraphicTest.dbg
         10heaptrclog.trc
  • GraphicTest/Packages/bgrabitmap/csscolorconst.inc

    r494 r521  
    9999    constructor Create;
    100100    {** Add a color to the list }
    101     procedure Add(Name: string; const Color: TBGRAPixel);
     101    procedure Add(Name: string; const Color: TBGRAPixel); overload;
    102102    {** Ends the color list and prevents further modifications }
    103103    procedure Finished;
     
    137137{* Converts a fully defined string into a ''TBGRAPixel'' value. Color names from ''VGAColors'' and ''CSSColors''
    138138   are used if there is an exact match }
    139 function StrToBGRA(str: string): TBGRAPixel;
     139function StrToBGRA(str: string): TBGRAPixel; overload;
    140140{* Converts a string into a ''TBGRAPixel'' value. If the value is not fully defined or that
    141141   there is an error, ''DefaultColor'' is returned.
    142142   Color names from ''VGAColors'' and ''CSSColors'' are used if there is an exact match. }
    143 function StrToBGRA(str: string; const DefaultColor: TBGRAPixel): TBGRAPixel;
     143function StrToBGRA(str: string; const DefaultColor: TBGRAPixel): TBGRAPixel; overload;
    144144{* Converts a string into a ''TBGRAPixel'' value. If the value is not fully defined, missing channels (expressed with '?')
    145145   are filled with fallbackValues. You can check if there was an error with the provided boolean.
     
    311311function ParseColorValue(str: string; var flagError: boolean): byte;
    312312var pourcent,unclipped,{%H-}errPos: integer;
     313  pourcentF: single;
     314  pourcentStr: string;
    313315begin
    314316  if str = '' then result := 0 else
     
    316318    if str[length(str)]='%' then
    317319    begin
    318       val(copy(str,1,length(str)-1),pourcent,errPos);
    319       if errPos <> 0 then flagError := true;
    320       if pourcent < 0 then result := 0 else
    321       if pourcent > 100 then result := 255 else
    322         result := pourcent*255 div 100;
     320      pourcentStr := copy(str,1,length(str)-1);
     321      val(pourcentStr,pourcent,errPos);
     322      if errPos <> 0 then
     323      begin
     324        val(pourcentStr,pourcentF,errPos);
     325        if errPos <> 0 then
     326        begin
     327          flagError := true;
     328          result := 0;
     329        end
     330        else
     331        begin
     332          if pourcentF < 0 then result := 0 else
     333          if pourcentF > 100 then result := 255 else
     334           result := round(pourcentF*255 / 100);
     335        end;
     336      end else
     337      begin
     338         if pourcent < 0 then result := 0 else
     339         if pourcent > 100 then result := 255 else
     340           result := pourcent*255 div 100;
     341      end;
    323342    end else
    324343    begin
Note: See TracChangeset for help on using the changeset viewer.