PixelToInkSpaceFromPoints Method (Automation Only)
PixelToInkSpaceFromPoints Method (Automation Only) |
Converts an array of locations in pixel space coordinates to be an array of locations in ink space coordinates.
Declaration
[C++]
HRESULT PixelToInkSpaceFromPoints (
[in] long hdcDisplay,
[in,out] VARIANT* points
);
[Microsoft® Visual Basic® 6.0]
Public Sub PixelToInkSpaceFromPoints( _
hdcDisplay As Long, _
points As Variant _
)
Parameters
hdcDisplay
[in] The handle of the device context for the containing control or form.
points
[in, out] The Variant array of points, as alternating Long x and y values of the form x0, y0, x1, y1, x2, y2, etc., to convert from a pixel location to ink space coordinates.
For more information about the VARIANT structure, see Using the Automation Library.
Return Value
HRESULT value | Description |
---|---|
S_OK | Success. |
E_POINTER | A parameter contained an invalid pointer. |
E_INVALIDARG | Invalid display handle. |
E_INK_EXCEPTION | An exception occurred inside the method. |
Remarks
PixelToInkSpaceFromPoints converts from pixel to ink space (1 ink unit = .01mm), applies the inverse of the view transform, and then applies the inverse of the object transform.
Example
[Visual Basic 6.0]
This Visual Basic 6.0 example takes an array of points in pixel space of the form x0, y0, x1, y1, x2, y2, etc. and converts it to ink space, then creates a stroke with the converted array.
Option Explicit
Dim theInkCollector As InkCollector
Private Sub Form_Load()
Set theInkCollector = New InkCollector
theInkCollector.hWnd = Me.hWnd
theInkCollector.Enabled = True
Dim ptStrokePoints(9) As Long
ptStrokePoints(0) = 100
ptStrokePoints(1) = 50
ptStrokePoints(2) = 50
ptStrokePoints(3) = 100
ptStrokePoints(4) = 100
ptStrokePoints(5) = 150
ptStrokePoints(6) = 150
ptStrokePoints(7) = 100
ptStrokePoints(8) = 100
ptStrokePoints(9) = 50
Dim thePointArray As Variant
thePointArray = ptStrokePoints
'Convert this array of ink space points to pixels.
theInkCollector.Renderer.PixelToInkSpaceFromPoints Form1.hDC, thePointArray
'The description value is an unused placeholder.
Dim theDescription As Variant
Dim theStroke As IInkStrokeDisp
Set theStroke = theInkCollector.Ink.CreateStroke(thePointArray, theDescription)
theStroke.DrawingAttributes.Color = RGB(0, 255, 0)
theInkCollector.Ink.Strokes.Add theStroke
End Sub