CN115509431A - Handwriting drawing method, device, equipment and storage medium - Google Patents

Handwriting drawing method, device, equipment and storage medium Download PDF

Info

Publication number
CN115509431A
CN115509431A CN202211263268.5A CN202211263268A CN115509431A CN 115509431 A CN115509431 A CN 115509431A CN 202211263268 A CN202211263268 A CN 202211263268A CN 115509431 A CN115509431 A CN 115509431A
Authority
CN
China
Prior art keywords
points
point
stroke
handwriting
pen
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211263268.5A
Other languages
Chinese (zh)
Inventor
李海彦
陈德蛟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Century TAL Education Technology Co Ltd
Original Assignee
Beijing Century TAL Education Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Century TAL Education Technology Co Ltd filed Critical Beijing Century TAL Education Technology Co Ltd
Priority to CN202211263268.5A priority Critical patent/CN115509431A/en
Publication of CN115509431A publication Critical patent/CN115509431A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
    • G06F3/0416Control or interface arrangements specially adapted for digitisers

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The disclosure relates to a handwriting drawing method, a handwriting drawing device, handwriting drawing equipment and a storage medium. The method comprises the following steps: responding to handwriting drawing operation of the touch screen, obtaining drawing trace points, smoothing inflection points in the drawing trace points, determining smooth points corresponding to the inflection points, connecting the smooth points corresponding to all the inflection points and control points except the inflection points according to a drawing sequence, drawing smooth trace lines, determining the front trace points based on the group number of the front trace points on the smooth trace lines, calculating a front pressure sensing value of the front trace points based on front pressure sensing value, simulating a front on the smooth trace lines based on the front pressure sensing value, and forming target handwriting. Therefore, the handwriting which is smooth and has the writing style effect can be drawn, the smoothness and the attractiveness of the handwriting on the touch screen are improved, and the handwriting drawing and watching experience of a user is finally improved.

Description

Handwriting drawing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of touch technologies, and in particular, to a method, an apparatus, a device, and a storage medium for handwriting drawing.
Background
With the development of information technology, handwriting is drawn on a touch screen by using a stylus or a finger in many scenes, and the drawing effect of the handwriting directly influences the user experience. For example, in a class teaching scene, a teacher needs to write on a touch screen in a blackboard writing manner, and the blackboard writing effect on the touch screen affects the teaching effect of the teacher.
In the handwriting drawing process, the handwriting drawing operation is detected through the touch screen, the drawing stroke points are determined, and then the handwriting is drawn on the touch screen based on the drawing stroke points. However, the handwriting drawn based on the current handwriting drawing mode is hard and has no stroke effect, so that the handwriting effect presented on the touch screen is poor, and the handwriting drawing and viewing experience of a user are influenced finally.
Disclosure of Invention
In order to solve the technical problem, the present disclosure provides a handwriting drawing method, apparatus, device and storage medium.
In a first aspect, the present disclosure provides a method for handwriting drawing, the method comprising:
responding to handwriting drawing operation of the touch screen, and acquiring drawing pen points;
smoothing the inflection points in the drawing trace points, determining smooth points corresponding to the inflection points, connecting all the smooth points corresponding to the inflection points and control points except the inflection points according to a drawing sequence, and drawing a smooth trace line;
determining the stroke points of the pen point based on the group number of the stroke points on the smooth stroke line, and calculating the stroke pressure values of the stroke points of the pen point based on stroke data corresponding to the stroke points;
and simulating a writing front on the smooth writing line based on the writing front pressure sensitivity value to form target writing.
In a second aspect, the present disclosure provides a handwriting-drawing apparatus, the apparatus comprising:
the handwriting drawing point acquisition module is used for responding to handwriting drawing operation on the touch screen and acquiring drawing handwriting points;
the smooth pen trace drawing module is used for performing smoothing processing on inflection points in the drawn pen trace points, determining smooth points corresponding to the inflection points, connecting all the smooth points corresponding to the inflection points and control points except the inflection points according to a drawing sequence, and drawing a smooth pen trace;
the pen front pressure sensing value calculating module is used for determining pen front pen track points based on the number of the pen track points on the smooth pen track line and calculating the pen front pressure sensing values of the pen front pen track points based on the pen front data corresponding to the pen front pen track points;
and the target handwriting drawing module is used for simulating a pen front on the smooth handwriting line based on the pen front pressure sensing value to form the target handwriting.
In a third aspect, an embodiment of the present disclosure further provides a handwriting drawing device, where the device includes:
a processor;
a memory for storing executable instructions;
wherein the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the method provided by the first aspect.
In a fourth aspect, the disclosed embodiments also provide a computer-readable storage medium, on which a computer program is stored, where the storage medium stores the computer program, and when the computer program is executed by a processor, the processor is caused to implement the method provided by the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
the embodiment of the invention discloses a handwriting drawing method, a handwriting drawing device and a handwriting drawing storage medium, wherein in response to handwriting drawing operation on a touch screen, drawing handwriting points are obtained, smoothing processing is carried out on inflection points in the drawing handwriting points, smooth points corresponding to the inflection points are determined, according to a drawing sequence, the smooth points corresponding to all the inflection points and control points except the inflection points are connected, a smooth handwriting line is drawn, a tip point handwriting point is determined based on the group number of the handwriting points on the smooth handwriting line, a tip pressure sensing value of the tip point is calculated based on tip point data corresponding to the tip point handwriting point, a tip is simulated on the smooth handwriting line based on the tip point pressure sensing value, and a target handwriting is formed. Therefore, the handwriting which is smooth and has the writing style effect can be drawn, the fluency and the attractiveness of the handwriting on the touch screen are improved, and the handwriting drawing and watching experience of a user is finally improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a method for drawing handwriting according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of three non-collinear waypoints provided by an embodiment of the present disclosure;
fig. 3 to 5 are schematic diagrams of smooth points corresponding to the determined turning points, respectively, provided in the embodiment of the present disclosure;
FIG. 6 is a logic diagram for calculating a pressure sensitivity value of a pen nib according to an embodiment of the present disclosure;
FIG. 7 is a thread diagram illustrating a plurality of threads provided according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a handwriting drawing apparatus according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of a handwriting drawing apparatus according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more complete and thorough understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". 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". Relevant definitions for other terms will be given in the following description. It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The handwriting drawing method provided by the embodiment of the disclosure is explained below with reference to fig. 1 to 7. In the embodiment of the disclosure, the handwriting drawing method can be executed by an electronic device or a server. The electronic device may include a mobile phone, a tablet computer, a desktop computer, a notebook computer, and other devices having a communication function. The server may be a device with storage and computing functions, such as a cloud server or a server cluster. It should be noted that the following embodiments are exemplarily explained with an electronic device as an execution subject.
Fig. 1 shows a flow chart of a method for handwriting drawing according to an embodiment of the present disclosure.
As shown in FIG. 1, the handwriting drawing method may include the following steps.
And S110, responding to handwriting drawing operation of the touch screen, and acquiring drawing handwriting points.
In practical application, in teaching scenes such as a classroom and the like, when a user wants to draw handwriting such as formulas, pictures, characters, dynamic pictures and the like, the user sends handwriting drawing operation to the touch screen, and the electronic equipment where the touch screen is located can respond to the operation through a pen thread to obtain drawing pen trace points.
In the embodiment of the present disclosure, the handwriting drawing process may be repackaged based on WPF (Windows Presentation Foundation, a UI frame that can create a desktop client application) InkCanvas (an area for defining and receiving and displaying handwriting), and the packaging process may be implemented by multiple threads.
In the embodiment of the disclosure, the touch screen may be a hard screen, and only handwriting points corresponding to handwriting drawing operations can be detected, and pressure sensing detection cannot be directly performed on the handwriting drawing operations.
In the embodiment of the present disclosure, drawing handwriting points may be understood as points of contact of a finger or a touch pen with the touch screen, which are discrete points used for drawing handwriting.
And S120, smoothing the inflection points in the drawing trace points, determining smooth points corresponding to the inflection points, connecting the smooth points corresponding to all the inflection points and the control points except the inflection points according to the drawing sequence, and drawing the trace line of the smooth pen.
In practical application, the electronic device can perform smooth corner calculation on the drawn handwriting points based on a second-order Bezier curve algorithm through the presentation thread, so that the inflection points in the drawn handwriting points are smoothed, smooth points corresponding to the inflection points are determined, and the smooth points corresponding to all the inflection points and control points except the inflection points are connected according to a drawing sequence to draw a smooth pen trace.
In the embodiment of the disclosure, the drawing sequence is determined according to the time when the drawing stroke points are drawn on the touch screen.
In the embodiment of the present disclosure, an inflection point refers to each tracing point drawn, and may also be a partial tracing point drawn. The control points refer to two drawing trace points adjacent to the inflection point, and the control points and the inflection point are not collinear.
In the embodiments of the present disclosure, the smooth writing lines refer to pen traces that are less stiff, i.e., pen traces that are smoother.
For ease of understanding, FIG. 2 shows a schematic of three non-collinear tracing points, where A is a first control point, B is an inflection point, and C is a second control point. Specifically, a, B, and C may be connected to form an initial trajectory line, and B is smoothed to find a smooth point B 'corresponding to B, and then a, B', and C are connected to draw a smooth trajectory line.
Wherein, S120 may specifically include the following steps:
s1201, starting from the first group of three non-adjacent drawing stroke points, aiming at the current group of three non-adjacent drawing stroke points, executing the following operations:
and determining smooth points corresponding to the inflection points based on the inflection points in the three non-adjacent drawing trace points of the current group and two control points except the inflection points, repeating the operation until the three non-adjacent drawing trace points of the current group are the last three non-adjacent drawing trace points of the last group, and finishing the operation to obtain the smooth points corresponding to all the inflection points.
The two control points refer to a starting track point and an ending track point in the three non-collinear track points.
Specifically, for S1201, a first target point is found on a first connection line between a first control point and an inflection point through the presentation thread; calculating a first proportion according to a first distance between the first target point and the first control point and a second distance between the first control point and the inflection point; finding a second target point on a second connecting line between a second control point and the inflection point on the basis of the first proportion, wherein a second proportion formed by a third distance between the second target point and the inflection point and a fourth distance between the second control point and the inflection point is equal to the first proportion; connecting the first target point and the second target point to obtain a third connecting line; and finding a smooth point corresponding to the inflection point on a third connecting line based on a first proportion or a second proportion, wherein a third proportion formed by a fifth distance between the first target point and the smooth point and a sixth distance between the first target point and the second target point is equal to the first proportion or the second proportion. It should be noted that, for other three non-collinear handwriting points, a smooth point corresponding to the inflection point may also be found based on the above principle until all smooth points are found.
For easy understanding, referring to fig. 3-5, the first control point a and the inflection point B form a first connection line AB, an arbitrary point is found on the first connection line AB as a first target point D, a first distance L1 between the first target point D and the first control point a is calculated, a second distance L2 between the first control point a and the inflection point B is calculated, and a first ratio K1 is calculated according to L1 and L2; according to a first proportion K1, finding a second target point E on a second connecting line BC of a second control point C and an inflection point B, wherein a second proportion K2 formed by a third distance L3 between the second target point E and the inflection point B and a fourth distance L4 between the second control point C and the inflection point B is equal to the first proportion K2; connecting the first target point D and the second target point E to obtain a third connecting line DE; based on the first ratio K1 or the second ratio K2, a smooth point B 'corresponding to the inflection point is found on the third connection DE, wherein a third ratio K3 formed by a fifth distance L5 between the first target point D and the smooth point B' and a sixth distance L5 between the first target point D and the second target point E is equal to the first ratio K1 or the second ratio K2.
Therefore, the smooth points corresponding to the inflection points in the drawing trace points are accurately found by smoothing the inflection points in the drawing trace points, and a smooth curve is drawn based on the smooth points corresponding to the inflection points in the drawing trace points and the control points except the inflection points.
In some cases, the drawing handwriting points can also be added with attribute parameters in advance, and the smooth pen trace line is drawn based on the drawing handwriting points added with the attribute parameters.
The attribute parameters may be color, thickness, brightness, and the like.
Therefore, in the drawing process of a user, the inflection point in the drawing stroke point can be smoothed, and the stroke line with higher smoothness is drawn.
S130, determining the writing point based on the group number of the writing points on the smooth writing line, and calculating the writing pressure sensing value of the writing point based on the writing data corresponding to the writing point.
In the embodiment of the disclosure, the smooth handwriting line comprises a plurality of stroke points, the electronic device can divide the plurality of stroke points into a plurality of groups through the presentation thread, and the stroke points of the pen point are determined according to the group number of the stroke points. For example, if the smooth trace is short, the number of sets of trace points is small, and all trace points on the smooth trace can be used as trace points of the front of the pen; for another example, if the smooth handwriting line is longer, the number of handwriting points is more, and a part of the handwriting points can be selected from the smooth handwriting line as the stroke points of the pen point.
Optionally, the number of the tracing points in each group may be equal or unequal.
In the embodiment of the present disclosure, the handwriting data of the stroke point refers to the actual drawing parameters of the stroke point. Optionally, the handwriting data of the front trace points may include parameters such as the number of the front trace points, the sequence number of the front trace points, the drawing speed of the front trace points, and the distance between adjacent front trace points.
In some embodiments, the tip pressure sensitivity value of the tip points may be calculated based on the number of the tip points and the number of the sequence numbers of the tip points.
In other embodiments, the writing point pressure sensing value of the writing point can be calculated according to the drawing speed of the writing point and the distance between the adjacent writing points.
Therefore, the pen point and the pen point can be determined based on the group number of the pen point, and then the pen point pressure sensing value can be accurately calculated according to the pen point data of the pen point and the pen point, so that the pen point effect can be conveniently and subsequently simulated based on the pen point pressure sensing value.
And S140, simulating the pen point on the smooth handwriting line based on the pen point pressure sensing value to form the target handwriting.
It can be understood that the writing point pressure sensitivity value can be used for representing the drawing strength of the writing point, and the writing point can be simulated on the smooth writing line based on the writing point of the writing point, so that the target writing with the writing point effect is drawn.
In the embodiment of the disclosure, the target handwriting refers to a handwriting line which is smooth and has a writing front effect.
The embodiment of the disclosure provides a handwriting drawing method, which includes the steps of responding to handwriting drawing operation of a touch screen, obtaining drawing trace points, conducting smoothing processing on inflection points in the drawing trace points, determining smooth points corresponding to the inflection points, connecting the smooth points corresponding to all the inflection points and control points except the inflection points according to a drawing sequence, drawing a smooth trace line, determining a front trace point based on the number of groups of the front trace points on the smooth trace line, calculating a front pressure value of the front trace point based on front pressure data corresponding to the front trace point, simulating a front on the smooth trace line based on the front pressure value, and forming target handwriting. Therefore, the handwriting which is smooth and has the writing style effect can be drawn, the fluency and the attractiveness of the handwriting on the touch screen are improved, and the handwriting drawing and watching experience of a user is finally improved.
In another embodiment of the present disclosure, the pressure sensitivity value of the pen point is determined in different ways.
In this embodiment of the present disclosure, optionally, in S130, "determining the stroke point based on the group number of stroke points on the smooth stroke trace" may specifically include the following steps:
s1301, judging whether the group number of the trace points is smaller than a preset group number threshold value;
s1302, if the group number of the stroke points is smaller than a preset group number threshold value, determining the stroke points of the pen point as all the stroke points corresponding to the group number of the stroke points;
and S1303, if the group number of the stroke points is greater than or equal to a preset group number threshold, determining the stroke point of the stroke point as a handwriting point corresponding to the preset group number threshold of the reverse sorting.
Wherein, the number of the stroke points refers to the grouping number of the stroke points on the smooth stroke line.
The preset group number threshold may be a group number predetermined by a user for forming the target writing in different ways. Alternatively, the preset group number threshold may be 8 or other values.
And the handwriting points corresponding to the preset group number threshold are the handwriting points corresponding to the subsequent group number threshold.
Specifically, the stroke point can be determined by the presentation thread based on the group number of the stroke points and a preset group number threshold. The rendering thread refers to a thread used for drawing handwriting and dynamically rendering the handwriting in the electronic device.
It can be understood that, by taking the example that the preset group number threshold is 8 and the group number of the trace points is 6, the presentation thread can judge that the group number of the trace points is less than 8, and then the presentation thread takes all trace points in the 6 groups of trace points as the front trace points; in other cases, the preset group number threshold is 8, and the group number of the stroke points is 20, for example, the presentation thread can determine that the group number of the stroke points is greater than 8, and the presentation thread takes the last 8 groups of stroke points as the stroke point.
Therefore, all the handwriting points can be selected as the stroke front point based on the group number of the stroke points and the size of the preset group number threshold, or partial handwriting points can be selected as the stroke front point.
In some embodiments, optionally, the step S130 of calculating the tip pressure sensitivity value of the tip trace point based on the tip data corresponding to the tip trace point may specifically include the following steps:
acquiring a reference pressure sensing value of the touch screen;
calculating the product of the number of the stroke points of the pen point in the handwriting data and the sequence number of each stroke point;
and dividing the reference pressure sensitivity value by the product to obtain the pen point pressure sensitivity value of each pen point.
The reference pressure sensitivity value refers to a standard pressure sensitivity value of the touch screen which is artificially predetermined. Alternatively, the reference pressure-sensitive value may be 0.5, or may be another value.
Wherein, the serial number of the stroke point is the mark number of the stroke point. For example, if the number of the stroke points of the pen point is 16, the number of the sequence numbers of the stroke points of the pen point is 1 to 16.
Optionally, the writing point pressure sensitivity value of the writing point = reference pressure sensitivity value/(the number of writing points × (the number of serial numbers of writing points).
Therefore, as the number of the sequence numbers increases, the pen front pressure value corresponding to each pen front handwriting point decreases progressively, so that the pen front handwriting points with the pressure values decreasing progressively are presented to the user.
For ease of understanding, fig. 6 shows a logical schematic diagram for calculating the pressure sensitivity value of a pen tip. As shown in fig. 6, first, the number of sets of the trace points is obtained, and whether the number of sets of the trace points is less than 8 is determined; if the number of the stroke points is less than 8, all handwriting points corresponding to the number of the stroke points are taken as stroke front stroke points, and if the number of the smooth stroke points is more than or equal to 8, 8 groups of handwriting points are extracted from the stroke points on the smooth stroke lines and taken as stroke front stroke points; and further calculating the pen point pressure sensitivity value = reference pressure sensitivity value/(the number of the pen point points is the number of the serial numbers of the pen point points).
Therefore, the stroke reference value of the stroke point on the smooth handwriting line is calculated in different modes according to the group number of the stroke points on the smooth handwriting line, so that the pressure value of the stroke point on the smooth handwriting line is progressively reduced, and the stroke point with the gradually reduced pressure value is presented to a user.
In other embodiments, optionally, the step S130 of calculating the pressure sensitivity value of the pen point based on the pen point data corresponding to the pen point trace point may specifically include the following steps:
based on the position of each pen point in the pen point data and the distance between adjacent pen point points;
calculating the drawing speed of each stroke point based on the position of each stroke point and the distance between adjacent stroke points;
and determining the stroke pressure value of each stroke point according to the drawing speed of each stroke point and the corresponding relation between each drawing speed and the pressure value which are determined in advance.
The position of each pen point can be determined according to the coordinate of each pen point on the touch screen.
The drawing speed of each pen point trace point can be calculated based on the position of each pen point trace point on the smooth handwriting line, the distance between adjacent pen point trace points and the drawing time of the adjacent pen point trace points.
Specifically, the drawing speed of each pen point can be determined through the presentation thread, and the pen point can be determined based on the corresponding relation between the drawing speed and the pressure value.
It can be understood that, because each speed corresponds to a pressure sensing value, the pressure sensing value corresponding to the drawing speed can be found and used as the pen point pressure sensing value of the pen point trace point.
In still other embodiments, after determining the point of the pen tip based on the number of groups of points on the smoothed pen trace, the method further comprises:
acquiring a stroke front graph corresponding to an adjacent stroke front handwriting point;
and connecting adjacent stroke points by using the stroke diagrams to form the target handwriting.
Specifically, the stroke images corresponding to the adjacent stroke points are obtained from the pre-stored stroke images corresponding to a plurality of stroke points through the presentation thread, and then placing the stroke diagrams corresponding to the adjacent stroke points between the adjacent stroke points for connecting the adjacent stroke points to form the target handwriting.
Therefore, the stroke front can be simulated on the smooth handwriting line in different modes, and the target handwriting is formed and rendered.
Further, after the target handwriting is obtained, the handwriting drawing method further comprises a rendering and displaying process. Specifically, the target handwriting is dynamically rendered and displayed on the touch screen through the presentation thread, and the target handwriting is statically rendered on the touch screen through the UI thread and notified to the presentation thread to delete the target handwriting.
To facilitate understanding of the handwriting drawing and rendering logic, fig. 7 is a thread diagram including multiple threads, and the rendering process of the target pen trace is explained with reference to fig. 7.
As shown in FIG. 7, the plurality of threads includes a pen thread, a rendering thread, and a UI thread. Specifically, firstly, a pen thread acquires drawing stroke points and sends the drawing stroke points to a presentation thread and a UI thread; then, dynamically rendering and displaying the target handwriting on the touch screen by the presentation thread, and statically rendering the target handwriting on the touch screen by the UI thread; further, the UI thread generates a handwriting deletion notification and sends the notification to the presentation thread; finally, the rendering thread deletes the target handwriting based on the notification.
The embodiment of the present disclosure further provides a handwriting drawing device for implementing the handwriting drawing method, which is described below with reference to fig. 8. In the embodiment of the disclosure, the handwriting drawing device can be an electronic device or a server. The electronic device may include a mobile phone, a tablet computer, a desktop computer, a notebook computer, and other devices having a communication function. The server may be a cloud server or a server cluster or other devices with storage and computing functions.
Fig. 8 shows a schematic structural diagram of a handwriting drawing apparatus according to an embodiment of the present disclosure.
As shown in fig. 9, the handwriting drawing apparatus 800 may include:
a drawing trace point acquisition module 810, configured to acquire drawing trace points in response to a trace drawing operation on the touch screen;
a smooth handwriting line drawing module 820, configured to smooth inflection points in the drawn handwriting points, determine smooth points corresponding to the inflection points, connect all the smooth points corresponding to the inflection points and control points other than the inflection points according to a drawing sequence, and draw a smooth handwriting line;
the pen front pressure sensitivity value calculation module 830 is configured to determine pen front trace points based on the number of groups of the trace points on the smooth trace, and calculate pen front pressure sensitivity values of the pen front trace points based on pen front data corresponding to the pen front trace points;
and the target handwriting drawing module 840 is used for simulating a pen front on the smooth handwriting line based on the pen front pressure sensing value to form target handwriting.
The embodiment of the disclosure provides a handwriting drawing device, which obtains drawing handwriting points in response to handwriting drawing operation on a touch screen, smoothes inflection points in the drawing handwriting points, determines smooth points corresponding to the inflection points, connects the smooth points corresponding to all the inflection points and control points except the inflection points according to a drawing sequence, drawing a smooth trace line, determining the stroke point points based on the group number of the stroke points on the smooth trace line, calculating the stroke pressure value of the stroke point points based on stroke data corresponding to the stroke point points, and simulating the stroke on the smooth trace line based on the stroke pressure value to form target handwriting. Therefore, the handwriting which is smooth and has the writing style effect can be drawn, the fluency and the attractiveness of the handwriting on the touch screen are improved, and the handwriting drawing and watching experience of a user is finally improved.
In some optional embodiments, the smooth trace drawing module 820 is specifically configured to, starting from the first set of non-adjacent three drawing trace points, perform the following operations for the current set of non-adjacent three drawing trace points:
based on the inflection point in the three non-adjacent drawing stroke points of the current group and except for two control points except the inflection point, determining the smooth point corresponding to the inflection point, repeating the above operation until the three non-adjacent drawing stroke points of the current group are the three non-adjacent drawing stroke points of the last group, ending the above operation, and obtaining all the smooth points corresponding to the inflection point.
In some optional embodiments, the pen tip pressure sensitivity value calculating module 830 is specifically configured to determine whether the group number of the stroke points is smaller than a preset group number threshold;
if the number of the stroke points is smaller than the preset number threshold, determining the stroke points of the pen point as all stroke points corresponding to the number of the stroke points;
and if the group number of the stroke points is greater than or equal to the preset group number threshold, determining the stroke point as a handwriting point corresponding to the preset group number threshold of the reverse sequencing.
In some optional embodiments, the pen tip pressure sensitivity value calculating module 830 is specifically configured to obtain a reference pressure sensitivity value of the touch screen;
calculating the product of the number of the stroke points of the pen point in the handwriting data and the sequence number of each stroke point of the pen point;
and dividing the reference pressure sensitivity value by the product to obtain the pen point pressure sensitivity value of each pen point.
In some optional embodiments, the stroke pressure value calculation module 830 is specifically configured to calculate the stroke pressure value based on the position of each stroke point in the stroke data and the distance between adjacent stroke points;
calculating the drawing speed of each stroke point based on the position of each stroke point and the distance between the adjacent stroke points;
and determining the tip pressure sensitivity value of each tip trace point according to the drawing speed of each tip trace point and the corresponding relation between each predetermined drawing speed and the pressure sensitivity value.
In some optional embodiments, the apparatus further comprises:
the pen front image acquisition module is used for acquiring pen front images corresponding to adjacent pen front handwriting points;
and the target handwriting forming module is used for connecting the adjacent stroke points by using the stroke graph to form the target handwriting.
In some optional embodiments, the apparatus further comprises:
and the rendering module is used for dynamically rendering and displaying the target handwriting on the touch screen through a presentation thread, and statically rendering the target handwriting on the touch screen through a UI thread and informing the presentation thread to delete the target handwriting.
It should be noted that the handwriting drawing apparatus 800 shown in fig. 8 may perform each step in the method embodiments shown in fig. 1 to fig. 7, and implement each process and effect in the method embodiments shown in fig. 1 to fig. 7, which are not described herein again.
An exemplary embodiment of the present disclosure also provides an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program, when executed by the at least one processor, is for causing the electronic device to perform a method according to an embodiment of the present disclosure.
The disclosed exemplary embodiments also provide a non-transitory computer readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is for causing the computer to perform a method according to an embodiment of the present disclosure.
The exemplary embodiments of the present disclosure also provide a computer program product comprising a computer program, wherein the computer program, when being executed by a processor of a computer, is adapted to cause the computer to carry out the method according to the embodiments of the present disclosure.
Referring to fig. 9, a block diagram of a structure of a handwriting drawing device 900, which may be a server or a client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described, and the handwriting drawing device 900 may be the above-described electronic device. Electronic device is intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, 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 disclosure described and/or claimed herein.
As shown in fig. 9, the handwriting drawing apparatus 900 includes a computing unit 901, which 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 from a storage unit 908 into a Random Access Memory (RAM) 904. In the RAM904, various programs and data necessary for the operation of the handwriting drawing apparatus 900 can also be stored. The computing unit 901, ROM902, and RAM904 are connected to each other by a bus 1004. An input/output (I/O) interface 905 is also connected to bus 1004.
A number of components in the handwriting rendering 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 may be any type of device capable of inputting information to the handwriting drawing device 900, and the input unit 906 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device. Output unit 907 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, a video/audio output terminal, a vibrator, and/or a printer. The storage unit 1004 may include, but is not limited to, a magnetic disk, an optical disk. The communication unit 909 allows the handwriting-rendering device 900 to exchange information/data with other devices via a computer network, such as the Internet, and/or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and/or chipsets, such as Bluetooth (TM) devices, wiFi devices, wiMax devices, cellular communication devices, and/or the like.
The computing unit 901 may be a variety of general and/or special purpose processing components having 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 dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 901 performs the respective methods and processes described above. For example, in some embodiments, the handwriting drawing method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and/or installed onto the handwriting rendering device 900 via the ROM902 and/or the communication unit 909. In some embodiments, the computing unit 901 may be configured to perform the handwriting drawing method in any other suitable way (e.g., by means of firmware).
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may 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 a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
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 used to provide machine instructions and/or data to a programmable processor.
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 a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; 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 may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here 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 here), 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: local Area Networks (LANs), wide Area Networks (WANs), and the Internet.
The computer system may 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.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation 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 may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which will enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of handwriting rendering, comprising:
responding to handwriting drawing operation of the touch screen, and acquiring drawing stroke points;
smoothing inflection points in the drawing trace points, determining smooth points corresponding to the inflection points, connecting all the smooth points corresponding to the inflection points and control points except the inflection points according to a drawing sequence, and drawing a smooth trace line;
determining a stroke point on the basis of the group number of stroke points on the smooth stroke line, and calculating a stroke pressure sensing value of the stroke point on the basis of stroke data corresponding to the stroke point;
and simulating a writing front on the smooth writing line based on the writing front pressure sensitivity value to form target writing.
2. The method according to claim 1, wherein the smoothing of the inflection point in the tracing points, and determining a smooth point corresponding to the inflection point, comprises:
starting from a first group of three non-adjacent drawing stroke points, aiming at the current group of three non-adjacent drawing stroke points, the following operations are executed:
based on the inflection point in the three drawing stroke points that current group is not adjacent and except two control points outside the inflection point, confirm the smooth point that the inflection point corresponds repeats above-mentioned operation, until current three drawing stroke points that group is not adjacent are the three drawing stroke points that last group is not adjacent, end above-mentioned operation, obtain all the smooth point that the inflection point corresponds.
3. The method of claim 1, wherein determining a stroke point based on the number of groups of stroke points on the smoothed stroke line comprises:
judging whether the group number of the stroke points is smaller than a preset group number threshold value or not;
if the number of the stroke points is smaller than the preset number threshold, determining the stroke points of the pen point as all stroke points corresponding to the number of the stroke points;
and if the group number of the stroke points is greater than or equal to the preset group number threshold, determining the stroke point as a handwriting point corresponding to the preset group number threshold of the reverse sorting.
4. The method according to claim 1, wherein calculating the pen tip pressure value of the pen tip trace point based on the pen tip data corresponding to the pen tip trace point comprises:
acquiring a reference pressure sensing value of the touch screen;
calculating the product of the number of the stroke points of the pen point in the handwriting data and the sequence number of each stroke point of the pen point;
and dividing the reference pressure sensitivity value by the product to obtain the pen point pressure sensitivity value of each pen point locus point.
5. The method according to claim 1, wherein calculating the pen tip pressure value of the pen tip trace point based on the pen tip data corresponding to the pen tip trace point comprises:
calculating the drawing speed of each pen point based on the position of each pen point in the pen point data and the distance between adjacent pen point points;
and determining the tip pressure sensitivity value of each tip trace point according to the drawing speed of each tip trace point and the corresponding relation between each predetermined drawing speed and the pressure sensitivity value.
6. The method of claim 1, wherein after determining the stroke points based on the number of groups of stroke points on the smoothed stroke line, the method further comprises:
acquiring a stroke front graph corresponding to an adjacent stroke front handwriting point;
and connecting the adjacent stroke points by using the stroke diagrams to form the target handwriting.
7. The method according to any one of claims 1 to 6, further comprising:
dynamically rendering and displaying the target handwriting on the touch screen through a presentation thread, and statically rendering the target handwriting on the touch screen through a UI thread and informing the presentation thread to delete the target handwriting.
8. A handwriting-drawing apparatus, comprising:
the handwriting drawing point acquisition module is used for responding to handwriting drawing operation on the touch screen and acquiring drawing handwriting points;
the smooth pen trace drawing module is used for performing smoothing processing on inflection points in the drawn pen trace points, determining smooth points corresponding to the inflection points, connecting all the smooth points corresponding to the inflection points and control points except the inflection points according to a drawing sequence, and drawing a smooth pen trace;
the pen front pressure sensing value calculating module is used for determining pen front pen track points based on the number of the pen track points on the smooth pen track line and calculating the pen front pressure sensing values of the pen front pen track points based on the pen front data corresponding to the pen front pen track points;
and the target handwriting drawing module is used for simulating a writing front on the smooth handwriting line based on the writing front pressure sensing value to form target handwriting.
9. A handwriting drawing apparatus, comprising:
a processor;
a memory for storing executable instructions;
wherein the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the storage medium stores the computer program, which, when executed by a processor, causes the processor to carry out the method of any of the preceding claims 1-7.
CN202211263268.5A 2022-10-14 2022-10-14 Handwriting drawing method, device, equipment and storage medium Pending CN115509431A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211263268.5A CN115509431A (en) 2022-10-14 2022-10-14 Handwriting drawing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211263268.5A CN115509431A (en) 2022-10-14 2022-10-14 Handwriting drawing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115509431A true CN115509431A (en) 2022-12-23

Family

ID=84510900

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211263268.5A Pending CN115509431A (en) 2022-10-14 2022-10-14 Handwriting drawing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115509431A (en)

Similar Documents

Publication Publication Date Title
CN111381754B (en) Handwriting processing method, equipment and medium
EP2752740A1 (en) Drawing control method, apparatus and mobile terminal
KR102393295B1 (en) Apparatus and method for styling a content
CN108733296B (en) Method, device and equipment for erasing handwriting
US20180101298A1 (en) Graph display apparatus, graph display method and storage medium
US10930023B2 (en) Method and apparatus for imitating original graphic, computing device, and storage medium
US10664072B2 (en) Multi-stroke smart ink gesture language
CN111782131A (en) Pen point implementation method, device, equipment and readable storage medium
CN106598928B (en) A kind of method and its system annotated on a display screen
CN110727383A (en) Touch interaction method and device based on small program, electronic equipment and storage medium
WO2018157655A1 (en) Method and device for redefining control display area of screen
KR20130123691A (en) Method for inputting touch input and touch display apparatus thereof
CN114863008B (en) Image processing method, image processing device, electronic equipment and storage medium
CN117406903A (en) Handwriting adjusting method, device, medium and equipment for touch screen
CN109766530B (en) Method and device for generating chart frame, storage medium and electronic equipment
CN115509431A (en) Handwriting drawing method, device, equipment and storage medium
WO2021218446A1 (en) Handwriting processing method, handwriting processing device and non-transitory storage medium
WO2021218448A1 (en) Handwriting forming method and apparatus, and electronic device
WO2020133386A1 (en) Note partial selection method, apparatus, electronic terminal and readable storage medium
US10930045B2 (en) Digital ink based visual components
WO2017128483A1 (en) Method and apparatus for visual display based on touch control pressure
CN113487704B (en) Dovetail arrow mark drawing method and device, storage medium and terminal equipment
CN115035261B (en) Method, device, equipment and medium for generating collision device
CN115344187B (en) Method and device for identifying painting brush style by using safety Zhuo Huatu software
CN114546314B (en) Window display method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination