Board index » delphi » Looking for a good IMAGE-component

Looking for a good IMAGE-component

Dear all,
anyone knows a good IMAGE-Component, which allows me to fade-in and
fade-out the displayed image or fade from one image to another image?

Thanks

 

Re:Looking for a good IMAGE-component


Quote
> anyone knows a good IMAGE-Component, which allows me to fade-in and
> fade-out the displayed image or fade from one image to another image?

I have no component to do this work but this code I wrote.
It fades the bitmap B1 to bitmap B2. B3 is a temporary bitmap that
receives the steps between and is then drawn to Image1 (all bitmaps have
24bit
and the same size).
To fade in or out just set one of the images to a color to which you would
like
to fade.

procedure TForm1.Fade;
var I, X, Y, W, Steps: Integer;
     P1, P2, P3: PByteArray;
begin
Steps := 64;  // the steps between the 2 images
for I := 1 to Steps do
 begin
   W := Steps - I;
   for Y := 0 to B1.Height-1 do
    begin
      P1 := B1.Scanline[Y];
      P2 := B2.Scanline[Y];
      P3 := B3.Scanline[Y];
      for X := 0 to B1.Width-1 do
       begin
         P3[X*3] := (P1[X*3]*W + P2[X*3]*I) div Steps;
         P3[X*3+1] := (P1[X*3+1]*W + P2[X*3+1]*I) div Steps;
         P3[X*3+2] := (P1[X*3+2]*W + P2[X*3+2]*I) div Steps;
       end;
    end;
   Image1.Canvas.Draw (0, 0, B3);
   Image1.Repaint;
 end;
end;

Thomas

--------------------------------------------------------------------
e-Mail: tho...@dream-dimensions.de
Homepage: http://www.dream-dimensions.de

Re:Looking for a good IMAGE-component


Thank you so much Thomas,
I'll try it out today evening...

Thomas Hessling <tho...@dream-dimensions.de> wrote in article
<7sjphm$4...@forums.borland.com>...

Quote
> > anyone knows a good IMAGE-Component, which allows me to fade-in and
> > fade-out the displayed image or fade from one image to another image?

> I have no component to do this work but this code I wrote.
> It fades the bitmap B1 to bitmap B2. B3 is a temporary bitmap that
> receives the steps between and is then drawn to Image1 (all bitmaps have
> 24bit
> and the same size).
> To fade in or out just set one of the images to a color to which you
would
> like
> to fade.

> procedure TForm1.Fade;
> var I, X, Y, W, Steps: Integer;
>      P1, P2, P3: PByteArray;
> begin
> Steps := 64;  // the steps between the 2 images
> for I := 1 to Steps do
>  begin
>    W := Steps - I;
>    for Y := 0 to B1.Height-1 do
>     begin
>       P1 := B1.Scanline[Y];
>       P2 := B2.Scanline[Y];
>       P3 := B3.Scanline[Y];
>       for X := 0 to B1.Width-1 do
>        begin
>          P3[X*3] := (P1[X*3]*W + P2[X*3]*I) div Steps;
>          P3[X*3+1] := (P1[X*3+1]*W + P2[X*3+1]*I) div Steps;
>          P3[X*3+2] := (P1[X*3+2]*W + P2[X*3+2]*I) div Steps;
>        end;
>     end;
>    Image1.Canvas.Draw (0, 0, B3);
>    Image1.Repaint;
>  end;
> end;

> Thomas

> --------------------------------------------------------------------
> e-Mail: tho...@dream-dimensions.de
> Homepage: http://www.dream-dimensions.de

Other Threads