Changeset 295 for trunk/Packages/CevoComponents/ScreenTools.pas
- Timestamp:
- Mar 8, 2021, 4:24:21 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ScreenTools.pas
r290 r295 16 16 clPage, clCover: TColor; 17 17 end; 18 TLoadGraphicFileOption = (gfNoError, gfNoGamma); 19 TLoadGraphicFileOptions = set of TLoadGraphicFileOption; 20 18 21 19 22 {$IFDEF WINDOWS} … … 28 31 procedure EditFrame(ca: TCanvas; p: TRect; const T: TTexture); 29 32 function HexStringToColor(S: string): integer; 30 function LoadGraphicFile(bmp: TBitmap; Path: string; Options: integer = 0): boolean;33 function LoadGraphicFile(bmp: TBitmap; Path: string; Options: TLoadGraphicFileOptions = []): boolean; 31 34 function LoadGraphicSet(const Name: string): integer; 32 35 procedure Dump(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer); … … 160 163 cliWater = 4; 161 164 162 // LoadGraphicFile options163 gfNoError = $01;164 gfNoGamma = $02;165 166 165 type 167 166 TGrExtDescr = record { don't use dynamic strings here! } … … 417 416 end; 418 417 419 function LoadGraphicFile(bmp: TBitmap; Path: string; Options: Integer): Boolean;418 function LoadGraphicFile(bmp: TBitmap; Path: string; Options: TLoadGraphicFileOptions = []): Boolean; 420 419 var 421 420 jtex: TJpegImage; … … 434 433 if Result then 435 434 begin 436 if Options and gfNoGamma = 0then435 if not (gfNoGamma in Options) then 437 436 bmp.PixelFormat := pf24bit; 438 437 Bmp.SetSize(jtex.Width, jtex.Height); … … 452 451 if Result then 453 452 begin 454 if Options and gfNoGamma = 0then453 if not (gfNoGamma in Options) then 455 454 bmp.PixelFormat := pf24bit; 456 455 bmp.SetSize(Png.Width, Png.Height); … … 474 473 end; 475 474 if Result then begin 476 if Options and gfNoGamma = 0then475 if not (gfNoGamma in Options) then 477 476 bmp.PixelFormat := pf24bit; 478 477 end; … … 482 481 483 482 if not Result then begin 484 if Options and gfNoError = 0then483 if not (gfNoError in Options) then 485 484 raise Exception.Create(Format(Phrases.Lookup('FILENOTFOUND'), [Path])); 486 485 end; 487 486 488 if ( Options and gfNoGamma = 0) and (Gamma <> 100) then487 if (not (gfNoGamma in Options)) and (Gamma <> 100) then 489 488 ApplyGammaToBitmap(Bmp); 490 489 end; … … 1675 1674 LoadFonts; 1676 1675 LoadGraphicFile(Templates, GetGraphicsDir + DirectorySeparator + 1677 'Templates.png', gfNoGamma);1676 'Templates.png', [gfNoGamma]); 1678 1677 LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png'); 1679 1678 LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg');
Note:
See TracChangeset
for help on using the changeset viewer.