IManipulationProcessor
COM公式ドキュメント
IManipulationProcessor は、マルチタッチ入力を監視して応答するための機能を提供します。
メソッド 21
vtbl = vtable インデックス(0始まり)。HSP等からCOMメソッドをインデックス指定で呼ぶ際に使用します。0〜2 は IUnknown。
SupportedManipulations プロパティは、オブジェクトがどの操作(マニピュレーション)をサポートしているかを示すために使用します。(Get)
| manipulations | MANIPULATION_PROCESSOR_MANIPULATIONS* | out | サポートする操作の種別(MANIPULATION_PROCESSOR_MANIPULATIONS)を受け取る。 |
解説(Remarks)
このプロパティを使用すると、オブジェクトがサポートする操作とサポートしない操作を制御できます。 たとえば、x 方向の平行移動操作をサポートしつつ、y 方向の平行移動操作をすべてブロックできます。
例
CoInitialize(0);
hr = spIManipProc.CoCreateInstance(CLSID_ManipulationProcessor, NULL, CLSCTX_ALL);
MANIPULATION_PROCESSOR_MANIPULATIONS mpm;
spIManipProc->get_SupportedManipulations(&mpm);
SupportedManipulations プロパティは、オブジェクトがどの操作(マニピュレーション)をサポートしているかを示すために使用します。(Put)
| manipulations | MANIPULATION_PROCESSOR_MANIPULATIONS | in | サポートする操作の種別(MANIPULATION_PROCESSOR_MANIPULATIONS)を指定する。 |
解説(Remarks)
このプロパティを使用すると、オブジェクトがサポートする操作とサポートしない操作を制御できます。 たとえば、x 方向の平行移動操作をサポートしつつ、y 方向の平行移動操作をすべてブロックできます。
例
CoInitialize(0);
hr = spIManipProc.CoCreateInstance(CLSID_ManipulationProcessor, NULL, CLSCTX_ALL);
MANIPULATION_PROCESSOR_MANIPULATIONS mpm;
spIManipProc->get_SupportedManipulations(&mpm);
PivotPointX プロパティは、オブジェクトの水平方向の中心を表します。(Get)
| pivotPointX | FLOAT* | out | 回転の中心点(ピボット)の X 座標を受け取る。 |
PivotPointX プロパティは、オブジェクトの水平方向の中心を表します。(Put)
| pivotPointX | FLOAT | in | 回転の中心点(ピボット)の X 座標を指定する。 |
PivotPointY プロパティは、オブジェクトの垂直方向の中心を表します。(Get)
| pivotPointY | FLOAT* | out | 回転の中心点(ピボット)の Y 座標を受け取る。 |
PivotPointY プロパティは、オブジェクトの垂直方向の中心を表します。(Put)
| pivotPointY | FLOAT | in | 回転の中心点(ピボット)の Y 座標を指定する。 |
PivotRadius プロパティは、単一指の操作でどの程度の回転を使用するかを決定するために使用します。(Get)
| pivotRadius | FLOAT* | out | 回転判定に用いるピボット半径を受け取る。 |
解説(Remarks)
PivotRadius プロパティは、単一指の操作でどの程度の回転を使用するかを決定するために使用します。(Put)
| pivotRadius | FLOAT | in | 回転判定に用いるピボット半径を指定する。 |
解説(Remarks)
CompleteManipulation メソッドは、開発者が操作(マニピュレーション)を終了することを選択したときに呼び出します。
戻り値
解説(Remarks)
このメソッドは、その応答として ManipulationCompleted() イベントを発生させます。
Windows タッチ ジェスチャの間、最初のタッチ入力が処理のために送信されるとすぐに操作が開始されます。 2 番目のタッチ入力が処理される前に CompleteManipulation が呼び出された場合、 その 2 番目のタッチ入力は新しい操作を開始します。
ProcessDown メソッドは、タッチ ダウンのデータを、ターゲットに関連付けられた操作プロセッサーに供給します。
| manipulatorId | DWORD | in | 処理したいタッチ接触点の識別子。 |
| x | FLOAT | in | ターゲットに関連付けられた水平方向の座標データ。 |
| y | FLOAT | in | ターゲットに関連付けられた垂直方向の座標データ。 |
戻り値
解説(Remarks)
このメソッドは、タッチ ハードウェアからではなくシステム時刻を使用してタイムスタンプを取得します。パフォーマンスが低下している場合に体感を向上させるには、ProcessDownWithTime メソッドを使用してください。
ProcessMove メソッドは、ターゲット オブジェクトの移動データを、その操作プロセッサーに供給します。
| manipulatorId | DWORD | in | 処理したいタッチ接触点の識別子。 |
| x | FLOAT | in | ターゲットに関連付けられた水平方向の座標データ。 |
| y | FLOAT | in | ターゲットに関連付けられた垂直方向の座標データ。 |
戻り値
解説(Remarks)
このメソッドは、タッチ ハードウェアからではなくシステム時刻を使用してタイムスタンプを取得します。パフォーマンスが低下している場合に体感を向上させるには、ProcessMoveWithTime メソッドを使用してください。
ProcessUp メソッドは、タッチ アップのシーケンスのために、ターゲットの操作プロセッサーにデータを供給します。
| manipulatorId | DWORD | in | 処理したいタッチ接触点の識別子。 |
| x | FLOAT | in | ターゲットに関連付けられた水平方向の座標データ。 |
| y | FLOAT | in | ターゲットに関連付けられた垂直方向の座標データ。 |
戻り値
解説(Remarks)
このメソッドは、タッチ ハードウェアからではなくシステム時刻を使用してタイムスタンプを取得します。パフォーマンスが低下している場合に体感を向上させるには、ProcessUpWithTime メソッドを使用してください。
タイムスタンプを含むタッチ ダウンのデータを、ターゲットに関連付けられた操作プロセッサーに供給します。
| manipulatorId | DWORD | in | 処理対象のタッチ接触点の識別子。 |
| x | FLOAT | in | ターゲットに関連付けられた水平方向の座標データ。 |
| y | FLOAT | in | ターゲットに関連付けられた垂直方向の座標データ。 |
| timestamp | DWORD | in | データ イベントの時刻。 |
戻り値
解説(Remarks)
タッチ イベントは、生成された順序とは異なる順序で受信される可能性があります。これを解消するには、イベントを処理する際に TOUCHINPUT 構造体からタイムスタンプを抽出してください。
例
static void ProcessDown(TOUCHINPUT* pTouchInput, IManipulationProcessor* pManipulationProcessor){
pManipulationProcessor->ProcessDownWithTime(
pTouchInput->dwID,
static_cast<float>(pTouchInput->x),
static_cast<float>(pTouchInput->y),
pTouchInput->dwTime
);
}
タイムスタンプを含む移動データを、ターゲット オブジェクトのために、その操作プロセッサーに供給します。
| manipulatorId | DWORD | in | 処理対象のタッチ接触点の識別子。 |
| x | FLOAT | in | ターゲットに関連付けられた水平方向の座標データ。 |
| y | FLOAT | in | ターゲットに関連付けられた垂直方向の座標データ。 |
| timestamp | DWORD | in | データ イベントの時刻。 |
戻り値
解説(Remarks)
タッチ イベントは、生成された順序とは異なる順序で受信される可能性があります。これを解消するには、イベントを処理する際に TOUCHINPUT 構造体からタイムスタンプを抽出してください。
例
static void ProcessMove(TOUCHINPUT* pTouchInput, IManipulationProcessor* pManipulationProcessor){
pManipulationProcessor->ProcessMoveWithTime(
pTouchInput->dwID,
static_cast<float>(pTouchInput->x),
static_cast<float>(pTouchInput->y),
pTouchInput->dwTime
);
}
タイムスタンプを含むデータを、タッチ アップのシーケンスのために、ターゲットの操作プロセッサーに供給します。
| manipulatorId | DWORD | in | 処理対象のタッチ接触点の識別子。 |
| x | FLOAT | in | ターゲットに関連付けられた水平方向の座標データ。 |
| y | FLOAT | in | ターゲットに関連付けられた垂直方向の座標データ。 |
| timestamp | DWORD | in | データ イベントの時刻。 |
戻り値
解説(Remarks)
タッチ イベントは、生成された順序とは異なる順序で受信される可能性があります。これを解消するには、イベントを処理する際に TOUCHINPUT 構造体からタイムスタンプを抽出してください。
例
static void ProcessUp(TOUCHINPUT* pTouchInput, IManipulationProcessor* pManipulationProcessor){
pManipulationProcessor->ProcessUpWithTime(
pTouchInput->dwID,
static_cast<float>(pTouchInput->x),
static_cast<float>(pTouchInput->y),
pTouchInput->dwTime
);
}
ターゲット オブジェクトの水平方向の速度を計算して返します。
| velocityX | FLOAT* | out | 計算された水平方向の速度。 |
戻り値
解説(Remarks)
この値は、IInertiaProcessor インターフェイスを使用する際に役立ちます。操作(マニピュレーション)が完了したときにこの値を渡してください。
垂直方向の速度を計算して返します。
| velocityY | FLOAT* | out | 計算された垂直方向の速度。 |
戻り値
解説(Remarks)
この値は、IInertiaProcessor インターフェイスを使用する際に役立ちます。操作(マニピュレーション)が完了したときにこの値を渡してください。
GetExpansionVelocity メソッドは、ターゲット オブジェクトが拡大している速度を計算します。
| expansionVelocity | FLOAT* | out | 拡大の速度。 |
戻り値
解説(Remarks)
この値は、IInertiaProcessor インターフェイスを使用する際に役立ちます。操作(マニピュレーション)が完了したときにこの値を渡してください。
GetAngularVelocity メソッドは、ターゲット オブジェクトが動いている回転速度を計算します。
| angularVelocity | FLOAT* | out | 計算された回転速度。 |
戻り値
解説(Remarks)
この値は、IInertiaProcessor インターフェイスの初期状態を設定する際に役立ちます。操作(マニピュレーション)が完了したときにこの値を渡してください。
このプロパティは、ProcessMoveWithTime、ProcessMoveWithTime、ProcessUpWithTime の呼び出しによって明示的なタイムスタンプが指定されていない場合、ラジアン毎ミリ秒で表されます。指定されている場合、この関数はラジアン毎ユーザー定義時間単位を使用します。
拡大縮小または回転ジェスチャの接触点間の距離が、操作(マニピュレーション)をトリガーするためにどの程度大きくなければならないかを指定します。(Get)
| minRadius | FLOAT* | out | 拡大縮小・回転を有効とする最小半径を受け取る。 |
解説(Remarks)
この値を設定すると、操作プロセッサーは半径が小さすぎるジェスチャを無視するようになります。
これは、ユーザーがオブジェクトを小さすぎる半径に操作するのを防ぎたい場合に役立ちます。たとえば、
円に対して操作プロセッサーを使用しており、その半径を 100 ピクセルより大きく保ちたい場合は、
この値を 10000 に設定します。
例
pManip->put_MinimumScaleRotateRadius(4000.0f);
拡大縮小または回転ジェスチャの接触点間の距離が、操作(マニピュレーション)をトリガーするためにどの程度大きくなければならないかを指定します。(Put)
| minRadius | FLOAT | in | 拡大縮小・回転を有効とする最小半径を指定する。 |
解説(Remarks)
この値を設定すると、操作プロセッサーは半径が小さすぎるジェスチャを無視するようになります。
これは、ユーザーがオブジェクトを小さすぎる半径に操作するのを防ぎたい場合に役立ちます。たとえば、
円に対して操作プロセッサーを使用しており、その半径を 100 ピクセルより大きく保ちたい場合は、
この値を 10000 に設定します。
例
pManip->put_MinimumScaleRotateRadius(4000.0f);
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
HSP用 COM定義
#usecom / #comfunc によるHSPのCOM呼び出し定義。数字は vtbl インデックス(0始まり)。クラスIDが無い場合 #usecom の末尾は "{}"、ある場合は "{CLSID}"。
#define global IID_IManipulationProcessor "{A22AC519-8300-48A0-BEF4-F1BE8737DBA4}" #usecom global IManipulationProcessor IID_IManipulationProcessor "{597D4FB0-47FD-4AFF-89B9-C6CFAE8CF08E}" #comfunc global IManipulationProcessor_get_SupportedManipulations 3 var #comfunc global IManipulationProcessor_put_SupportedManipulations 4 int #comfunc global IManipulationProcessor_get_PivotPointX 5 var #comfunc global IManipulationProcessor_put_PivotPointX 6 float #comfunc global IManipulationProcessor_get_PivotPointY 7 var #comfunc global IManipulationProcessor_put_PivotPointY 8 float #comfunc global IManipulationProcessor_get_PivotRadius 9 var #comfunc global IManipulationProcessor_put_PivotRadius 10 float #comfunc global IManipulationProcessor_CompleteManipulation 11 #comfunc global IManipulationProcessor_ProcessDown 12 int,float,float #comfunc global IManipulationProcessor_ProcessMove 13 int,float,float #comfunc global IManipulationProcessor_ProcessUp 14 int,float,float #comfunc global IManipulationProcessor_ProcessDownWithTime 15 int,float,float,int #comfunc global IManipulationProcessor_ProcessMoveWithTime 16 int,float,float,int #comfunc global IManipulationProcessor_ProcessUpWithTime 17 int,float,float,int #comfunc global IManipulationProcessor_GetVelocityX 18 var #comfunc global IManipulationProcessor_GetVelocityY 19 var #comfunc global IManipulationProcessor_GetExpansionVelocity 20 var #comfunc global IManipulationProcessor_GetAngularVelocity 21 var #comfunc global IManipulationProcessor_get_MinimumScaleRotateRadius 22 var #comfunc global IManipulationProcessor_put_MinimumScaleRotateRadius 23 float ; ※数字は vtbl インデックス(0始まり)。0/1/2 は IUnknown(QueryInterface/AddRef/Release)。 ; ※#usecom 末尾は CoCreateInstance 用のクラスID(コクラスCLSID, SDKから自動取得)。 ; ※出力/バッファ引数は var(変数直渡し)。varptr 方式にも切替可。#define global IID_IManipulationProcessor "{A22AC519-8300-48A0-BEF4-F1BE8737DBA4}" #usecom global IManipulationProcessor IID_IManipulationProcessor "{597D4FB0-47FD-4AFF-89B9-C6CFAE8CF08E}" #comfunc global IManipulationProcessor_get_SupportedManipulations 3 sptr #comfunc global IManipulationProcessor_put_SupportedManipulations 4 int #comfunc global IManipulationProcessor_get_PivotPointX 5 sptr #comfunc global IManipulationProcessor_put_PivotPointX 6 float #comfunc global IManipulationProcessor_get_PivotPointY 7 sptr #comfunc global IManipulationProcessor_put_PivotPointY 8 float #comfunc global IManipulationProcessor_get_PivotRadius 9 sptr #comfunc global IManipulationProcessor_put_PivotRadius 10 float #comfunc global IManipulationProcessor_CompleteManipulation 11 #comfunc global IManipulationProcessor_ProcessDown 12 int,float,float #comfunc global IManipulationProcessor_ProcessMove 13 int,float,float #comfunc global IManipulationProcessor_ProcessUp 14 int,float,float #comfunc global IManipulationProcessor_ProcessDownWithTime 15 int,float,float,int #comfunc global IManipulationProcessor_ProcessMoveWithTime 16 int,float,float,int #comfunc global IManipulationProcessor_ProcessUpWithTime 17 int,float,float,int #comfunc global IManipulationProcessor_GetVelocityX 18 sptr #comfunc global IManipulationProcessor_GetVelocityY 19 sptr #comfunc global IManipulationProcessor_GetExpansionVelocity 20 sptr #comfunc global IManipulationProcessor_GetAngularVelocity 21 sptr #comfunc global IManipulationProcessor_get_MinimumScaleRotateRadius 22 sptr #comfunc global IManipulationProcessor_put_MinimumScaleRotateRadius 23 float ; ※数字は vtbl インデックス(0始まり)。0/1/2 は IUnknown(QueryInterface/AddRef/Release)。 ; ※#usecom 末尾は CoCreateInstance 用のクラスID(コクラスCLSID, SDKから自動取得)。 ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。