Mike Williams
11/19/2010 6:13:00 AM
"Karl E. Peterson" <karl@exmvps.org> wrote in message
news:ic4jra$3re$1@news.eternal-september.org...
> . . . Then I'll just need to work out the pan/zoom during it.
> The cumulative part may need to be reworked for that, right?
Yep. For example in one of the zoom / pan / fades using the Ken Burns effect
at the link you posted the final image after the zoom /pan / fade has
finished is the zoomed image of the top portion of the sandcastle tower. The
next image (the sunflower) is then zoomed / panned / faded over it, and
during the process the zoomed top part of the tower remains static within
the destination whilst the sunflower is gradually zoomed / panned / faded
into it.
In order to achieve that effect it would probably be best to store the final
"zoomed image of the top portion of the sandcastle tower" in a third
PictureBox (or DIB or whatever). Then immediately before each individual
step of the next zoom / pan / fade you would perform a standard blit of the
third PictureBox directly into the destination PictureBox and then you would
use AlphaBlend to blend the desired portion of the source (the sunflower)
into the same destination.
The single call to AlphaBlend is capable of stretching any desired portion
of the source and blending it into the destination, so you could perform the
pan and the zoom and the fade at the same time and would not need any
additional StretchBlt steps (unless you were unhappy with the COLOR_ON_COLOR
stretch mode of AlphaBlend). Using such a method each "frame" of the zoom /
pan / blend would require one standard blit followed by a single call to
AlphaBlend using a straightforward SourceConstantAlpha in the range zero to
255.
One other point to note is that in order for the zoom to be properly
effective and for it to maintain full quality at all desired "zoom" levels
you would need to use original images which have a much greater pixel size
than the pixel size of the destination (as the Ken Burns pan / zoom / fades
at the link you posted are clearly doing). This would not add any real
complication though and it is just a question of "getting the numbers
right".
To be perfectly honest I have only ever used AlphaBlend for straightforward
blending of images (as in the "fade one image to another" example I posted
yesterday) and I have not written any code which uses it for the combined
panning / zooming / fading which you require, and so I do not have any
suitable code to hand. It is all very definitely "doable" though. I'd
actually have a go myself at this point but we have recently moved house
(hence my absence from this group for some time) and I am totally snowed
under with jobs around the house that need doing! [Phew, that gets me out of
that one ;-)].
Mike