none
How is pressure of pen acquired in C++ ? RRS feed

  • Question

  • Hi.

     

    How is pressure of pen acquired in C++ ?
    Where is the sample program ?

     

    Windows Vista x64.
    VisualStudio 2008.
    Wacom FAVO tablet.
    Tablet PC SDK 1.7 ?

     

    Thankyou.

    Monday, May 19, 2008 10:33 AM

All replies

  • Hello Shinonome.

     

    Take a look at the remarks for the IInkStrokeDisp::GetPacketData Method:

     

    To retrieve the description of the packet data, use the stroke's PacketDescription property. This property returns an array of globally unique identifier (GUID) that indicates which property values are returned by the GetPacketData method for each point. The PacketProperty constants contain the available packet property GUIDs.

     

    PacketProperty is a return value for the method. One of the PacketProperty constants is STR_GUID_NORMALPRESSURE. This is the pressure of the pen tip perpendicular to the tablet surface. The greater the pressure on the pen tip, the more ink that is drawn.

     

    I cannot promise that your Wacom FAVO digitizer sends pressure information, however.

     

    Let me know if I can help in any other way.

     

    Sincerely,

     

    Eliot - MSFT

    Monday, May 19, 2008 11:36 PM
  • Thank you for a quick answer.

    Your advice is being tested now.
    However, it doesn't function well.
    I wrote the following codes to IInkCollector.

    ------------------------------------------------------------------------------------------------------------------------------------------------
    IInkCollector* m_lpiIInkCollector ;
       :
       :

    VARIANTvalDesc ;
    HRESULThr ;

    valDesc.vt = VT_BSTR | VT_ARRAY ;

    {
       SAFEARRAYBOUND    sAryBound ;
       BSTR*             bstrData ;

       sAryBound.cElements   = 20 ;
       sAryBound.lLbound     = 0;

       valDesc.parray= SafeArrayCreate( VT_BSTR, 1, &sAryBound ) ;
       SafeArrayAccessData( valDesc.parray, ( void** )&bstrData ) ;

       bstrData[  0 ] = STR_GUID_X ;
       bstrData[  1 ] = STR_GUID_Y ;
       bstrData[  2 ] = STR_GUID_Z ;
       bstrData[  3 ] = STR_GUID_PAKETSTATUS ;
       bstrData[  4 ] = STR_GUID_TIMERTICK ;
       bstrData[  5 ] = STR_GUID_SERIALNUMBER ;
       bstrData[  6 ] = STR_GUID_NORMALPRESSURE ;
       bstrData[  7 ] = STR_GUID_TANGENTPRESSURE ;
       bstrData[  8 ] = STR_GUID_BUTTONPRESSURE ;
       bstrData[  9 ] = STR_GUID_XTILTORIENTATION ;
       bstrData[ 10 ] = STR_GUID_YTILTORIENTATION ;
       bstrData[ 11 ] = STR_GUID_AZIMUTHORIENTATION ;
       bstrData[ 12 ] = STR_GUID_ALTITUDEORIENTATION ;
       bstrData[ 13 ] = STR_GUID_TWISTORIENTATION ;
       bstrData[ 14 ] = STR_GUID_PITCHROTATION ;
       bstrData[ 15 ] = STR_GUID_ROLLROTATION ;
       bstrData[ 16 ] = STR_GUID_YAWROTATION ;
       bstrData[ 17 ] = STR_GUID_WIDTH ;
       bstrData[ 18 ] = STR_GUID_HEIGHT ;
       bstrData[ 19 ] = STR_GUID_FINGERCONTACTCONFIDENCE ;
      
       SafeArrayUnaccessData( valDesc.parray ) ;
    }

    hr = m_lpiIInkCollector->put_DesiredPacketDescription( valDesc ) ;
    _ASSERTE( SUCCEEDED( hr )) ;

    ------------------------------------------------------------------------------------------------------------------------------------------------

    However, only X and Y can be acquired in the Stroke event of the inherited class of InkCollector.
    Even if it is possible to acquire it, it seems not to be able to acquire pressure in real time.
    If the pen is not released from the tablet, the Stroke event is not generated.

    Wacom FAVO tablet can use pressure with Photoshop.
    Isn't there complete sample program to acquire the value of pressure somewhere ?
    I can use it referring to it if there is a complete sample program.

     

    Tuesday, May 20, 2008 3:46 AM