Board index » delphi » Water effect in a TImage component (bitmap with water effect)

Water effect in a TImage component (bitmap with water effect)

Hello,

I want to make a water effect (for example a rain effect) in a bitmap, or a
component who do this, with an integrated picture container...
I only want to add a visual effect in my program.

Thank you very much (excuse me for bad english) :)

 

Re:Water effect in a TImage component (bitmap with water effect)


"Kaleus" <S...@netcourrier.com> skrev i en meddelelse
news:3c418ca1$1_1@dnews...

Quote
> I want to make a water effect (for example a rain effect) in a bitmap, or
a
> component who do this, with an integrated picture container...
> I only want to add a visual effect in my program.

http://www.efg2.com/Lab/Library/SimulationAndModeling.htm
--
Finn Tolderlund

Re:Water effect in a TImage component (bitmap with water effect)


"Finn Tolderlund" <XnospamYfi...@Ymail.tdcadsl.dkXnospamY> skrev i en
meddelelse news:3c41aa53_1@dnews...
Quote
> "Kaleus" <S...@netcourrier.com> skrev i en meddelelse
> news:3c418ca1$1_1@dnews...
> > I want to make a water effect (for example a rain effect) in a bitmap,
or
> a
> > component who do this, with an integrated picture container...
> > I only want to add a visual effect in my program.

> http://www.efg2.com/Lab/Library/SimulationAndModeling.htm

and
http://homepages.borland.com/efg2lab/Library/Delphi/Algorithms/
Search for the word "ripple" on both pages.
--
Finn Tolderlund

Re:Water effect in a TImage component (bitmap with water effect)


Hugo Elias "good-looking textured light-sourced bouncy fun smart and
stretchy page " has a interesting approach too
(http://freespace.{*word*269}.net/hugo.elias/graphics/x_water.htm).

Michael Hansen.

Re:Water effect in a TImage component (bitmap with water effect)


Wooooow...
Thank you for your help, but it's excesively too complex for me, I'am a
newbie and don't understand any line of this type of code.
The best will be a snippet code, only a Copy/paste to use it :)
If you can help me, I will be very happy.

Thank you very much

Re:Water effect in a TImage component (bitmap with water effect)


something like:

procedure rippleify(var bmp: timage, origin: tpoint);
var
   x,y: integer;
   d  : real;
begin
   for x:=0 to pred(bmp.width) do
   for y:=0 to pred(bmp.height) do
      begin
         d:=255*sin(sqrt(sqr(x-origin.x)+sqr(y-origin.y));
         bmp.canvas.pixels[x,y].r:=(bmp.canvas.pixels[x,y].r*d) div 255;
         bmp.canvas.pixels[x,y].g:=(bmp.canvas.pixels[x,y].g*d) div 255;
         bmp.canvas.pixels[x,y].b:=(bmp.canvas.pixels[x,y].b*d) div 255;
      end;
end;

This will be *slow* it simple but you may need to make a few changes as its
been a while since i've played with timages...
This only fades image between full brightness and black...
hope it helps,
--Oliver

PS you may want to look at www.gfody.com <--fastlib is the graphics library
i use...

Quote
----- Original Message -----
From: "Kaleus" <S...@netcourrier.com>
Newsgroups: borland.public.delphi.graphics
Sent: Monday, January 14, 2002 7:42 AM
Subject: Re: Water effect in a TImage component (bitmap with water effect)

> Wooooow...
> Thank you for your help, but it's excesively too complex for me, I'am a
> newbie and don't understand any line of this type of code.
> The best will be a snippet code, only a Copy/paste to use it :)
> If you can help me, I will be very happy.

> Thank you very much

Re:Water effect in a TImage component (bitmap with water effect)


Aargh... sorry i was thinking about fastlib, tcolor isnt split into r g
b...argh
Quote
"Oliver Hunt" <nospamre...@bigfoot.com> wrote in message

news:3c42a564$1@clear.net.nz...
Quote
> something like:

> procedure rippleify(var bmp: timage, origin: tpoint);
> var
>    x,y: integer;
>    d  : real;
> begin
>    for x:=0 to pred(bmp.width) do
>    for y:=0 to pred(bmp.height) do
>       begin
>          d:=255*sin(sqrt(sqr(x-origin.x)+sqr(y-origin.y));
>          bmp.canvas.pixels[x,y].r:=(bmp.canvas.pixels[x,y].r*d) div 255;
>          bmp.canvas.pixels[x,y].g:=(bmp.canvas.pixels[x,y].g*d) div 255;
>          bmp.canvas.pixels[x,y].b:=(bmp.canvas.pixels[x,y].b*d) div 255;
>       end;
> end;

> This will be *slow* it simple but you may need to make a few changes as
its
> been a while since i've played with timages...
> This only fades image between full brightness and black...
> hope it helps,
> --Oliver

> PS you may want to look at www.gfody.com <--fastlib is the graphics
library
> i use...
> ----- Original Message -----
> From: "Kaleus" <S...@netcourrier.com>
> Newsgroups: borland.public.delphi.graphics
> Sent: Monday, January 14, 2002 7:42 AM
> Subject: Re: Water effect in a TImage component (bitmap with water effect)

> > Wooooow...
> > Thank you for your help, but it's excesively too complex for me, I'am a
> > newbie and don't understand any line of this type of code.
> > The best will be a snippet code, only a Copy/paste to use it :)
> > If you can help me, I will be very happy.

> > Thank you very much

Re:Water effect in a TImage component (bitmap with water effect)


"Kaleus" <S...@netcourrier.com> wrote

Quote
> I want to make a water effect (for example a rain effect) in a bitmap, or a
> component who do this, with an integrated picture container...
> I only want to add a visual effect in my program.

I did this once, as a experiment, and posted here in this newsgroup.
It's a component where you link a source image and a destination
image, and can create ripples and rain.

If you can download it from efg's pages at
http://homepages.borland.com/efg2lab/Library/Delphi/Algorithms/Leonel...
ffects.zip

If you improve it I would like to see the changes :)

Thanks,
Leonel

Re:Water effect in a TImage component (bitmap with water effect)


now this work although it is absolutely {*word*201}...
procedure rippleify(var bmp:timage; origin: tpoint);
var
   x,y: integer;
   d  : real;
   argb: array of byte;
   pargb: pointer;
   temp: tcolor;
   temp2: ^tcolor;
begin
   argb:=nil;
   for x:=0 to pred(bmp.width) do
   for y:=0 to pred(bmp.height) do
      begin
         temp:=bmp.canvas.pixels[x,y];
         pargb:=@temp;
         argb:=pargb;
         d:=55*((sin(sqrt(sqr(x)+sqr(y))/3)+1)/2)+200;
         argb[0]:=round((argb[0]*d) / 255);
         argb[1]:=round((argb[1]*d) / 255);
         argb[2]:=round((argb[2]*d) / 255);
         pargb:=argb;
         temp2:=pargb;
         temp:=temp2^;
         bmp.canvas.pixels[x,y]:=temp;
      end;

end;

Quote
----- Original Message -----
From: "Oliver Hunt" <nospamre...@bigfoot.com>
Newsgroups: borland.public.delphi.graphics
Sent: Monday, January 14, 2002 11:30 PM
Subject: Re: Water effect in a TImage component (bitmap with water effect)

> Aargh... sorry i was thinking about fastlib, tcolor isnt split into r g
> b...argh
> "Oliver Hunt" <nospamre...@bigfoot.com> wrote in message
> news:3c42a564$1@clear.net.nz...
> > something like:

> > procedure rippleify(var bmp: timage, origin: tpoint);
> > var
> >    x,y: integer;
> >    d  : real;
> > begin
> >    for x:=0 to pred(bmp.width) do
> >    for y:=0 to pred(bmp.height) do
> >       begin
> >          d:=255*sin(sqrt(sqr(x-origin.x)+sqr(y-origin.y));
> >          bmp.canvas.pixels[x,y].r:=(bmp.canvas.pixels[x,y].r*d) div 255;
> >          bmp.canvas.pixels[x,y].g:=(bmp.canvas.pixels[x,y].g*d) div 255;
> >          bmp.canvas.pixels[x,y].b:=(bmp.canvas.pixels[x,y].b*d) div 255;
> >       end;
> > end;

> > This will be *slow* it simple but you may need to make a few changes as
> its
> > been a while since i've played with timages...
> > This only fades image between full brightness and black...
> > hope it helps,
> > --Oliver

> > PS you may want to look at www.gfody.com <--fastlib is the graphics
> library
> > i use...
> > ----- Original Message -----
> > From: "Kaleus" <S...@netcourrier.com>
> > Newsgroups: borland.public.delphi.graphics
> > Sent: Monday, January 14, 2002 7:42 AM
> > Subject: Re: Water effect in a TImage component (bitmap with water
effect)

> > > Wooooow...
> > > Thank you for your help, but it's excesively too complex for me, I'am
a
> > > newbie and don't understand any line of this type of code.
> > > The best will be a snippet code, only a Copy/paste to use it :)
> > > If you can help me, I will be very happy.

> > > Thank you very much

"Oliver Hunt" <nospamre...@bigfoot.com> wrote in message
news:3c42b2e0@clear.net.nz...
> Aargh... sorry i was thinking about fastlib, tcolor isnt split into r g
> b...argh
> "Oliver Hunt" <nospamre...@bigfoot.com> wrote in message
> news:3c42a564$1@clear.net.nz...
> > something like:

> > procedure rippleify(var bmp: timage, origin: tpoint);
> > var
> >    x,y: integer;
> >    d  : real;
> > begin
> >    for x:=0 to pred(bmp.width) do
> >    for y:=0 to pred(bmp.height) do
> >       begin
> >          d:=255*sin(sqrt(sqr(x-origin.x)+sqr(y-origin.y));
> >          bmp.canvas.pixels[x,y].r:=(bmp.canvas.pixels[x,y].r*d) div 255;
> >          bmp.canvas.pixels[x,y].g:=(bmp.canvas.pixels[x,y].g*d) div 255;
> >          bmp.canvas.pixels[x,y].b:=(bmp.canvas.pixels[x,y].b*d) div 255;
> >       end;
> > end;

> > This will be *slow* it simple but you may need to make a few changes as
> its
> > been a while since i've played with timages...
> > This only fades image between full brightness and black...
> > hope it helps,
> > --Oliver

> > PS you may want to look at www.gfody.com <--fastlib is the graphics
> library
> > i use...
> > ----- Original Message -----
> > From: "Kaleus" <S...@netcourrier.com>
> > Newsgroups: borland.public.delphi.graphics
> > Sent: Monday, January 14, 2002 7:42 AM
> > Subject: Re: Water effect in a TImage component (bitmap with water
effect)

> > > Wooooow...
> > > Thank you for your help, but it's excesively too complex for me, I'am
a
> > > newbie and don't understand any line of this type of code.
> > > The best will be a snippet code, only a Copy/paste to use it :)
> > > If you can help me, I will be very happy.

> > > Thank you very much

Re:Water effect in a TImage component (bitmap with water effect)


Thank you very much Leonel, your component is exactly what i have searched
for...

Amicaly :)

Re:Water effect in a TImage component (bitmap with water effect)


"Kaleus" <S...@netcourrier.com> wrote :

Quote
> Thank you very much Leonel, your component is exactly what i have searched
> for...

No problem. Check the source for an adress of an article in gamasutra where I
based it from, if you want to learn how it works. It can use some optimizations
to be a lot faster, though.

Leonel

Other Threads