Image "fade" in / out (Not opacity)

bezier, bitmap, delphi

Solution

Here is roughly how you would go about doing it (as you said, you're looking for the logic and not the full implementation)

- Create the basic shape outline: Create a partial sine-wave, such that the semi-period (half-wavelength: P1 = L/2) equals the length (x-coordinate size) of your image.

- Add Overtones: Add to it another sine-function. This time with wavelength given by `P2 = P1 / 2 + rnd` where `rnd` is a random real number in the interval `(-P1/4 , +P1 / 4)`

- Repeat: Now P2 becomes the new P1.

That way you can generate the 'wavy-waves' by modulating the main wave and you will get the top boundary.

You can change the sign and get the lower boundary.

The word you might be looking for (for the shape, i.e.) is Overtones. You could look up more on generating overtones for optics or acoustics.

This example for adding overtones to a straight line would give a better idea. The code above adds up these sinusoidal waves of randomly shortening periods to create the wave-on-wave effect (source)

Problem

I want to "fade" in / out an image. But not opacity-wise. Pictures say more than words: Original image: Desired image: How can I do that programatically? Not the way like "use Bitmap.Canvas" but the mathematical approach. ("For dummies" if possible ... :D) I want the image to have a fade-in / -out area, not linear increasing but "curvy". I guess it has something to do with `Bezier` curves? If yes, how would I setup the points to get a curve like that? Or what would be your approach here? Thanks for any help! :)

Original source