Ignore:
Timestamp:
Jan 5, 2017, 11:48:36 PM (8 years ago)
Author:
chronos
Message:
  • Added: Remember last used image size and color format.
  • Added: Automatically create blank image.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/FastGraphics/UFGraphics.pas

    r31 r33  
    66
    77uses
    8   Classes, SysUtils, Graphics, UGGraphics, UPixmapSpecialized, Contnrs;
     8  Classes, SysUtils, Graphics, UGGraphics, UPixmapSpecialized, Fgl;
    99
    1010type
     
    8181  end;
    8282
     83  TColorFormats  = class(TFPGObjectList<TColorFormat>)
     84  end;
     85
    8386  TColorFormatClass = class of TColorFormat;
    8487
     
    8790  TColorFormatManager = class
    8891  private
    89     FFormats: TObjectList; // TList<TColorFormat>
     92    FFormats: TColorFormats;
    9093    function GetFormat(Index: Integer): TColorFormat;
    9194  public
    9295    constructor Create; virtual;
    93      destructor Destroy; override;
     96    destructor Destroy; override;
     97    function FindByName(Name: string): Integer;
    9498    procedure RegisterFormat(Format: TColorFormatClass);
    9599    function FormatCount: Integer;
    96     property Formats[Index: Integer]: TColorFormat read GetFormat;
     100    property Formats: TColorFormats read FFormats;
    97101  end;
    98102
     
    261265constructor TColorFormatManager.Create;
    262266begin
    263   FFormats := TObjectList.Create;
     267  FFormats := TColorFormats.Create;
    264268end;
    265269
     
    268272  FreeAndNil(FFormats);
    269273  inherited Destroy;
     274end;
     275
     276function TColorFormatManager.FindByName(Name: string): Integer;
     277var
     278  I: Integer;
     279begin
     280  Result := -1;
     281  for I := 0 to FFormats.Count - 1 do begin
     282    if FFormats[I].Name = Name then begin
     283      Result := I;
     284      Break;
     285    end;
     286  end;
    270287end;
    271288
Note: See TracChangeset for help on using the changeset viewer.