lcl: add TGraphic.Clear

git-svn-id: trunk@15507 -
This commit is contained in:
paul 2008-06-22 14:45:37 +00:00
parent 2cc82836ab
commit 278aa5bc29
4 changed files with 22 additions and 2 deletions

View File

@ -700,6 +700,7 @@ type
procedure WriteData(Stream: TStream); virtual; // used by filer
public
constructor Create; virtual;
procedure Clear; virtual;
function LazarusResourceTypeValid(const AResourceType: string): boolean; virtual;
procedure LoadFromFile(const Filename: string); virtual;
procedure LoadFromStream(Stream: TStream); virtual; abstract;
@ -1165,6 +1166,7 @@ type
constructor Create; override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure Clear; override;
procedure FreeImage;
function BitmapHandleAllocated: boolean; virtual; abstract;
function MaskHandleAllocated: boolean; virtual; abstract;
@ -1469,6 +1471,7 @@ type
procedure Add(AFormat: TPixelFormat; AHeight, AWidth: Word);
procedure Assign(Source: TPersistent); override;
procedure Clear; override;
procedure Delete(Aindex: Integer);
procedure Remove(AFormat: TPixelFormat; AHeight, AWidth: Word);
procedure GetDescription(Aindex: Integer; out AFormat: TPixelFormat; out AHeight, AWidth: Word);

View File

@ -21,6 +21,11 @@ begin
Inherited Create;
end;
procedure TGraphic.Clear;
begin
Assign(nil);
end;
procedure TGraphic.DefineProperties(Filer: TFiler);
function DoWrite: Boolean;

View File

@ -252,9 +252,16 @@ procedure TCustomIcon.Assign(Source: TPersistent);
begin
if Source is TCustomIcon then
FCurrent := TCustomIcon(Source).Current;
inherited Assign(Source);
end;
procedure TCustomIcon.Clear;
begin
FreeSaveStream;
FCurrent := -1;
end;
function TCustomIcon.BitmapHandleAllocated: boolean;
begin
Result := (FCurrent <> -1) and (TIconImage(TSharedIcon(FSharedImage).FImages[FCurrent]).FHandle <> 0);

View File

@ -88,8 +88,7 @@ begin
if Source = nil
then begin
FreeSaveStream;
SetSize(0, 0);
Clear;
Exit;
end;
@ -97,6 +96,12 @@ begin
inherited Assign(Source);
end;
procedure TRasterImage.Clear;
begin
FreeSaveStream;
SetSize(0, 0);
end;
procedure TRasterImage.BitmapHandleNeeded;
const
BITCOUNT_MAP: array[TPixelFormat] of Byte = (