HOWTO: How to Use Paths to Create Text EffectsID: Q128091
|
This article defines the term "path" for the purposes of this article, and
it explains how you can get sample code (provided in TEXTFX.EXE, a self-
extracting file) that shows by example how to use paths to draw text at
varying angles, orientations, and sizes. In addition, the sample code gives
useful routines for displaying path data.
The following file is available for download from the Microsoft Software
Library:
~ Textfx.exeFor more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
A path is one or more figures (or shapes) that are filled, outlined, or
both filled and outlined. Computer-aided design (CAD) applications use
paths to create unique clipping regions, to draw outlines of irregular
shapes, and to fill the interiors of irregular shapes.
A path is associated with a Device Context (DC) but unlike other objects
associated with a DC, such as pens and brushes, a path has no default
object.
To create a path, you first call BeginPath(). Then use the drawing
functions in the table below to add to the path. Any drawing done using
these functions is recorded as part of the path. When you finish building
the path, call EndPath(). The new path can then be converted to a region by using PathToRegion(), selected as a clipping region for a device context by using SelectClipPath(), and rendered by using StrokePath() or FillPath(). In addition, as this sample illustrates, the path can be retrieved by using GetPath() and manipulated programmatically.
NOTE: When you use TextOut or ExtTextOut in paths, the font selected into the path's device context must be a true type font.
Functions supported in paths:
AngleArc LineTo Polyline
Arc MoveToEx PolylineTo
ArcTo Pie PolyPolygon
Chord PolyBezier PolyPolyline
CloseFigure PolyBezierTo Rectangle
Ellipse PolyDraw RoundRect
ExtTextOut Polygon TextOut
Functions not supported under Windows 95:
AngleArc
ArcTo
PolyDraw
Functions not supported in a path under Windows 95:
Arc
Chord
Ellipse
Pie
Rectangle
RoundRect
The following path functions are used in the TextFX sample:
BeginPath
EndPath
GetPath
FillPath
StrokePath
To use TextFX, run it, and then draw two lines into the client area (they
don't have to be straight). The first line appears as blue and the second
appears as red. These lines serve as guides for how the text will be
rendered. After completing the second line, the text "This is a test" will
be drawn so that it appears between the two guide lines.
For additional information on paths, please see the PATHS sample included with the Win32 SDK.
Additional query words: stones effects effect font fx
Keywords : kbcode kbfile kbsample kbNTOS350 kbNTOS351 kbNTOS400 kbSDKWin32 kbWinOS95
Version : winnt:3.5,3.51,4.0
Platform : winnt
Issue type : kbhowto
Last Reviewed: June 16, 1999