|
RedisplayPenData
- 0 2.0
Redraws the pen data in the same manner as originally inked.
BOOL RedisplayPenData( HDC hdc, HPENDATA hpndt, LPPOINT lpDelta, LPPOINT lpExt, int nInkWidth, DWORD rgbColor )
Parameters
hdc
Handle to a device context. The mapping mode should be MM_TEXT.
hpndt
Handle to a pen data object. The pen data must be scaled to PDTS_DISPLAY or
PDTS_STANDARDSCALE.
lpDelta
An offset, in logical units, that is subtracted from the pen data points to
position the ink. If lpDelta is NULL, there is no offset.
lpExt
Extent, in logical units, for scaling. If lpExt is NULL, no scaling is performed.
nInkWidth
Width of the ink to be drawn, in pixels (1 to 15). If nInkWidth is 1, the strokes are rendered using the original ink width stored in the stroke
header. An ink width of 0 causes the function to simply return TRUE.
rgbColor
RGB value of the color to draw the ink. If rgbColor is 0xFFFFFFFF, the strokes are rendered using the original ink color stored
in the stroke header.
Return Value
Returns TRUE if successful; otherwise FALSE.
Comments
The nInkWidth and rgbColor values override the pen currently selected for the hdc device context.
If the mapping mode of the hdc device context is not MM_TEXT, two problems can occur:
- RedisplayPenData uses TPtoDP to prepare the pen data points for rendering. After this, the points are in
MM_TEXT coordinates; this assumes an MM_TEXT device context for display. If the
device context is in a different mapping mode, the ink coordinates will not be
correct. Even if you use the ink-scaling functions to bypass this problem, you
will still encounter rounding-error problems between the two scalings.
- No matter what scaling is done, rounding errors occur when converting between
modes. These errors cause the ink to shift slightly when repainted.
For any rendering into a device context that represents anything other than a
display device context, DrawPenDataEx should be used. This is because RedisplayPenData makes assumptions that are not optimal for other devices such as printers or
metafiles.
RedisplayPenData provides the ability to re-create original inking perfectly. To do this, an
application can use either of two methods:
- After the input session ends and data is collected into an HPENDATA object, store the current origin of the window containing the ink. When
calling RedisplayPenData to redraw the ink, supply the origin value in the lpDelta argument, set lpExt to NULL, and set the mapping mode of the device context to MM_TEXT. Only ink
data with a common window origin can be merged into a single HPENDATA.
- In the second method, the application must call two Pen functions immediately
after collecting the data into an HPENDATA object. The first call to MetricScalePenData converts the pen data to display coordinates. The second call to OffsetPenData sets the display coordinates relative to the window containing the original
ink. To display, the application must call RedisplayPenData with lpDelta and lpExt set to NULL and the mapping mode of the device context set to MM_TEXT. If the
application adopts this method for multiple HPENDATA objects, it can later merge them to form a single HPENDATA object (up to the 64K limit).
The second method has the advantages of simplicity and data compression. See
the description of MetricScalePenData for a discussion of the limitations of converting data to display resolution.
Since the pen data has the origin of (0,0) based on the upper-left corner of
the display, applications must move from a screen-relative position to a
position relative to the device context. To do this, subtract the origin of the device
context (in screen coordinates) from the object currently residing in
screen-coordinate space.
The lpDelta parameter enables the application to render ink relative to the window
instead of relative to the screen. An application should call the ClientToScreen function for (0,0) to find the proper screen coordinates to be placed in the *lpDelta POINT structure. Once this is done, the pen data is rendered at the appropriate
location in window coordinates. If lpDelta is NULL, no offset for the data is assumed.
The lpExt argument specifies the extents into which the data should be scaled. If
extents are provided, data is scaled into a rectangle described by lpDelta and lpExt. The values of x and y in lpExt and lpDelta are in the mapping mode of the device context into which the data is rendered.
RedisplayPenData displays pen data with a square graphical device interface (GDI) pen brush
for maximum drawing speed. When displaying wide lines of ink, this optimization
can cause the ends of abutting lines to appear blocky. If you prefer a smoother
look to the joints of wide lines at the expense of rendering speed, draw the
ink with DrawPenData, DrawPenDataEx, or DrawPenDataFmt instead of RedisplayPenData. These functions draw wide lines by flood-filling a region, thus smoothing
the ends.
See Also
DrawPenData, DrawPenDataEx, PDTS_
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|