The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: hila123 on August 17, 2005, 07:35:32 AM

Title: bitmap effect?
Post by: hila123 on August 17, 2005, 07:35:32 AM
i just wonder is there any tutorial/example about making this kind of image in ASM/C++

http://www.codeproject.com/aspnet/WSCaptcha.asp
http://www.codeproject.com/aspnet/CaptchaImage.asp

what i manage to do after reading the above tutorial is create a bitmap, draw text on it, make Ellipse on the bitmap, and display it on the dialog box... (in ASM and C++)
i cannot find any other win32 api to render the bitmap into water effect.... :'(

anyone know how to do that kind of effect in ASM/C++?
Title: Re: bitmap effect?
Post by: roticv on August 17, 2005, 12:09:43 PM
That coder used someone else's filter.

"These filters are realized using code written by Christian Graus in his Filter class (Filter.cs)."

If you are really interested in coding the filter, I found this while "googling". http://www.gamedev.net/reference/articles/article915.asp

PS: He/she not only used water effects filter, but also swirl filter.
Title: Re: bitmap effect?
Post by: hila123 on August 17, 2005, 04:03:49 PM
thanks for reply actually i read that article b4... :wink

is anyone know other simple way to achieve that effect not necessary water effect...:eek

what i need to do is manipulate the image to make text disply on the bitmap harder to read...
Title: Re: bitmap effect?
Post by: roticv on August 17, 2005, 04:11:27 PM
I guess it all boils down to erm trying to find some available filters (or you would have to code them yourselves) to make the text in the bitmap harder to read.
Title: Re: bitmap effect?
Post by: Mark Jones on August 17, 2005, 04:28:22 PM
Maybe check out the OGL forums here and apply a translucent mask image to the text? Something like a cross-hatch pattern, then rotate the mask 0.1 degrees for every iteration needed?
Title: Re: bitmap effect?
Post by: hila123 on August 18, 2005, 12:07:03 AM
hi Mark Jones,

i cannot find "translucent mask" in OpenGL forum...btw, what is translucent mask?

do u have more info on this subject?

thanks in advance  :wink
Title: Re: bitmap effect?
Post by: Mark Jones on August 18, 2005, 02:35:20 AM
Hi, get the samples from:
http://www.masmforum.com/simple/index.php?topic=2485.0

The Alpha_Blend_Texture example shows how to make moving, semi-transparent surfaces in OpenGL. Very interesting stuff. :)
Title: Re: bitmap effect?
Post by: gabor on August 18, 2005, 01:42:42 PM
Hi!

I guess we are starting to fire on a flea with a cannon, or I got something wrong...

If the point is to make a bitmap text harder to read I would use some very old fx, like ripple or wave.
Ripple is a linear, wave is a sinusoid method to displace the pixels of the bitmap. If these displacements are applied in both vertical and horizontal directions a water-like effect can be achieved.

Here is some pseudo C code

Ripple:


bitmap B1[w,h]
bitmap B2[w,h]
int rippleLengthX
int rippleAmplitudeX
int rippleLengthY
int rippleAmplitudeY

x = y = 0;
rx = ry = 0;
while ((x < w) && (y < h))
{
   if (rx == rippleLengthX) rx = 0;
   else rx++;
   if (ry == rippleLengthY) ry = 0;
   else ry++;

   if (rx < rippleLengthX/2)
     dx += 2*rippleAmplitudeX/rippleLengthX;
   else
     dx -= 2*rippleAmplitudeX/rippleLengthX;

   if (ry < rippleLengthY/2)
     dy += 2*rippleAmplitudeY/rippleLengthY;
   else
     dy -= 2*rippleAmplitudeY/rippleLengthY;

   B2[x,y] = B1[round(x+dx) mod w,round(y+dy) mod h]
};



The wave is the same except the displacement is like this:



   dx += rippleAmplitudeX*(sin(rx*2*PI/rippleLengthX));
   dy += rippleAmplitudeY*sin(ry*2*PI/rippleLengthY));



Since the sinus function is cyclic there is no need to make a loop for rippleLength, rx and ry can be increased unlimitedly.
These codes were written on the fly, based on my really old coding efforts, it can happen that I messed up something.

The effect can be more distorting if random values are used for length and/or amplitude.

Enjoy!

Gábor


Title: Re: bitmap effect?
Post by: hila123 on August 18, 2005, 08:17:50 PM
Hi gabor,  Mark Jones

thanks for reply and will try it ... :wink