|
|
1.1 root 1: Sample: World Coordinate Transforms
2:
3:
4: Summary:
5:
6: The WORLD sample demonstrates how an image can be translated and scaled
7: using SetWorldTransform(). The image is read from the metafile.
8:
9: After the application is started, go to the Metafile menu and select
10: "Open" in order to specify the metafile which should be used. The image
11: is displayed and the horizontal and vertical thumbs are set to the
12: middle of the scrollbars. Use the scrollbars to translate the image. In
13: order to scale the image, choose the Scale menu option. Select the
14: desired horizontal and vertical scaling factors from the listboxes.
15:
16:
17: More Information:
18:
19: The sample metafile, SAMPLE.EMF, was created using the code from the
20: Overviews manual, in Chapter 74: Metafiles. PlayEnhMetafile() is used
21: in the WM_PAINT case to display the image stored in the metafile.
22:
23: SetWorldTransform() takes two parameters: a device context and a
24: structure which defines the transform to be applied. The transform
25: contains 6 fields, which have the following use in this program:
26:
27: eM11 : Horizontal Scaling Factor
28: eM12 : Not Used
29: eM21 : Not Used
30: eM22 : Vertical Scaling Factor
31: eDx : Horizontal Translation
32: eDy : Vertical Translation
33:
34: The WM_HSCROLL and WM_VSCROLL cases are handled pretty much as they
35: are in any of the other samples, except that ScrollWindow() is not used
36: to update the window contents. Instead, the appropriate modification is
37: made to the transform and InvalidateRect() is called to update the
38: window.
39:
40: When the OK button is selected in the Scale Image dialog, the transform
41: is updated and InvalidRect() is called to update the window.
42:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.