Ink Object API
Summary
잉크 오브젝트를 생성하고 관리하는 API로 구성되어 있습니다.
잉크 오브젝트는 인식엔진에서 인식할 터치 좌표(잉크 좌표)값을 저장하고 관리하는 용도로 사용합니다.
AddPoint()로 필기 좌표 값을 입력하고, Touch Up 시점에서는 EndStroke()를 호출하여 하나의 획이 끝난 것을 인식엔진에 알려줘야 합니다.
Ink Object API는 일반적으로 다음과 같은 순서로 호출하게 됩니다.
- 잉크 오브젝트 생성 :
CreateInkObject() - 잉크 오브젝트 초기화 :
InkClear() - 좌표 값을 잉크 오브젝트에 추가 :
AddPoint(), AddPoint(),... EndStroke(), AddPoint(),... EndStroke(), AddPoint(),... EndStroke() - 잉크 오브젝트에 저장된 좌표 값을 인식 :
Recognize() - 잉크 오브젝트 제거 :
DestroyInkObject()
Typedefs
// 잉크 오브젝트 handle
typedef const void * DHWRInkObject
Functions List
// 잉크 오브젝트를 생성함
DHWRInkObject DHWRCreateInkObject(void)
// 잉크 오브젝트를 제거함
void DHWRDestroyInkObject(DHWRInkObject ink)
// 인식엔진에서 인식할 터치 좌표(잉크 좌표)를 추가함
unsigned long DHWRAddPoint(DHWRInkObject ink, const int x, const int y)
// 한 획의 입력이 끝났음 (TouchUp 이벤트에 의해 한 획의 입력을 마쳤을 때 호출)
unsigned long DHWREndStroke(DHWRInkObject ink)
// 입력한 좌표 데이터를 초기화함
unsigned long DHWRInkClear(DHWRInkObject ink)
// 입력된 잉크 인덱스 값에 해당하는 잉크 좌표값을 받아옴
unsigned long DHWRGetInkPoint(DHWRInkObject ink, const int index, int *x, int *y)
// 현재까지 입력된 잉크의 개수를 받아옴
unsigned long DHWRGetInkCount(DHWRInkObject ink, int *count)
DHWRCreateInkObject
DHWRDestroyInkObject
DHWRAddPoint
인식엔진에서 인식할 터치 좌표(잉크 좌표)를 잉크오브젝트에 추가함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
좌표가 추가될 잉크 오브젝트 | DHWRInkObject |
| [in] | x |
x 좌표 | const int |
| [in] | y |
y 좌표 | const int |
Returns
Example
DHWRInkObject ink_obj = NULL;
ink_obj = DHWRCreateInkObject();
DHWRAddPoint(ink_obj, 10, 12);
DHWRAddPoint(ink_obj, 10, 14);
DHWREndStroke
한 획의 입력이 끝났음
TouchUp 이벤트에 의해 한 획의 입력을 마쳤을 때 호출
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트 | DHWRInkObject |
Returns
DHWRInkClear
입력한 좌표 데이터를 초기화함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
좌표 데이터를 초기화 할 잉크 오브젝트 | DHWRInkObject |
Returns
DHWRGetInkPoint
입력된 잉크 인덱스 값에 해당하는 잉크 좌표값을 받아옴
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트 | DHWRInkObject |
| [in] | index |
잉크의 인덱스 | const int |
| [out] | x |
잉크의 x 좌표 값 | int * |
| [out] | y |
잉크의 y 좌표 값 | int * |
Returns
DHWRGetInkCount
현재까지 입력된 잉크 좌표 값의 개수를 반환함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트 | DHWRInkObject |
| [out] | count |
잉크 좌표 값의 개수 | int * |
Returns
Functions List
// 잉크 오브젝트를 생성함
public static extern IntPtr CreateInkObject()
// 잉크 오브젝트를 제거함
public static extern void DestroyInkObject(IntPtr ink)
// 인식엔진에서 인식할 터치 좌표(잉크 좌표)를 추가함
public static extern int AddPoint(IntPtr ink, int x, int y)
// 한 획의 입력이 끝났음 (TouchUp 이벤트에 의해 한 획의 입력을 마쳤을 때 호출)
public static extern int EndStroke(IntPtr ink)
// 입력한 좌표 데이터를 초기화함
public static extern int InkClear(IntPtr ink)
// 입력된 잉크 인덱스 값에 해당하는 잉크 좌표값을 받아옴
public static extern int GetInkPoint(IntPtr ink, int index, [In, Out] ref int x, [In, Out] ref int y)
// 현재까지 입력된 잉크의 개수를 받아옴
public static extern int GetInkCount(IntPtr ink, [In, Out] ref int count)
CreateInkObjectstatic
잉크 오브젝트를 생성함
Returns
IntPtr (잉크 오브젝트 포인터)
DestroyInkObjectstatic
잉크 오브젝트를 제거함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
제거할 잉크 오브젝트 | IntPtr |
AddPointstatic
인식엔진에서 인식할 터치 좌표(잉크 좌표)를 잉크오브젝트에 추가함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
좌표가 추가될 잉크 오브젝트 | IntPtr |
| [in] | x |
x 좌표 | int |
| [in] | y |
y 좌표 | int |
Returns
Example
IntPtr inkObj = IntPtr.Zero;
inkObj = Hwr.CreateInkObject();
Hwr.AddPoint(inkObj, 10, 12);
Hwr.AddPoint(inkObj, 10, 14);
EndStrokestatic
한 획의 입력이 끝났음
TouchUp 이벤트에 의해 한 획의 입력을 마쳤을 때 호출
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트 | IntPtr |
Returns
InkClearstatic
입력한 좌표 데이터를 초기화함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
좌표 데이터를 초기화 할 잉크 오브젝트 | IntPtr |
Returns
GetInkPointstatic
입력된 잉크 인덱스 값에 해당하는 잉크 좌표값을 받아옴
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트 | IntPtr |
| [in] | index |
잉크의 인덱스 | int |
| [out] | x |
잉크의 x 좌표 값 | ref int |
| [out] | y |
잉크의 y 좌표 값 | ref int |
Returns
GetInkCountstatic
현재까지 입력된 잉크 좌표 값의 개수를 반환함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트 | IntPtr |
| [out] | count |
잉크 좌표 값의 개수 | ref int |
Returns
Classes
public static class Point {
public int x = 0;
public int y = 0;
}
public static class Ink {
public Ink() {
mId = CreateInkObject();
}
public Ink(long id) {
mId = id;
}
@Override
protected void finalize() throws Throwable {
DHWR.DestroyInkObject(mId);
super.finalize();
}
public boolean AddPoint(int x, int y) {
return DHWR.AddPoint(mId, x, y);
}
public boolean EndStroke() {
return DHWR.EndStroke(mId);
}
public void Clear() {
DHWR.InkClear(mId);
}
public boolean GetPoint(int index, Point point) {
return DHWR.GetInkPoint(mId, index, point);
}
public int GetSize() {
return DHWR.GetInkCount(mId);
}
public long GetHandle() {
return mId;
}
private long mId;
}
Pointclassstatic
(x, y) 좌표 공간에서의 위치를 나타내는 점을 정의한 클래스
필기 입력한 좌표 값을 지정하기 위해 사용
Attributes
| Name | Description | Type | Access |
|---|---|---|---|
x |
x 좌표 값 | int | public |
y |
y 좌표 값 | int | public |
Inkclassstatic
잉크 오브젝트를 생성하고 관리하는 API를 사용하기 쉽도록 wrapping한 클래스
Attributes
| Name | Description | Type | Access |
|---|---|---|---|
mId |
잉크 오브젝트의 handle | long | private |
Methods
| Name | Description | Returns | Access |
|---|---|---|---|
Ink() |
CreateInkObject()와 동일한 기능 | void | public |
Ink(long id) |
id 값으로 잉크오브젝트의 handle을 초기화 | void | public |
finalize() |
DestroyInkObject()와 동일한 기능 | void | protected |
AddPoint(int x, int y) |
AddPoint()와 동일한 기능 | boolean | public |
EndStroke() |
EndStroke()와 동일한 기능 | boolean | public |
Clear() |
InkClear()와 동일한 기능 | void | public |
GetPoint(int index, Point point) |
GetInkPoint()와 동일한 기능 | boolean | public |
GetSize() |
GetInkCount()와 동일한 기능 | int | public |
GetHandle() |
잉크 오브젝트의 handle을 반환 | long | public |
Functions List
// 잉크 오브젝트를 생성함
public final static native long CreateInkObject()
// 잉크 오브젝트를 제거함
public final static native void DestroyInkObject(long ink)
// 인식엔진에서 인식할 터치 좌표(잉크 좌표)를 추가함
public final static native boolean AddPoint(long ink, int x, int y)
// 한 획의 입력이 끝났음 (TouchUp 이벤트에 의해 한 획의 입력을 마쳤을 때 호출)
public final static native boolean EndStroke(long ink)
// 입력한 좌표 데이터를 초기화함
public final static native void InkClear(long ink)
// 입력된 잉크 인덱스 값에 해당하는 잉크 좌표값을 받아옴
public final static native boolean GetInkPoint(long ink, int index, Point point)
// 현재까지 입력된 잉크의 개수를 받아옴
public final static native int GetInkCount(long ink)
CreateInkObjectstatic
잉크 오브젝트를 생성함
Returns
long (잉크 오브젝트의 handle)
DestroyInkObjectstatic
잉크 오브젝트를 제거함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
제거할 잉크 오브젝트의 handle | long |
AddPointstatic
인식엔진에서 인식할 터치 좌표(잉크 좌표)를 잉크오브젝트에 추가함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
좌표가 추가될 잉크 오브젝트의 handle | long |
| [in] | x |
x 좌표 | int |
| [in] | y |
y 좌표 | int |
Returns
터치 좌표가 성공적으로 추가되면 true, 아니면 false를 반환한다
Example
long inkObj = DHWR.CreateInkObject();
DHWR.AddPoint(inkObj, 10, 12);
DHWR.AddPoint(inkObj, 10, 14);
EndStrokestatic
한 획의 입력이 끝났음
TouchUp 이벤트에 의해 한 획의 입력을 마쳤을 때 호출
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트의 handle | long |
Returns
한 획의 입력이 성공적으로 마쳤으면 true, 아니면 false를 반환한다
InkClearstatic
입력한 좌표 데이터를 초기화함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
좌표 데이터를 초기화 할 잉크 오브젝트의 handle | long |
GetInkPointstatic
입력된 잉크 인덱스 값에 해당하는 잉크 좌표값을 받아옴
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트의 handle | long |
| [in] | index |
잉크의 인덱스 | int |
| [out] | point |
잉크의 (x, y) 좌표 값 | Point |
Returns
좌표값을 성공적으로 받아오면 true, 아니면 false를 반환한다
GetInkCountstatic
현재까지 입력된 잉크 좌표 값의 개수를 반환함
Parameters
| # | Name | Description | Type |
|---|---|---|---|
| [in] | ink |
잉크 오브젝트의 handle | long |
Returns
잉크 좌표 값의 개수