|
|
1.1 root 1: Sample: Enhanced Metafile Editor
2:
3: Summary:
4:
5: This sample demonstrates the Win32 Enhanced Metafile API
6: functions.
7:
8: More Information:
9:
10: The MFEDIT metafile editor provides the following
11: functionalities:
12:
13: Playback and recording of GDI calls
14: Embedding bitmap and enhanced metafile into another
15: enhanced metafile with transformation
16: Hit-testing against enhanced metafile records
17: Random access playback
18: Playback metafile records one-by-one
19: Selective recording of existing enhanced metafile records
20: into a new enhanced metafile
21: Drawing with pen, text, bezier, line, ellipse, rectangle
22: and embedding bitmap and enhanced metafile tools
23:
24:
25: Playback and Recording of GDI calls
26:
27: To playback an existing enhanced metafile, choose Load
28: Metafile from the File menu or click on the Eject button
29: to bring up the open file dialog and select the
30: appropriate file. Then click on the Play button to play
31: it on the drawing surface.
32:
33: To record, click on the Record button and draw on the
34: drawing surface with the graphic tools provided. When
35: done, click on the Stop button.
36:
37: The GDI calls will be recorded as c:\metafx.emf where x
38: is 0, 1, 2, 3, etc. If you want to save the metafile
39: with a different name, choose Record Metafile As from the
40: File menu.
41:
42: The new filename will be used as the root for all
43: metafile recorded; 0, 1, 2, etc will be appended to the
44: root name.
45:
46: The default drawing tool is "pen". To select a different
47: drawing tool, simply click on the desired tool button in
48: the control panel.
49:
50: Embedding Bitmap and Enhanced Metafile Into Another Enhanced
51: Metafile with Transformation
52:
53: Click the Record button. Select the Bitmap or Metafile
54: tool and then embed the currently loaded bitmap or
55: metafile as described in 7 below. When done, click the
56: Stop button.
57:
58: Hit-Testing Against Enhanced Metafile Records
59:
60: Playback an enhanced metafile by clicking on the Playback
61: button. Then choose Hit Test from the Edit menu. The
62: cursor will be changed to a cross when the mouse pointer
63: is over the drawing surface.
64:
65: Then click on the graphic object played back in the
66: drawing surface. The editor will search through the
67: metafile record after record to find the record that
68: corresponds to the object based on the mouse position.
69: The search provides a visual cue by changing the graphic
70: objects to red as it goes until it hits the corresponding
71: object. If there is a hit, the record number will be
72: displayed on the control panel, an beep will be heard and
73: a hit message displayed on the bottom.
74:
75: When done, uncheck the Hit Test menu item.
76:
77: Random Access Playback
78:
79: Click on the number button in the control panel to
80: playback a particular record. To access a non single
81: digit record, click on the 10+ button an appropriate
82: number of times and then the appropriate number button to
83: bring the sum to the record desired.
84:
85: Playback Metafile Records One-by-One
86:
87: Click on the Fast Forward button to play the metafile
88: record one at a time.
89:
90: Selective Recording of Existing Enhanced Metafile Records
91: Into a New Enhanced Metafile
92:
93: Click on the Record button and the appropriate number
94: button for playing back selective metafile records in the
95: drawing surface. The playback records will be recorded
96: into the new metafile. When done, click on the Stop
97: button.
98:
99: Drawing With Pen, Text, Bezier, Line, Ellipse, Rectangle and
100: Embedding Bitmap and Enhanced Metafile Tools
101:
102: The default pen is black. To change the pen color,
103: simply choose the Pen menu item from the Options menu to
104: select a color.
105:
106: The default brush used by the Fill Rectangle and Fill
107: Ellipse routines is black. To change the brush color,
108: simply choose Brush from the Option menu to select a
109: color.
110:
111: The "Text" tool uses the default system font. To change
112: the font, simply choose Font from the Option menu to
113: change to a different font and font attributes.
114:
115: The "Bezier" tool takes four points initially and three
116: thereafter. To draw a bezier curve, simple select the
117: "Bezier" tool and click on the drawing surface three or
118: four times to place the control points.
119:
120: To embed a currently loaded bitmap, simply select the
121: "Bitmap" tool and click three points on the drawing
122: surface to describe the destination of where you would
123: like the bitmap to go. The editor will do the proper
124: transform to the bitmap and embed the bitmap to the
125: drawing.
126:
127: To load a bitmap, simply choose Load Bitmap from the File
128: menu and do the selection. The "Bitmap" tool optionally
129: takes a mask bitmap. The mask bitmap has to be a
130: monochrome bitmap.
131:
132: To load a mask bitmap, simply choose Load Mask Bitmap
133: from the File menu to do the selection. Select a color
134: bitmap as the mask has the effect of reseting the mask to
135: none.
136:
137: To embed a currently loaded enhanced metafile, simply
138: select the "Embed Enhanced Metafile" tool and click three
139: points on the drawing surface to describe the destination
140: of where you would like the enhanced metafile to go. The
141: editor will do the proper transformation on the metafile
142: and embed it to the drawing.
143:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.