News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

bitmap effect?

Started by hila123, August 17, 2005, 07:35:32 AM

Previous topic - Next topic

hila123

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++?

roticv

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.

hila123

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...

roticv

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.

Mark Jones

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?
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

hila123

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

Mark Jones

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. :)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

gabor

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



hila123

Hi gabor,  Mark Jones

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