Handwriting drawing method and device, equipment and storage medium
By smoothing the pen strokes on the touchscreen and calculating the pressure sensitivity of the pen strokes, the problem of stiff pen strokes on the touchscreen was solved, and smooth pen strokes with pen stroke effects were achieved, thus improving the user experience.
Patent Information
- Application Number
- CN202211263268.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-14
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2042-10-14
AI Technical Summary
In existing technologies, touchscreen-based handwriting drawing methods result in stiff handwriting that lacks stroke effects, affecting the user's handwriting drawing and viewing experience.
By smoothing the stroke points on the touchscreen, determining the smoothing points corresponding to the inflection points, and connecting the control points, a smooth stroke line is formed. Based on the number of stroke point groups, the stroke point is determined, the stroke pressure sensitivity value is calculated, the stroke effect is simulated, and the target stroke is formed.
It enables users to draw smooth, pen-like strokes on touchscreens, improving the fluency and aesthetics of the strokes and enhancing the user's drawing and viewing experience.
Smart Images

Figure CN115509431B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of touch control, and in particular to a handwriting drawing method and device, equipment and a storage medium. BACKGROUND
[0002] With the development of information technology, handwriting is drawn on a touch screen by using a handwriting pen or a finger in many scenarios, and the drawing effect of handwriting directly affects the user experience. For example, in a classroom teaching scenario, a teacher needs to write on a blackboard on a touch screen, and the writing effect on the touch screen affects the teaching effect of the teacher.
[0003] The handwriting drawing process detects handwriting drawing operations through a touch screen, determines drawing handwriting points, and then draws handwriting on the touch screen based on the drawing handwriting points. However, the handwriting drawn based on the current handwriting drawing method is stiff and has no pen stroke effect, resulting in poor handwriting effect presented on the touch screen, which ultimately affects the handwriting drawing and viewing experience of the user. SUMMARY
[0004] To solve the above technical problems, the present disclosure provides a handwriting drawing method, device, equipment and a storage medium.
[0005] In a first aspect, the present disclosure provides a handwriting drawing method, which comprises:
[0006] In response to a handwriting drawing operation on a touch screen, drawing handwriting points are obtained.
[0007] The inflection points in the drawing handwriting points are smoothed, the inflection points corresponding smooth points are determined, and all the inflection points corresponding smooth points and control points other than the inflection points are connected in drawing order to draw a smooth handwriting line.
[0008] Based on the number of handwriting points on the smooth handwriting line, a pen stroke handwriting point is determined, and based on the pen stroke data corresponding to the pen stroke handwriting point, a pen stroke pressure value of the pen stroke handwriting point is calculated.
[0009] Based on the pen stroke pressure value, a pen stroke is simulated on the smooth handwriting line to form a target handwriting.
[0010] In a second aspect, the present disclosure provides a handwriting drawing device, which comprises:
[0011] A drawing handwriting point obtaining module is configured to obtain drawing handwriting points in response to a handwriting drawing operation on a touch screen.
[0012] a smooth handwriting line drawing module configured to smooth corner points in the drawing handwriting points, determine smooth points corresponding to the corner points, and connect the smooth points corresponding to all the corner points and control points other than the corner points in drawing order to draw a smooth handwriting line;
[0013] a pen tip pressure value calculation module configured to determine a pen tip handwriting point based on a number of groups of handwriting points on the smooth handwriting line, and calculate a pen tip pressure value of the pen tip handwriting point based on pen tip data corresponding to the pen tip handwriting point;
[0014] a target handwriting drawing module configured to simulate a pen tip on the smooth handwriting line based on the pen tip pressure value to form target handwriting.
[0015] In a third aspect, the embodiments of the present disclosure further provide a handwriting drawing device, which comprises:
[0016] a processor;
[0017] a memory configured to store executable instructions;
[0018] The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the method provided in the first aspect.
[0019] In a fourth aspect, the embodiments of the present disclosure further provide a computer readable storage medium having a computer program stored thereon, wherein the storage medium stores the computer program, and when the computer program is executed by a processor, the processor implements the method provided in the first aspect.
[0020] Compared with the prior art, the technical solutions provided by the embodiments of the present disclosure have the following advantages:
[0021] The handwriting drawing method, device, equipment and storage medium provided by the embodiments of the present disclosure, in response to a handwriting drawing operation on a touch screen, obtain drawing handwriting points, smooth corner points in the drawing handwriting points, determine smooth points corresponding to the corner points, and connect the smooth points corresponding to all the corner points and control points other than the corner points in drawing order to draw a smooth handwriting line, determine a pen tip handwriting point based on a number of groups of handwriting points on the smooth handwriting line, calculate a pen tip pressure value of the pen tip handwriting point based on pen tip data corresponding to the pen tip handwriting point, simulate a pen tip on the smooth handwriting line based on the pen tip pressure value to form target handwriting. Thus, handwriting that is smooth and has a pen tip effect can be drawn, the smoothness and beauty of handwriting presented on the touch screen are improved, and the handwriting drawing and viewing experience of a user is ultimately improved. BRIEF DESCRIPTION OF DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure together with the specification.
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, those skilled in the art can further obtain other drawings according to these drawings without any creative effort.
[0024] Figure 1 A flowchart of a handwriting drawing method provided by an embodiment of the present disclosure;
[0025] Figure 2 A schematic diagram of three non-collinear handwriting points provided by an embodiment of the present disclosure;
[0026] Figures 3-5 Schematic diagrams of determining a smooth point corresponding to an inflection point, respectively provided by embodiments of the present disclosure;
[0027] Figure 6 A logic schematic diagram of calculating a pen pressure value provided by an embodiment of the present disclosure;
[0028] Figure 7 A thread schematic diagram of multiple threads provided by an embodiment of the present disclosure;
[0029] Figure 8 A structural schematic diagram of a handwriting drawing device provided by an embodiment of the present disclosure;
[0030] Figure 9 A structural schematic diagram of a handwriting drawing device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] Embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms, and should not be interpreted as being limited to the embodiments set forth herein, but rather, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only, and are not intended to limit the scope of protection of the present disclosure.
[0032] It should be understood that each step described in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present disclosure is not limited in this respect.
[0033] The term "include" and variations thereof, as used in this document, is used expansively and means "including, but not limited to". The term "based on" is not limited to a direct relationship. The term "one embodiment" means "at least one embodiment". The term "another embodiment" means "at least one additional embodiment". The term "some embodiments" means "at least some embodiments". Related definitions are given throughout the detailed description. It is noted that the concepts mentioned in the present disclosure are illustrative and not restrictive, and those skilled in the art should understand that "one", "multiple" modification is illustrative and not restrictive, and unless otherwise explicitly stated in the context, it should be understood as "one or more".
[0034] It should be noted that the "one", "multiple" modification mentioned in the present disclosure is illustrative and not restrictive, and those skilled in the art should understand that "one" or "multiple" modification is illustrative and not restrictive, and unless otherwise explicitly stated in the context, it should be understood as "one or more".
[0035] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.
[0036] The following will be described in conjunction with Figures 1-7 The handwriting drawing method provided by the embodiments of the present disclosure will be described. In the embodiments of the present disclosure, the handwriting drawing method can be executed by an electronic device or a server. The electronic device can include a mobile phone, a tablet computer, a desktop computer, a notebook computer, etc. The server can be a cloud server or a server cluster, etc. It should be noted that the following embodiments are exemplarily explained by taking the electronic device as the execution subject.
[0037] Figure 1 A flowchart of a handwriting drawing method provided by the embodiments of the present disclosure is shown.
[0038] As Figure 1 shown, the handwriting drawing method can include the following steps.
[0039] S110, in response to the handwriting drawing operation on the touch screen, obtaining the drawing handwriting points.
[0040] In actual application, in a teaching scene such as a classroom, when a user wants to draw handwriting such as formula, picture, text, dynamic picture, etc., the user sends handwriting drawing operation to the touch screen, and the electronic device where the touch screen is located can obtain the drawing handwriting points in response to the operation through the pen thread.
[0041] In the embodiments of the present disclosure, the handwriting drawing process can be re-encapsulated based on WPF (Windows Presentation Foundation, a UI framework for creating desktop client applications) InkCanvas (for defining an area for receiving and displaying handwriting), and the encapsulation process can be implemented through multiple threads.
[0042] In the embodiments of the present disclosure, the touch screen can be a hard screen that can only detect the handwriting points corresponding to the handwriting drawing operation and cannot directly perform pressure sensing detection on the handwriting drawing operation.
[0043] In the embodiments of the present disclosure, the drawing handwriting points can be understood as the contact points of the finger or the touch pen and the touch screen, which are discrete points for drawing handwriting.
[0044] S120, smoothing the inflection points in the drawing handwriting points, determining the smooth points corresponding to the inflection points, and connecting all the smooth points corresponding to the inflection points and the control points other than the inflection points in the drawing order to draw a smooth handwriting line.
[0045] In actual application, the electronic device can perform smooth corner calculation on the drawing handwriting points based on the second-order Bezier curve algorithm through the rendering thread, so that the inflection points in the drawing handwriting points are smoothed, the smooth points corresponding to the inflection points are determined, and all the smooth points corresponding to the inflection points and the control points other than the inflection points are connected in the drawing order to draw a smooth handwriting line.
[0046] In the embodiments of the present disclosure, the drawing order is determined according to the time when the drawing handwriting points are drawn on the touch screen.
[0047] In the embodiments of the present disclosure, the inflection points refer to each drawing handwriting point or part of the drawing handwriting points. The control points refer to two drawing handwriting points adjacent to the inflection points, and the control points and the inflection points are not collinear.
[0048] In the embodiments of the present disclosure, the smooth handwriting line refers to a handwriting line with less stiffness, that is, a handwriting line with higher smoothness.
[0049] In order to facilitate understanding, Figure 2 A schematic diagram of three non-collinear drawing handwriting points is shown, wherein A is a first control point, B is an inflection point, and C is a second control point. Specifically, A, B, and C can be connected to form an initial handwriting line, B can be smoothed to find a smooth point B' corresponding to B, and then A, B', and C can be connected to draw a smooth trajectory line.
[0050] Specifically, S120 can include the following steps:
[0051] S1201, starting from the first group of three non-adjacent drawing pen points, for the current group of three non-adjacent drawing pen points, the following operations are performed:
[0052] Based on the inflection point in the current group of three non-adjacent drawing pen points and the two control points other than the inflection point, the smooth point corresponding to the inflection point is determined, and the above operation is repeated until the current group of three non-adjacent drawing pen points is the last group of three non-adjacent drawing pen points, and the above operation is ended, and all the smooth points corresponding to the inflection points are obtained.
[0053] Among them, the two control points refer to the starting pen point and the ending pen point in the three non-collinear pen points.
[0054] Specifically, for S1201, find the first target point on the first connecting line between the first control point and the inflection point through the rendering thread; calculate the first ratio according to the first distance between the first target point and the first control point, the second distance between the first control point and the inflection point; find the second target point on the second connecting line between the second control point and the inflection point based on the first ratio, wherein the third distance between the second target point and the inflection point and the fourth distance between the second control point and the inflection point form a second ratio equal to the first ratio; connect the first target point and the second target point to obtain the third connecting line; find the smooth point corresponding to the inflection point on the third connecting line based on the first ratio or the second ratio, wherein the fifth distance between the first target point and the smooth point and the sixth distance between the first target point and the second target point form a third ratio equal to the first ratio or the second ratio. It should be noted that for other three non-collinear pen points, the smooth point corresponding to the inflection point can also be found based on the above principle until all the smooth points are found.
[0055] For easy understanding, see Figures 3-5 , the first control point A and the inflection point B form the first connecting line AB, find any point on the first connecting line AB as the first target point D, calculate the first distance L1 between the first target point D and the first control point A, calculate the second distance L2 between the first control point A and the inflection point B, and calculate the first ratio K1 according to L1 and L2; find the second target point E on the second connecting line BC between the second control point C and the inflection point B according to the first ratio K1, wherein the third distance L3 between the second target point E and the inflection point B and the fourth distance L4 between the second control point C and the inflection point B form the second ratio K2 equal to the first ratio K2; connect the first target point D and the second target point E to obtain the third connecting line DE; find the smooth point B' corresponding to the inflection point on the third connecting line DE based on the first ratio K1 or the second ratio K2, wherein the fifth distance L5 between the first target point D and the smooth point B' and the sixth distance L5 between the first target point D and the second target point E form the third ratio K3 equal to the first ratio K1 or the second ratio K2.
[0056] Thus, by smoothing the inflection points in the drawing stroke points, the corresponding smooth points of the inflection points in the drawing stroke points are accurately found, and a smooth curve is drawn based on the smooth points corresponding to the inflection points in the drawing stroke points and the control points other than the inflection points.
[0057] In some cases, the drawing stroke points can also be pre-added with attribute parameters, and the smooth stroke line is drawn based on the drawing stroke points with the added attribute parameters.
[0058] The attribute parameters can be color, thickness, brightness, and the like.
[0059] Thus, during the user drawing process, the inflection points in the drawing stroke points can be smoothed, so that a stroke line with high smoothness is drawn.
[0060] S130, determine the stroke stroke points based on the number of groups of the stroke points on the smooth stroke line, and calculate the stroke pressure value of the stroke stroke points based on the stroke data corresponding to the stroke stroke points.
[0061] In the embodiments of the present disclosure, the smooth stroke line includes a plurality of stroke points, and the electronic device can divide the plurality of stroke points into a plurality of groups through a presentation thread, and determine the stroke stroke points according to the number of groups of the stroke points. For example, if the smooth stroke line is relatively short, the number of groups of the stroke points is small, and all the stroke points on the smooth stroke line can be used as the stroke stroke points; for another example, if the smooth stroke line is relatively long, the number of groups of the stroke points is large, and part of the stroke points on the smooth stroke line can be selected as the stroke stroke points.
[0062] Optionally, the number of stroke points in each group can be equal or not equal.
[0063] In the embodiments of the present disclosure, the stroke data of the stroke stroke points refers to the actual drawing parameters of the stroke stroke points. Optionally, the stroke data of the stroke stroke points can include the number of stroke points, the number of serial numbers of the stroke stroke points, the drawing speed of the stroke stroke points, and the distance between adjacent stroke stroke points, and the like.
[0064] In some embodiments, the stroke pressure value of the stroke stroke points can be calculated based on the number of stroke points and the number of serial numbers of the stroke stroke points.
[0065] In some other embodiments, the stroke pressure value of the stroke stroke points can be calculated based on the drawing speed of the stroke stroke points and the distance between adjacent stroke stroke points.
[0066] Thus, the stroke stroke points can be determined based on the number of groups of the stroke points, and then the stroke pressure value can be accurately calculated according to the stroke data of the stroke stroke points, so as to facilitate subsequent simulation of the stroke effect based on the stroke pressure value.
[0067] S140, simulate the pen shadow on the smoothed stroke line based on the pen shadow pressure value, and form the target stroke.
[0068] It can be understood that the pen shadow pressure value can be used to represent the drawing strength of the pen shadow point, and the pen shadow can be simulated on the smoothed stroke line based on the pen shadow point, so as to draw the target stroke with the pen shadow effect.
[0069] In the embodiments of the present disclosure, the target stroke refers to a stroke line with high smoothing degree and pen shadow effect.
[0070] The embodiments of the present disclosure provide a stroke drawing method, in response to a stroke drawing operation on a touch screen, drawing stroke points are obtained, inflection points in the drawing stroke points are smoothed, smoothed points corresponding to the inflection points are determined, and in the drawing order, the smoothed points corresponding to all the inflection points and the control points except the inflection points are connected to draw a smoothed stroke line, pen shadow points are determined based on the number of groups of stroke points on the smoothed stroke line, pen shadow pressure values of the pen shadow points are calculated based on pen shadow data corresponding to the pen shadow points, pen shadows are simulated on the smoothed stroke line based on the pen shadow pressure values, and a target stroke is formed. Thus, the stroke with high smoothing degree and pen shadow effect can be drawn, the smoothness and beauty of the stroke presented on the touch screen are improved, and the stroke drawing and viewing experience of the user is ultimately improved.
[0071] In another embodiment of the present disclosure, the pen shadow pressure value of the pen shadow point is determined in different ways.
[0072] In the embodiments of the present disclosure, optionally, the step of "determining the pen shadow point based on the number of groups of stroke points on the smoothed stroke line" in S130 can specifically include the following steps:
[0073] S1301, determining whether the number of groups of stroke points is less than a preset group number threshold value;
[0074] S1302, if the number of groups of stroke points is less than the preset group number threshold value, determining the pen shadow point as all the stroke points corresponding to the number of groups of stroke points;
[0075] S1303, if the number of groups of stroke points is greater than or equal to the preset group number threshold value, determining the pen shadow point as the stroke point corresponding to the preset group number threshold value in the reverse order.
[0076] The number of groups of stroke points refers to the grouping number of stroke points on the smoothed stroke line.
[0077] The preset group number threshold value can be a grouping number determined by the user in advance to form the target stroke in different ways. Optionally, the preset group number threshold value can be 8 or other numerical values.
[0078] The preset group number threshold corresponds to the handwriting point, which refers to the handwriting point corresponding to the rear group number threshold.
[0079] Specifically, the stroke handwriting point can be determined based on the group number of the handwriting point and the preset group number threshold by a rendering thread. The rendering thread refers to a thread in the electronic device for drawing handwriting and dynamically rendering the handwriting.
[0080] It can be understood that, taking the preset group number threshold of 8 and the group number of the handwriting point of 6 as an example, the rendering thread can determine that the group number of the handwriting point is less than 8, and then the rendering thread takes all the handwriting points in the 6 groups as the stroke handwriting point; in other cases, taking the preset group number threshold of 8 and the group number of the handwriting point of 20 as an example, the rendering thread can determine that the group number of the handwriting point is greater than 8, and then the rendering thread takes the last 8 groups of handwriting points as the stroke handwriting point.
[0081] Therefore, based on the size of the group number of the handwriting point and the preset group number threshold, all groups of handwriting points can be selected as the stroke handwriting point, or part of the groups of handwriting points can be selected as the stroke handwriting point.
[0082] In some embodiments, optionally, the step of “calculating the stroke pressure value of the stroke handwriting point based on the stroke data corresponding to the stroke handwriting point” in S130 can specifically include the following steps:
[0083] Obtaining a reference pressure value of the touch screen;
[0084] Calculating the product of the number of stroke handwriting points in the handwriting data and the serial number of each stroke handwriting point;
[0085] Dividing the reference pressure value by the product to obtain the stroke pressure value of each stroke handwriting point.
[0086] The reference pressure value refers to a standard pressure value of the touch screen determined by a person in advance. Optionally, the reference pressure value can be 0.5, or other numerical values.
[0087] The serial number of the stroke handwriting point refers to the label number of the stroke handwriting point. For example, if the number of stroke handwriting points is 16, the serial number of the serial number of the stroke handwriting point is 1-16.
[0088] Optionally, the stroke pressure value of the stroke handwriting point = reference pressure value / (number of stroke handwriting points * serial number of stroke handwriting point).
[0089] Therefore, with the increase of the serial number, the stroke pressure value corresponding to each stroke handwriting point decreases, so that the user presents the stroke handwriting point with gradually decreasing pressure values.
[0090] In order to facilitate understanding, Figure 6A logic diagram for calculating the pen pressure value is shown. As shown in Figure 6 The number of groups of the handwriting points is first obtained, and it is determined whether the number of groups of the handwriting points is less than 8. If the number of groups of the handwriting points is less than 8, all handwriting points corresponding to the number of groups of the handwriting points are taken as the pen stroke handwriting points. If the number of groups of the smoothed handwriting points is greater than or equal to 8, the pen stroke handwriting points are extracted from the last 8 groups of the handwriting points on the smoothed handwriting line. The pen pressure value of the pen stroke handwriting points is further calculated as the reference pressure value / (number of pen stroke handwriting points*serial number of pen stroke handwriting points).
[0091] Thus, according to the number of groups of the handwriting points on the smoothed handwriting line, the pen stroke reference value of the pen stroke handwriting points is calculated in different ways, so that the pressure value of the pen stroke handwriting points on the smoothed handwriting line is processed in a decreasing manner, and the pen stroke handwriting points with gradually decreasing pressure values are presented to the user.
[0092] In some embodiments, the step of calculating the pen pressure value of the pen stroke handwriting point based on the pen stroke data corresponding to the pen stroke handwriting point in S130 can include the following steps:
[0093] based on the position of each pen stroke handwriting point and the distance between adjacent pen stroke handwriting points in the pen stroke data;
[0094] based on the position of each pen stroke handwriting point and the distance between adjacent pen stroke handwriting points, the drawing speed of each pen stroke handwriting point is calculated;
[0095] According to the drawing speed of each pen stroke handwriting point and the predetermined corresponding relationship between the drawing speed and the pressure value, the pen pressure value of each pen stroke handwriting point is determined.
[0096] wherein the position of each pen stroke handwriting point can be determined according to the coordinates of each pen stroke handwriting point on the touch screen.
[0097] wherein the drawing speed of each pen stroke handwriting point can be calculated based on the position of each pen stroke handwriting point on the smoothed handwriting line, the distance between adjacent pen stroke handwriting points, and the drawing time of adjacent pen stroke handwriting points.
[0098] Specifically, the drawing speed of each pen stroke handwriting point can be determined by the presentation thread, and the pen pressure value of the pen stroke handwriting point can be determined based on the corresponding relationship between the drawing speed and the pressure value.
[0099] It can be understood that since each speed corresponds to a pressure value, the pressure value corresponding to the drawing speed can be found as the pen pressure value of the pen stroke handwriting point.
[0100] In some embodiments, after determining the pen stroke handwriting points based on the number of groups of the handwriting points on the smoothed handwriting line, the method further includes:
[0101] obtaining the pen stroke figure corresponding to the adjacent pen stroke handwriting points;
[0102] The target handwriting is formed by connecting adjacent stroke points with stroke graphs.
[0103] Specifically, the stroke graph corresponding to the adjacent stroke points is obtained from the stroke graphs corresponding to the plurality of stroke points stored in advance, and then the stroke graph corresponding to the adjacent stroke points is placed between the adjacent stroke points to connect the adjacent stroke points and form the target handwriting.
[0104] Thus, the stroke can be simulated on the smooth handwriting line in different ways to form the target handwriting and render.
[0105] Further, after obtaining the target handwriting, the handwriting drawing method further includes a rendering and display process. Specifically, the target handwriting is dynamically rendered and displayed on the touch screen by the rendering thread, and the target handwriting is statically rendered on the touch screen by the UI thread and the rendering thread is notified to delete the target handwriting.
[0106] In order to facilitate understanding of the handwriting drawing and rendering logic, Figure 7 a thread schematic diagram including a plurality of threads is provided to explain Figure 7 the rendering process of the target handwriting line.
[0107] As Figure 7 shown, the plurality of threads includes a pen thread, a rendering thread, and a UI thread. Specifically, first, the pen thread obtains the drawing stroke points and sends the drawing stroke points to the rendering thread and the UI thread; then, the rendering thread dynamically renders and displays the target handwriting on the touch screen, and the UI thread statically renders the target handwriting on the touch screen; further, the UI thread generates a handwriting deletion notification and sends the notification to the rendering thread; finally, the rendering thread deletes the target handwriting based on the notification.
[0108] The handwriting drawing method provided by the present disclosure can be implemented by a handwriting drawing device. The handwriting drawing device can be an electronic device or a server. Figure 8 In the present disclosure, the handwriting drawing device can be an electronic device or a server. The electronic device can include a mobile phone, a tablet computer, a desktop computer, a notebook computer, etc. The server can be a cloud server or a server cluster, etc.
[0109] Figure 8 A structure schematic diagram of a handwriting drawing device provided by an embodiment of the present disclosure is shown.
[0110] As Figure 9 shown, the handwriting drawing device 800 can include:
[0111] The drawing handwriting point acquisition module 810 is configured to acquire drawing handwriting points in response to a handwriting drawing operation on the touch screen.
[0112] The smooth handwriting line drawing module 820 is configured to perform smoothing processing on the inflection points in the drawing handwriting points, determine smooth points corresponding to the inflection points, and connect the smooth points corresponding to all the inflection points and the control points other than the inflection points in the drawing sequence to draw a smooth handwriting line.
[0113] The pen pressure value calculation module 830 is configured to determine a pen handwriting point based on the number of groups of handwriting points on the smooth handwriting line, and calculate a pen pressure value of the pen handwriting point based on pen data corresponding to the pen handwriting point.
[0114] The target handwriting drawing module 840 is configured to simulate a pen on the smooth handwriting line based on the pen pressure value to form target handwriting.
[0115] The handwriting drawing device provided by the embodiments of the present disclosure can draw handwriting that is smooth and has a pen effect, improve the smoothness and beauty of handwriting presented on the touch screen, and ultimately improve the handwriting drawing and viewing experience of the user.
[0116] In some optional embodiments, the smooth handwriting line drawing module 820 is specifically configured to, starting from the first group of three non-adjacent drawing handwriting points, perform the following operations for the current group of three non-adjacent drawing handwriting points:
[0117] determine the smooth point corresponding to the inflection point based on the inflection point and the two control points other than the inflection point in the current group of three non-adjacent drawing handwriting points, repeat the above operations until the current group of three non-adjacent drawing handwriting points is the last group of three non-adjacent drawing handwriting points, and end the above operations to obtain all the smooth points corresponding to the inflection points.
[0118] In some optional embodiments, the pen pressure value calculation module 830 is specifically configured to determine whether the number of groups of handwriting points is less than a preset group number threshold.
[0119] If the number of groups of handwriting points is less than the preset group number threshold, the pen handwriting point is determined to be all handwriting points corresponding to the number of groups of handwriting points.
[0120] If the number of the groups of the handwriting points is greater than or equal to the preset group number threshold, it is determined that the handwriting point corresponding to the preset group number threshold in the reverse order is determined.
[0121] In some optional embodiments, the pen pressure value calculation module 830 is specifically configured to obtain a reference pen pressure value of the touch screen.
[0122] The product of the number of the handwriting points in the handwriting data and the serial number of each handwriting point is calculated.
[0123] The reference pen pressure value is divided by the product to obtain the pen pressure value of each handwriting point.
[0124] In some optional embodiments, the pen pressure value calculation module 830 is specifically configured to calculate the pen pressure value of each handwriting point based on the position of each handwriting point and the distance between adjacent handwriting points.
[0125] The drawing speed of each handwriting point is calculated based on the position of each handwriting point and the distance between adjacent handwriting points.
[0126] The pen pressure value of each handwriting point is determined according to the drawing speed of each handwriting point and a predetermined corresponding relationship between the drawing speed and the pen pressure value.
[0127] In some optional embodiments, the device further includes:
[0128] A pen stroke graph acquisition module is configured to acquire a pen stroke graph corresponding to adjacent handwriting points.
[0129] A target handwriting forming module is configured to connect the adjacent handwriting points by using the pen stroke graph to form the target handwriting.
[0130] In some optional embodiments, the device further includes:
[0131] A rendering module is configured to dynamically render and display the target handwriting on the touch screen by using a presentation thread, and to statically render the target handwriting on the touch screen by using a UI thread and notify the presentation thread to delete the target handwriting.
[0132] It should be noted that, Figure 8 The handwriting drawing device 800 shown can perform Figures 1-7 each step in the method embodiments shown, and achieve Figures 1-7 each process and effect in the method embodiments shown, which will not be described here.
[0133] The exemplary embodiments of the present disclosure further provide an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program capable of being executed by the at least one processor, and the computer program, when executed by the at least one processor, causes the electronic device to perform the method according to the embodiments of the present disclosure.
[0134] The exemplary embodiments of the present disclosure further provide a non-transitory computer readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, causes the computer to perform the method according to the embodiments of the present disclosure.
[0135] The exemplary embodiments of the present disclosure further provide a computer program product comprising a computer program, wherein the computer program, when executed by a processor of a computer, causes the computer to perform the method according to the embodiments of the present disclosure.
[0136] Reference Figure 9 A block diagram of a structure of a handwriting drawing device 900, which can be a server or a client of the present disclosure, will now be described, which is an example of a hardware device that can be applied to aspects of the present disclosure, and the handwriting drawing device 900 can be the electronic device described above. The electronic device is intended to represent a wide range of digital electronic computing devices in various forms, such as a laptop computer, a desktop computer, a workstation, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent a wide range of mobile devices, such as a personal digital processing, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the present disclosure described and / or claimed in this document.
[0137] As shown in FIG. 9, Figure 9 The handwriting drawing device 900 includes a computing unit 901 that can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded into a random access memory (RAM) 904 from a storage unit 908. In the RAM 904, various programs and data required for the operation of the handwriting drawing device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 904 are connected to each other through a bus 1004. An input / output (I / O) interface 905 is also connected to the bus 1004.
[0138] The plurality of components in the handwriting drawing device 900 are connected to the I / O interface 905, including: an input unit 906, an output unit 907, a storage unit 908, and a communication unit 909. The input unit 906 can be any type of device that can input information to the handwriting drawing device 900, and the input unit 906 can receive inputted digital or character information, and generate key signal inputs related to user settings and / or function controls of the electronic device. The output unit 907 can be any type of device that can present information, and can include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1004 can include, but is not limited to, a magnetic disk, an optical disk. The communication unit 909 allows the handwriting drawing device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0139] The computing unit 901 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 901 performs various methods and processes described above. For example, in some embodiments, the handwriting drawing method can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed onto the handwriting drawing device 900 via the ROM 902 and / or the communication unit 909. In some embodiments, the computing unit 901 can be configured to perform the handwriting drawing method by any other appropriate means, such as by means of firmware.
[0140] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0141] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0142] As used in this disclosure, the terms "machine-readable medium" and "computer- readable medium" refer to any computer program product, apparatus and / or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal that can be used to provide machine instructions and / or data to a programmable processor.
[0143] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0144] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0145] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
[0146] It should be noted that, in this document, the terms "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities or operations to be in any specific order or relationship. Also, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by an "comprising" statement is not excluded from a process, method, article, or apparatus that includes the element, even when the same process, method, article, or apparatus includes other identical elements. Notwithstanding substitutions that can qualify as equivalents, what is claimed is solely what is described in the claims.
[0147] The foregoing merely illustrates the principles of the disclosure. Various modifications can be made by those skilled in the art. For example, the described implementations can be implemented in hardware, software, or both using general-purpose or special-purpose processing systems. Preferably, the implementations are implemented in software, where the software includes but is not limited to firmware, resident software, microcode, etc. Furthermore, the foregoing describes certain implementations including particular combinations of elements. It will be apparent to those skilled in the art that other implementations can be developed using any combination of the disclosed elements, and that one or more dependent claims can be asserted based on combinations of the disclosed elements. Accordingly, the disclosure is not to be restricted based on the described implementations but rather only based on the recitations of the claims appended hereto.
Claims
1. A handwriting drawing method characterized by, The method comprises the following steps: In response to a handwriting drawing operation on a touch screen, drawing handwriting points are acquired; Turning points in the drawing handwriting points are smoothed, a smooth point corresponding to the turning point is determined, and a smooth handwriting line is drawn by connecting all the smooth points corresponding to the turning points and control points other than the turning points in drawing order; Based on the number of groups of handwriting points on the smooth handwriting line, a stroke handwriting point is determined, and based on stroke data corresponding to the stroke handwriting point, a stroke pressure value of the stroke handwriting point is calculated; Based on the stroke pressure value, a stroke is simulated on the smooth handwriting line to form a target handwriting. The smoothing of the turning points in the drawing handwriting points and the determination of the smooth points corresponding to the turning points comprise the following steps: Starting from a first group of three non-adjacent drawing handwriting points, for a current group of three non-adjacent drawing handwriting points, the following operations are performed: Based on a turning point in the current group of three non-adjacent drawing handwriting points and two control points other than the turning point, a smooth point corresponding to the turning point is determined, and the above operation is repeated until the current group of three non-adjacent drawing handwriting points is the last group of three non-adjacent drawing handwriting points, and the above operation is ended to obtain all the smooth points corresponding to the turning points.
2. The method of claim 1, wherein, The determination of the stroke handwriting point based on the number of groups of handwriting points on the smooth handwriting line comprises the following steps: Determine whether the number of groups of handwriting points is less than a preset group number threshold value; If the number of groups of handwriting points is less than the preset group number threshold value, the stroke handwriting point is determined to be all handwriting points corresponding to the number of groups of handwriting points; If the number of groups of handwriting points is greater than or equal to the preset group number threshold value, the stroke handwriting point is determined to be a handwriting point corresponding to the preset group number threshold value in reverse order.
3. The method of claim 1, wherein, The calculation of the stroke pressure value of the stroke handwriting point based on the stroke data corresponding to the stroke handwriting point comprises the following steps: Acquire the reference pressure value of the touch screen; Calculate the product of the number of stroke handwriting points in the stroke data and the serial number of each stroke handwriting point; Divide the reference pressure value by the product to obtain the stroke pressure value of each stroke handwriting point.
4. The method of claim 1, wherein, The calculation of the stroke pressure value of the stroke handwriting point based on the stroke data corresponding to the stroke handwriting point comprises the following steps: Based on the position of each stroke handwriting point in the stroke data and the distance between adjacent stroke handwriting points, the drawing speed of each stroke handwriting point is calculated; According to the drawing speed of each stroke handwriting point and the predetermined correspondence between each drawing speed and pressure value, the stroke pressure value of each stroke handwriting point is determined.
5. The method of claim 1, wherein, After determining the stroke handwriting point based on the number of groups of handwriting points on the smooth handwriting line, the method further comprises the following steps: Acquire a stroke diagram corresponding to adjacent stroke handwriting points; Connect the adjacent stroke handwriting points by using the stroke diagram to form the target handwriting.
6. The method according to any one of claims 1 to 5, characterized in that, Further comprising: The target handwriting is dynamically rendered and displayed on the touch screen by a presentation thread, and the target handwriting is statically rendered on the touch screen by a UI thread and the presentation thread is notified to delete the target handwriting.
7. A handwriting input device, comprising: The method comprises the following steps: The drawing handwriting point acquisition module is configured to acquire drawing handwriting points in response to a handwriting drawing operation on the touch screen. The smooth handwriting line drawing module is configured to perform smoothing processing on the inflection points in the drawing handwriting points, determine smooth points corresponding to the inflection points, and connect the smooth points corresponding to the inflection points and the control points other than the inflection points in the drawing order to draw a smooth handwriting line. The stroke pressure value calculation module is configured to determine a stroke handwriting point based on the number of groups of handwriting points on the smooth handwriting line, and calculate a stroke pressure value of the stroke handwriting point based on stroke data corresponding to the stroke handwriting point. The target handwriting drawing module is configured to simulate a stroke on the smooth handwriting line based on the stroke pressure value to form target handwriting. The smooth handwriting line drawing module is specifically configured to start from a first group of three non-adjacent drawing handwriting points, and perform the following operations for a current group of three non-adjacent drawing handwriting points: Determine a smooth point corresponding to an inflection point in the current group of three non-adjacent drawing handwriting points and two control points other than the inflection point, repeat the above operations until the current group of three non-adjacent drawing handwriting points is the last group of three non-adjacent drawing handwriting points, and end the above operations to obtain all the smooth points corresponding to the inflection points.
8. A handwriting input device, comprising: Comprise: A processor; A memory for storing executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the method of any one of claims 1-6.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The storage medium stores a computer program, and when the computer program is executed by the processor, the processor implements the method of any one of claims 1-6.
Citation Information
Patent Citations
Handwriting rendering method, device, interactive intelligent tablet computer, and storage medium
CN109284059A
Handwriting forming method, handwriting forming device and electronic equipment
CN113590002A