Bitmaps, flicker free drawing
Version B
Long long ago in a galaxy far far away...
-
Demonstration
-
The window:
-
in the background: the image with the stars (created dynamically))
-
in the foreground: the image showing spacecraft (the image can be downloaded here, and the image mask here)
-
horizontal scroll bar
- vertical scroll bar on the left side of the window
-
not resizeable
-
Scene drawing:
-
The stars appear behind the spacecraft; use mask to remove the background from the original spacecraft bitmap
-
The spacecraft is always in the center of the scene
- Vertical scroll bar changes the side of the spacecraft (from 10% to 200% of original size)
-
The stars move behind the spacecraft, so it seems like the spacecraft is flying
-
The speed of animation depends on the horizontal scroll bar position (Caution: depending on hardware, the speed of animation can depend indirectly on the vertical scroll bar as well, i.e. the larger the spaceship, the slower the animation, as StretchBlt takes more time to execute; please don't care about it)
-
Requirements:
-
all drawing should be flicker-free
-
all created GDI objects must be deleted
-
objects selected as current on DC must not be deleted
-
avoid compilation warnings
-
The application does not need to be exactly the same as on the demonstration (e.g. with respect to direction of stars movement, stars' velocity, the size of the window, etc...), but should fulfill all the requirements above
-
Hints:
-
MaskBlt(); BitBlt(); StretchBlt()
-
WM_HSCROLL, WM_VSCROLL, WM_TIMER
- WS_EX_LEFTSCROLLBAR
-
Approximate points:
-
flicker-free drawing: 1.5
-
animation: 1.5
-
scroll bar funtionality: 1.5
-
displaying bitmaps: 1.5
- resizing the spacecraft: 3.5
- vertical scroll bar on the left side of the window: 0.5