Swapping 2 TBitmaps !

Giganews Newsgroups
Subject:Swapping 2 TBitmaps !
Posted by: David HAROUCHE (metan…@hotmail.com)
Date:Fri, 29 Aug 2008

Is that safe enough, please ?

class procedure TPixels.DoSwap( _A:TBitmap;
                                _B:TBitmap
                              );

var _C:TBitmap;

begin
    if  Assigned(_A)
    and Assigned(_B)
        then begin
                  _C := TBitmap.Create;
                  _C.Assign(_A);

                  _A.Assign(_B);
                  _B.Assign(_C);

                  SysUtils.FreeAndNil(_C);
              end;
end;

DH

Replies