1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - PRC - include
3   File:     prc/types.h
4 
5   Copyright 2003-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_PRC_TYPES_H_
19 #define NITRO_PRC_TYPES_H_
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include <nitro/misc.h>
26 #include <nitro/types.h>
27 #include <nitro/fx/fx.h>
28 
29 /*===========================================================================*
30   Constant Definitions
31  *===========================================================================*/
32 
33 //--- Value of indicator that shows the stylus was lifted
34 #define PRC_PEN_UP_MARKER_X (-1)
35 #define PRC_PEN_UP_MARKER_Y (-1)
36 
37 //--- Code showing not recognized or not recognizable
38 #define PRC_CODE_UNKNOWN (-1)
39 
40 //--- Value of kindMask that expresses all types
41 #define PRC_KIND_ALL      (0xffffffffU)
42 
43 //--- Watchdog coordinate value that is sufficiently big/small
44 #define PRC_LARGE_ENOUGH_X (512)
45 #define PRC_SMALL_ENOUGH_X (-512)
46 #define PRC_LARGE_ENOUGH_Y (512)
47 #define PRC_SMALL_ENOUGH_Y (-512)
48 
49 //--- Small value with fx32 value (avoid division by 0)
50 #define PRC_TINY_LENGTH (1)
51 
52 /*===========================================================================*
53   Type Definitions
54  *===========================================================================*/
55 
56 /*---------------------------------------------------------------------------*
57   Two-Dimensional Coordinate
58  *---------------------------------------------------------------------------*/
59 typedef struct PRCPoint
60 {
61     s16     x;
62     s16     y;
63 }
64 PRCPoint;
65 
66 /*---------------------------------------------------------------------------*
67   Bounding box
68  *---------------------------------------------------------------------------*/
69 typedef struct PRCBoundingBox
70 {
71     s16     x1, y1;                    // Upper-left coordinate of bounding box
72     s16     x2, y2;                    // Lower-right coordinate of bounding box
73 }
74 PRCBoundingBox;
75 
76 /*---------------------------------------------------------------------------*
77   Combination of Strokes
78   MUST always be terminated with PenUpMarker
79  *---------------------------------------------------------------------------*/
80 typedef struct PRCStrokes
81 {
82     PRCPoint *points;
83     int     size;
84     u32     capacity;
85 }
86 PRCStrokes;
87 
88 /*---------------------------------------------------------------------------*
89   Recognition Pattern
90  *---------------------------------------------------------------------------*/
91 typedef struct PRCPrototypeEntry
92 {
93     BOOL    enabled;
94     u32     kind;
95     u16     code;
96     fx16    correction;
97     void   *data;
98     int     pointIndex;
99     u16     pointCount;
100     u16     strokeCount;
101 }
102 PRCPrototypeEntry;
103 
104 /*---------------------------------------------------------------------------*
105   Source Data for Sample DB
106  *---------------------------------------------------------------------------*/
107 typedef struct PRCPrototypeList
108 {
109     const PRCPrototypeEntry *entries;
110     int     entrySize;
111     const PRCPoint *pointArray;
112     int     pointArraySize;
113 
114     union
115     {
116         int     normalizeSize;         // Normalize size of coordinate values in the sample DB
117         int     regularizeSize;        // Old name
118     };
119 }
120 PRCPrototypeList;
121 
122 /*---------------------------------------------------------------------------*
123   Resampling method
124  *---------------------------------------------------------------------------*/
125 typedef enum PRCResampleMethod
126 {
127     PRC_RESAMPLE_METHOD_NONE = 0,
128     PRC_RESAMPLE_METHOD_DISTANCE,
129     PRC_RESAMPLE_METHOD_ANGLE,
130     PRC_RESAMPLE_METHOD_RECURSIVE,
131     PRC_RESAMPLE_METHOD_USER = 256
132 }
133 PRCResampleMethod;
134 
135 
136 #ifdef __cplusplus
137 } /* extern "C" */
138 #endif
139 
140 /* NITRO_PRC_TYPES_H_ */
141 #endif
142