Exemple #1
0
        public RecognitionCandidate(tagRecognitionCandidate rc)
        {
            Start = rc.Start;
            End   = rc.End;

            Score = new double[rc.Score.Length];
            rc.Score.CopyTo(Score, 0);
            Code = new ushort[rc.Code.Length];
            rc.Code.CopyTo(Code, 0);

            Encoding sjisEnc = Encoding.GetEncoding("Shift_JIS");

            Result = sjisEnc.GetString(rc.Result);
            Result = Result.Substring(0, Result.Length - 1);
            Bounds = new Rectangle(rc.BoundsLeft, rc.BoundsTop,
                                   rc.BoundsRight - rc.BoundsLeft, rc.BoundsBottom - rc.BoundsTop);
        }
Exemple #2
0
        static public RecognitionCandidate[] GetRecognitionResult()
        {
            IntPtr resultP = HandsInkGetRecognitionResult();
            tagRecognitionResult result =
                (tagRecognitionResult)Marshal.PtrToStructure(resultP, typeof(tagRecognitionResult));

            RecognitionCandidate[] candArray = new RecognitionCandidate[result.Count];
            IntPtr candP = result.Candidate;

            for (int i = 0; i < result.Count; i++)
            {
                tagRecognitionCandidate rc = (tagRecognitionCandidate)Marshal.PtrToStructure(
                    candP, typeof(tagRecognitionCandidate));

                candArray[i] = new RecognitionCandidate(rc);
                candP        = (IntPtr)((int)candP + Marshal.SizeOf(rc));
            }

            return(candArray);
        }