Home > Software engineering >  The Chinese character coordinates
The Chinese character coordinates

Time:09-27

How to extract a Chinese character relative coordinates of each stroke starting point? Urgent genuflect is begged

CodePudding user response:

The
reference
relative coordinates

Tell me about my experience:
If work demand, the original poster can query the relevant patent of and , and to do further work,
If is to learn, also can get some inspiration,

CodePudding user response:

Fyi:
 # pragma comment (lib, "user32") 
# pragma comment (lib, "gdi32")
#include
#include
#include
Char ch [3].
Would be uc [2];
Int I, UN=0, n.
HFONT HFONT ohfont;
LRESULT a CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM) {
PAINTSTRUCT ps;
HDC HDC.
The RECT r;
COLORREF oc;
Int iNumPts;
LPPOINT lpPoints;//Path data points
LPBYTE lpTypes;//Path data types
HPEN hOldPen;

The switch (the message) {
Case WM_CLOSE:
The PostQuitMessage (0);
break;
Case WM_KEYUP:
If (wParam==VK_ESCAPE | | wParam==VK_SPACE) PostQuitMessage (0);
break;
In case the WM_PAINT:
BeginPaint (hWnd, & amp; Ps);
HDC=ps. HDC;//the device context to the draw in
GetClientRect (hWnd, & amp; R);//Obtain the window 's client rectangle
Ohfont=(HFONT) SelectObject (HDC, HFONT);
Oc=SetTextColor (HDC, 0 x00ffffff);
SetBkMode (HDC, TRANSPARENT);
BeginPath (HDC);
If (un> 0) TextOutW (HDC, r.l eft + 100, r.t op + 100, uc, UN);
The else TextOut (HDC, r.l eft + 100, r.t op + 100, ch, strlen (ch));
EndPath (HDC);
//FlattenPath (HDC);//will all the Bezier curve segment is converted to linear segment
INumPts=GetPath (HDC, NULL, NULL, 0).
LpPoints=(GlobalAlloc LPPOINT) (GPTR, sizeof (POINT) * iNumPts);
LpTypes=(GlobalAlloc LPBYTE) (GPTR iNumPts);
INumPts=GetPath (HDC, lpPoints lpTypes, iNumPts);
HOldPen=(HPEN) SelectObject (HDC, CreatePen (PS_SOLID, 0, RGB (0,0,255)));

StrokePath (HDC);
//for (I=0; i//the switch (lpTypes [I]) {
//case PT_MOVETO:
//MoveToEx (HDC, lpPoints [I] x, lpPoints [I] y, NULL);
//break;
//
//case PT_LINETO | PT_CLOSEFIGURE:
//case PT_LINETO:
//LineTo (HDC, lpPoints [I] x, lpPoints [I] y);
//break;
//
//case PT_BEZIERTO | PT_CLOSEFIGURE:
//case PT_BEZIERTO:
//PolyBezierTo (HDC, & amp; LpPoints [I], 3);
//I +=2;
//break;
//}
//}

for (i=0; iThe switch (lpTypes [I]) {
Case PT_MOVETO:
SetPixel (HDC, lpPoints [I] x, lpPoints [I] y, RGB (255,0,255));
break;
Case PT_LINETO | PT_CLOSEFIGURE:
Case PT_LINETO:
SetPixel (HDC, lpPoints [I] x, lpPoints [I] y, RGB (255255255));
break;
Case PT_BEZIERTO | PT_CLOSEFIGURE:
Case PT_BEZIERTO:
SetPixel (HDC, lpPoints [I] x, lpPoints [I] y, RGB (255, 0, 0));
SetPixel (HDC, lpPoints [I + 1] x, lpPoints [I + 1] y, RGB (0255, 0));
SetPixel (HDC, lpPoints [I + 2] x, lpPoints [I + 2] y, RGB (255255, 0));
I +=2;
break;
}
}
DeleteObject (SelectObject (HDC, hOldPen));
GlobalFree (lpPoints);
GlobalFree (lpTypes);
SelectObject (HDC, ohfont);
SetTextColor (HDC, oc);
EndPaint (hWnd, & amp; Ps);
break;
Default:
Return DefWindowProc (hWnd, message, wParam, lParam);
}
return 0;
}
Int WINAPI WinMain (HINSTANCE HINSTANCE, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
MSG MSG={0};
WNDCLASS wc={0};
HBRUSH HBRH;
DWORD charset=1;
HBRH=CreateSolidBrush (0 x00000000);
Wc. LpfnWndProc=WndProc;
The wc. The hInstance=hInstance;
Wc. HbrBackground=HBRH;
Wc. LpszClassName="minwindowsapp";
Wc. HCursor=LoadCursor (NULL, IDC_ARROW);

If (lpCmdLine [0]==0) {
HELP:
DeleteObject (HBRH);
MessageBox (NULL, "FontPath words | | 0 0 XXX XXXXX | \ \ uXXXX | \ \ uXXXX \ \ uXXXX [charset] font name \ n \ n"
"ANSI_CHARSET 0 \ n
""DEFAULT_CHARSET 1 \ n
""SYMBOL_CHARSET 2 \ n
""SHIFTJIS_CHARSET 128 \ n"
"HANGEUL_CHARSET 129 \ n"
"GB2312_CHARSET 134 \ n"
"CHINESEBIG5_CHARSET 136 \ n"
"OEM_CHARSET 255 \ n"
"JOHAB_CHARSET 130 \ n"
"HEBREW_CHARSET 177 \ n"
"ARABIC_CHARSET 178 \ n"
"GREEK_CHARSET 161 \ n"
"TURKISH_CHARSET 162 \ n"
"VIETNAMESE_CHARSET 163 \ n"
"THAI_CHARSET 222 \ n"
"EASTEUROPE_CHARSET 238 \ n"
"RUSSIAN_CHARSET 204 \ n"
"MAC_CHARSET 77 \ n"
"BALTIC_CHARSET 186
", "FontPath", MB_OK);
return 4;
}

Uc [0]=0; Uc [1]=0;
If (==2 sscanf (lpCmdLine, \ \ "u % hx \ \ u % hx % n", & amp; Uc [0], & amp; Uc [1], & amp; I)) {
UN=2;
} else if (1==sscanf (lpCmdLine, \ \ "u % hx % n", & amp; Uc [0], & amp; I)) {
UN=1; Ch [0]=' '; Ch [1]=0;
} else if (1==sscanf (lpCmdLine, 0 x % hx % n, ch, & amp; I)) {
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related