일반적인 호출 시퀀스

잉크 인식기를 만들기 위해 구현해야 하는 메서드는 잉크 사용 애플리케이션이 아닌 태블릿 PC 플랫폼 API에서 호출됩니다.

다음 단계는 이러한 메서드의 구현에 대한 일반적인 호출 시퀀스를 나타냅니다.

  1. DLL이 로드됩니다.
  2. HRECOGNIZER 핸들이 만들어집니다.
  3. HRECOCONTEXT 핸들이 만들어집니다.
  4. 이 컨텍스트에 대해 인식기 옵션 및 모드가 설정됩니다.
  5. 스트로크는 잉크 데이터에 추가됩니다.
  6. 입력이 종료되었습니다.
  7. 잉크가 인식됩니다.
  8. 인식 결과가 반환됩니다.
  9. HRECOCONTEXT 핸들이 제거됩니다.
  10. HRECOGNIZER 핸들이 제거됩니다.

호출 시퀀스는 다음 코드 개요에도 설명되어 있습니다.

CreateRecognizer(CLSID, &hrec);
while (more pieces of ink to recognize ... )
{
  // Create a context, once per piece of ink to be recognized
  hrc = CreateContext(hrec, &hrc);

  // Functions to set up options and modes for this context
  SetGuide(hrc, pGuide, 0);
  SetFactoid(hrc, 5, PHONE); // only if in application with forms
  SetFlags(hrc, RECOFLAG_WORDMODE); // rare, only if wanting word mode, no out-of-dictionary, or single segmentation
  SetWordList(hrc, hwl);

  // Adding all the strokes in this piece of ink
  while (more strokes ... )
  {
    AddStroke(hrc, NULL, 800, pPacket, pXForm);  // one call per stroke
  }
  EndInkInput(hrc);

  // This gets the ink recognized
  Process(hrc);

  // If this is a simple application, it calls this for a simple answer
  GetBestResultString(hrc, length, buffer);

  // If this is a complex application, it calls this for a complete answer
  GetLatticePtr(hrc, &pLattice);

  // Destroy the context
  DestroyContext(hrc);
}
// Called just before the application shuts down
DestroyRecognizer(hrec);

Recognizer API

인식 API 아키텍처