Ignore:
Timestamp:
Apr 25, 2021, 10:39:00 AM (4 years ago)
Author:
chronos
Message:
  • Modified: TTexture class moved to seprate unit.
File:
1 edited

Legend:

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

    r375 r380  
    88  {$ENDIF}
    99  StringTables, LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Math,
    10   Forms, Menus, GraphType, fgl, UGraphicSet, LazFileUtils;
     10  Forms, Menus, GraphType, fgl, UGraphicSet, LazFileUtils, UTexture;
    1111
    1212type
    13 
    14   { TTexture }
    15 
    16   TTexture = class
    17   private
    18     FAge: Integer;
    19     function GetHeight: Integer;
    20     function GetWidth: Integer;
    21     procedure SetAge(AValue: Integer);
    22   public
    23     Image: TBitmap;
    24     ColorBevelLight: TColor;
    25     ColorBevelShade: TColor;
    26     ColorTextLight: TColor;
    27     ColorTextShade: TColor;
    28     ColorLitText: TColor;
    29     ColorMark: TColor;
    30     ColorPage: TColor;
    31     ColorCover: TColor;
    32     constructor Create;
    33     destructor Destroy; override;
    34     procedure Assign(Source: TTexture);
    35     property Age: Integer read FAge write SetAge;
    36     property Width: Integer read GetWidth;
    37     property Height: Integer read GetHeight;
    38   end;
    39 
    4013  TLoadGraphicFileOption = (gfNoError, gfNoGamma);
    4114  TLoadGraphicFileOptions = set of TLoadGraphicFileOption;
     
    18441817end;
    18451818
    1846 { TTexture }
    1847 
    1848 procedure TTexture.SetAge(AValue: Integer);
    1849 begin
    1850   if FAge = AValue then Exit;
    1851   FAge := AValue;
    1852   LoadGraphicFile(Image, GetGraphicsDir + DirectorySeparator +
    1853     'Texture' + IntToStr(Age + 1) + '.jpg');
    1854   ColorBevelLight := Colors.Canvas.Pixels[clkAge0 + Age, cliBevelLight];
    1855   ColorBevelShade := Colors.Canvas.Pixels[clkAge0 + Age, cliBevelShade];
    1856   ColorTextLight := Colors.Canvas.Pixels[clkAge0 + Age, cliTextLight];
    1857   ColorTextShade := Colors.Canvas.Pixels[clkAge0 + Age, cliTextShade];
    1858   ColorLitText := Colors.Canvas.Pixels[clkAge0 + Age, cliLitText];
    1859   ColorMark := Colors.Canvas.Pixels[clkAge0 + Age, cliMark];
    1860   ColorPage := Colors.Canvas.Pixels[clkAge0 + Age, cliPage];
    1861   ColorCover := Colors.Canvas.Pixels[clkAge0 + Age, cliCover];
    1862 end;
    1863 
    1864 function TTexture.GetHeight: Integer;
    1865 begin
    1866   Result := Image.Height;
    1867 end;
    1868 
    1869 function TTexture.GetWidth: Integer;
    1870 begin
    1871   Result := Image.Width;
    1872 end;
    1873 
    1874 constructor TTexture.Create;
    1875 begin
    1876   Image := TBitmap.Create;
    1877   FAge := -2;
    1878 end;
    1879 
    1880 destructor TTexture.Destroy;
    1881 begin
    1882   FreeAndNil(Image);
    1883   inherited;
    1884 end;
    1885 
    1886 procedure TTexture.Assign(Source: TTexture);
    1887 begin
    1888   FAge := Source.FAge;
    1889   Image.Assign(Image);
    1890   ColorBevelLight := Source.ColorBevelLight;
    1891   ColorBevelShade := Source.ColorBevelShade;
    1892   ColorTextLight := Source.ColorTextLight;
    1893   ColorTextShade := Source.ColorTextShade;
    1894   ColorLitText := Source.ColorLitText;
    1895   ColorMark := Source.ColorMark;
    1896   ColorPage := Source.ColorPage;
    1897   ColorCover := Source.ColorCover;
    1898 end;
    1899 
    19001819end.
Note: See TracChangeset for help on using the changeset viewer.