Ignore:
Timestamp:
Mar 8, 2021, 4:24:21 PM (4 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r290 r295  
    1616    clPage, clCover: TColor;
    1717  end;
     18  TLoadGraphicFileOption = (gfNoError, gfNoGamma);
     19  TLoadGraphicFileOptions = set of TLoadGraphicFileOption;
     20
    1821
    1922{$IFDEF WINDOWS}
     
    2831procedure EditFrame(ca: TCanvas; p: TRect; const T: TTexture);
    2932function HexStringToColor(S: string): integer;
    30 function LoadGraphicFile(bmp: TBitmap; Path: string; Options: integer = 0): boolean;
     33function LoadGraphicFile(bmp: TBitmap; Path: string; Options: TLoadGraphicFileOptions = []): boolean;
    3134function LoadGraphicSet(const Name: string): integer;
    3235procedure Dump(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
     
    160163  cliWater = 4;
    161164
    162   // LoadGraphicFile options
    163   gfNoError = $01;
    164   gfNoGamma = $02;
    165 
    166165type
    167166  TGrExtDescr = record { don't use dynamic strings here! }
     
    417416end;
    418417
    419 function LoadGraphicFile(bmp: TBitmap; Path: string; Options: Integer): Boolean;
     418function LoadGraphicFile(bmp: TBitmap; Path: string; Options: TLoadGraphicFileOptions = []): Boolean;
    420419var
    421420  jtex: TJpegImage;
     
    434433    if Result then
    435434    begin
    436       if Options and gfNoGamma = 0 then
     435      if not (gfNoGamma in Options) then
    437436        bmp.PixelFormat := pf24bit;
    438437      Bmp.SetSize(jtex.Width, jtex.Height);
     
    452451    if Result then
    453452    begin
    454       if Options and gfNoGamma = 0 then
     453      if not (gfNoGamma in Options) then
    455454        bmp.PixelFormat := pf24bit;
    456455      bmp.SetSize(Png.Width, Png.Height);
     
    474473    end;
    475474    if Result then begin
    476       if Options and gfNoGamma = 0 then
     475      if not (gfNoGamma in Options) then
    477476        bmp.PixelFormat := pf24bit;
    478477    end;
     
    482481
    483482  if not Result then begin
    484     if Options and gfNoError = 0 then
     483    if not (gfNoError in Options) then
    485484      raise Exception.Create(Format(Phrases.Lookup('FILENOTFOUND'), [Path]));
    486485  end;
    487486
    488   if (Options and gfNoGamma = 0) and (Gamma <> 100) then
     487  if (not (gfNoGamma in Options)) and (Gamma <> 100) then
    489488    ApplyGammaToBitmap(Bmp);
    490489end;
     
    16751674  LoadFonts;
    16761675  LoadGraphicFile(Templates, GetGraphicsDir + DirectorySeparator +
    1677     'Templates.png', gfNoGamma);
     1676    'Templates.png', [gfNoGamma]);
    16781677  LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png');
    16791678  LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg');
Note: See TracChangeset for help on using the changeset viewer.