Search results for 'Fade Out'. 1 post(s) found.

  1. 2007/09/11 TImage.Bitmap fade out
2007/09/11 08:03

TImage.Bitmap fade out


Put a TImage (Image1) on a Delphi form and load a bitmap of 24 bits or 32 bits in it; put a TButton (Button1) and put this code in its OnClick event:

procedure TForm1.Button1Click(Sender: TObject) ;

  procedure FadeOut(const BMP:TImage; Pause:integer) ;
   var
    BytesPorScan : integer;
    w,h : integer;
    p : pByteArray;
    counter : integer;

   begin
      {This only works with 24 or 32 bits bitmaps}
      If Not (BMP.Picture.Bitmap.PixelFormat
              in [pf24Bit, pf32Bit])
       then raise exception.create
          ('Error, bitmap format not supported.') ;

      try
       BytesPorScan:=
        Abs(Integer(BMP.Picture.Bitmap.ScanLine[1])-
            Integer(BMP.Picture.Bitmap.ScanLine[0])) ;
      except
        raise exception.create('Error') ;
      end;

      {Decrease the RGB for each single pixel}
      for counter:=1 to 256 do
      begin
        for h:=0 to BMP.Picture.Bitmap.Height-1 do
        begin
          P:=BMP.Picture.Bitmap.ScanLine[h];
          for w:=0 to BytesPorScan-1 do
            if P^[w] >0 then P^[w]:=P^[w]-1;
        end;
        Sleep(Pause) ;
      BMP.Refresh;
      end;
    end; {procedure FadeOut}

begin {button1_click}
    FadeOut(Image1,5) ;
end;

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 03:07 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 12:01 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:39 delete

    moneyideas