Method, device, computer-readable storage medium and equipment for simulating writing trajectory

By determining the midpoint and line width of the input point on the terminal device, drawing a quadrilateral and using Bezier curves to connect the points, the problem of differences in writing trajectory restoration and line width changes in the existing technology is solved, and a method closer to the user's actual writing is achieved. Trajectory effects and a better writing experience.

CN110782504BActive Publication Date: 2024-09-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910872400.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-16
Publication Date
2024-09-20
Estimated Expiration
2039-09-16

AI Technical Summary

Technical Problem

When displaying the user's writing trajectory, the existing technology cannot effectively restore the user's real writing trajectory, resulting in a large difference between the determined writing trajectory and the user's actual writing trajectory, and cannot achieve continuous changes in line width.

Method used

By determining the midpoint and line width between input points on the terminal device, drawing a quadrilateral and using Bezier curves to connect the points, filling the color according to the quadrilateral to determine the curve to be output, and realizing the drawing and line width of floating point line segments. continuous changes.

Benefits of technology

It reduces the difference between the writing trajectory and the user's actual writing trajectory, improves the writing trajectory effect, and achieves continuous changes in line width, improving the user's writing experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110782504B
    Figure CN110782504B
Patent Text Reader

Abstract

The present disclosure provides a method, device, computer-readable storage medium and electronic device for simulating writing trajectories, and relates to the field of computer technology. The method includes: collecting a first input point, a second input point and a third input point generated in sequence by a writing operation on a terminal device; determining a first midpoint between the first input point and the second input point, and determining a second midpoint between the second input point and the third input point; determining a first line width according to the first input point and the second input point, and determining a second line width according to the second input point and the third input point; determining points to be connected according to the first line width, the second line width, the first midpoint and the second midpoint; drawing a quadrilateral according to the points to be connected and determining a curve to be output according to the quadrilateral, and outputting the curve to be output as a simulated writing trajectory. The method in the present disclosure can overcome the problem that the determined writing trajectory is quite different from the actual writing trajectory of the user, so as to improve the effect of the determined writing trajectory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method and device for simulating writing tracks on a terminal device, a computer-readable storage medium, and an electronic device. Background Art

[0002] With the continuous development of Internet technology, devices can display writing trajectories by identifying users' writing operations. This technology is usually used in scenarios that require electronic signatures and electronic drawings. At present, the way to display the user's writing trajectory is to collect multiple coordinate points corresponding to the writing trajectory, and connect the coordinate points in sequence through line segments to simulate the user's writing trajectory and display it. However, since the user's real writing trajectory does not only contain broken lines, but also some curves, the writing trajectory determined in this way will be quite different from the user's actual writing trajectory.

[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0004] The purpose of the present disclosure is to provide a method, device, computer-readable storage medium and electronic device for simulating writing trajectory on a terminal device, which can overcome the problem of large differences between the determined writing trajectory and the actual writing trajectory of the user to a certain extent, so as to improve the effect of the determined writing trajectory.

[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0006] According to a first aspect of the present disclosure, a method for simulating a writing trajectory on a terminal device is provided, comprising:

[0007] Determine a first midpoint between the first input point and the second input point, and determine a second midpoint between the second input point and the third input point; wherein the first input point is detected earlier than the second input point, and the second input point is detected earlier than the third input point;

[0008] Determine a first line width according to the first input point and the second input point, and determine a second line width according to the second input point and the third input point;

[0009] Determine the point to be connected according to the first line width, the second line width, the first midpoint, and the second midpoint;

[0010] Draw a quadrilateral according to the points to be connected and determine the curve to be output according to the quadrilateral.

[0011] In an exemplary embodiment of the present disclosure, determining a curve to be output according to a quadrilateral includes:

[0012] The quadrilateral is filled with color according to a preset mapping rule, and the curve to be output is determined according to the quadrilateral filled with color.

[0013] In an exemplary embodiment of the present disclosure, the first input point, the second input point and the third input point are continuous input points.

[0014] In an exemplary embodiment of the present disclosure, determining a first line width according to a first input point and a second input point, and determining a second line width according to the second input point and a third input point, includes:

[0015] determining a first input speed from the first input point to the second input point according to a detection time of the first input point and a detection time of the second input point;

[0016] determining a second input speed from the second input point to the third input point according to the detection time of the second input point and the detection time of the third input point;

[0017] A first line width is determined according to a first input speed and a second line width is determined according to a second input speed.

[0018] In an exemplary embodiment of the present disclosure, the first line width and the second line width belong to a preset line width range, and the preset line width range includes a maximum line width and a minimum line width.

[0019] In an exemplary embodiment of the present disclosure, determining a point to be connected according to a first line width, a second line width, a first midpoint, and a second midpoint includes:

[0020] Dividing the first midpoint into a first to-be-connected point and a second to-be-connected point according to the first line width, the distance between the first to-be-connected point and the second to-be-connected point being the first line width, and the first midpoint being located on a connecting line between the first to-be-connected point and the second to-be-connected point;

[0021] The second midpoint is divided into a third point to be connected and a fourth point to be connected according to the second line width, the distance between the third point to be connected and the fourth point to be connected is the second line width, and the second midpoint is located on the connecting line between the third point to be connected and the fourth point to be connected.

[0022] In an exemplary embodiment of the present disclosure, drawing a quadrilateral according to the points to be connected includes:

[0023] A quadrilateral is obtained by connecting the first to-be-connected point, the second to-be-connected point, the third to-be-connected point and the fourth to-be-connected point through a Bezier curve.

[0024] According to a second aspect of the present disclosure, there is provided an apparatus for simulating a writing trajectory on a terminal device, comprising a midpoint determination unit, a line width determination unit, a connection point determination unit, and a curve drawing unit, wherein:

[0025] a midpoint determination unit, configured to determine a first midpoint between a first input point and a second input point, and to determine a second midpoint between the second input point and a third input point; wherein the first input point is detected earlier than the second input point, and the second input point is detected earlier than the third input point;

[0026] A line width determination unit, configured to determine a first line width according to the first input point and the second input point, and to determine a second line width according to the second input point and the third input point;

[0027] A connection point determination unit, used to determine a to-be-connected point according to the first line width, the second line width, the first midpoint, and the second midpoint;

[0028] The curve drawing unit is used to draw a quadrilateral according to the points to be connected and determine the curve to be output according to the quadrilateral.

[0029] In an exemplary embodiment of the present disclosure, the curve drawing unit may determine the curve to be output according to the quadrilateral in the following manner:

[0030] The curve drawing unit fills the quadrilateral with color according to a preset mapping rule, and determines the curve to be output according to the quadrilateral filled with color.

[0031] In an exemplary embodiment of the present disclosure, the first input point, the second input point and the third input point are continuous input points.

[0032] In an exemplary embodiment of the present disclosure, the line width determining unit determines the first line width according to the first input point and the second input point, and determines the second line width according to the second input point and the third input point in a manner as follows:

[0033] The line width determination unit determines a first input speed from the first input point to the second input point according to a detection time of the first input point and a detection time of the second input point;

[0034] The line width determination unit determines a second input speed from the second input point to the third input point according to the detection time of the second input point and the detection time of the third input point;

[0035] The line width determination unit determines a first line width according to a first input speed and determines a second line width according to a second input speed.

[0036] In an exemplary embodiment of the present disclosure, the first line width and the second line width belong to a preset line width range, and the preset line width range includes a maximum line width and a minimum line width.

[0037] In an exemplary embodiment of the present disclosure, the connection point determining unit determines the to-be-connected point according to the first line width, the second line width, the first midpoint, and the second midpoint in the following manner:

[0038] The connection point determination unit divides the first midpoint into a first to-be-connected point and a second to-be-connected point according to the first line width, the distance between the first to-be-connected point and the second to-be-connected point is the first line width, and the first midpoint is located on a connection line between the first to-be-connected point and the second to-be-connected point;

[0039] The connection point determination unit divides the second midpoint into a third to-be-connected point and a fourth to-be-connected point according to the second line width, the distance between the third to-be-connected point and the fourth to-be-connected point is the second line width, and the second midpoint is located on the connection line between the third to-be-connected point and the fourth to-be-connected point.

[0040] In an exemplary embodiment of the present disclosure, the curve drawing unit may draw a quadrilateral according to the points to be connected in the following manner:

[0041] The curve drawing unit connects the first to-be-connected point, the second to-be-connected point, the third to-be-connected point and the fourth to-be-connected point through a Bezier curve to obtain a quadrilateral.

[0042] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned methods by executing the executable instructions.

[0043] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, any one of the methods described above is implemented.

[0044] The exemplary embodiments of the present disclosure may have some or all of the following beneficial effects:

[0045] In a scheme for simulating a writing trajectory on a terminal device provided in an exemplary embodiment of the present disclosure, a first midpoint between a first input point and a second input point can be determined, and a second midpoint between the second input point and a third input point can be determined; wherein the detection time of the first input point is earlier than that of the second input point, and the detection time of the second input point is earlier than that of the third input point; a first line width is determined according to the first input point and the second input point, and a second line width is determined according to the second input point and the third input point; points to be connected are determined according to the first line width, the second line width, the first midpoint, and the second midpoint; quadrilaterals are drawn according to the points to be connected and curves to be output are determined according to the quadrilaterals, and then, the user's writing trajectory can be restored to a certain extent according to the determined multiple curves to be output. According to the above scheme description, the present disclosure can, on the one hand, overcome the problem that the determined writing trajectory is greatly different from the user's actual writing trajectory to a certain extent, so as to improve the effect of the determined writing trajectory; on the other hand, the curve to be output can be determined according to the determined quadrilateral to realize the drawing of floating-point line segments; on the other hand, the line width can be calculated through the user's input points to realize the continuous change of the line width during the writing restoration process.

[0046] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0048] Figure 1 A schematic diagram showing an exemplary system architecture to which embodiments of the present disclosure may be applied;

[0049] Figure 2 A schematic diagram showing the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown;

[0050] Figure 3 A flowchart of a method for simulating a writing trajectory on a terminal device according to an embodiment of the present disclosure is schematically shown;

[0051] Figure 4 A schematic diagram schematically shows a schematic diagram of determining a point to be connected according to a first line width, a second line width, a first midpoint, and a second midpoint according to an embodiment of the present disclosure;

[0052] Figure 5A schematic diagram schematically shows a schematic diagram of determining a point to be connected according to a first line width, a second line width, a first midpoint, and a second midpoint according to another embodiment of the present disclosure;

[0053] Figure 6 A schematic diagram of comparison of curves to be output according to an embodiment of the present disclosure is schematically shown;

[0054] Figure 7 A flowchart of a method for simulating a writing trajectory on a terminal device according to another embodiment of the present disclosure is schematically shown;

[0055] Figure 8 The structural block diagram of an apparatus for simulating a writing trajectory on a terminal device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0056] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0057] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0058] Figure 1 A schematic diagram showing a system architecture of an exemplary application environment to which the embodiments of the present disclosure can be applied is shown.

[0059] like Figure 1As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with display screens, including but not limited to desktop computers, portable computers, smart phones, tablet computers, etc. It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.

[0060] The method for simulating a writing track on a terminal device provided in the embodiment of the present disclosure is generally executed by the server 105, and accordingly, the device for simulating a writing track on a terminal device is generally set in the server 105. However, it is easy for a person skilled in the art to understand that the method for simulating a writing track on a terminal device provided in the embodiment of the present disclosure can also be executed by the terminal devices 101, 102, and 103, and accordingly, the device for simulating a writing track on a terminal device can also be set in the terminal devices 101, 102, and 103, which is not particularly limited in this exemplary embodiment. For example, in an exemplary embodiment, the server 105 can determine a first midpoint between a first input point and a second input point, and determine a second midpoint between the second input point and a third input point, and determine a first line width according to the first input point and the second input point, and determine a second line width according to the second input point and the third input point, and determine a point to be connected according to the first line width, the second line width, the first midpoint, and the second midpoint, and draw a quadrilateral according to the point to be connected and determine a curve to be output according to the quadrilateral.

[0061] Figure 2 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown.

[0062] It should be noted that Figure 2 The computer system 200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0063] like Figure 2As shown, the computer system 200 includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 202 or a program loaded from a storage storage part 208 into a random access memory (RAM) 203. In the RAM 203, various programs and data required for system operation are also stored. The CPU 201, the ROM 202, and the RAM 203 are connected to each other via a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.

[0064] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, a modem, etc. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the I / O interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed, so that a computer program read therefrom is installed into the storage storage section 208 as needed.

[0065] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 209, and / or installed from a removable medium 211. When the computer program is executed by the central processing unit (CPU) 201, various functions defined in the method and apparatus of the present application are executed.

[0066] The technical solution of the embodiment of the present disclosure is described in detail below:

[0067] At present, the method of displaying the user's writing trajectory can also be: after collecting a series of coordinates generated by the user touching the screen, determine the coordinates of the adjacent points in every three consecutive points, and calculate the midpoint coordinates of the coordinates of the two groups of adjacent points, and then, use the original coordinate data as the control point, and use the two midpoint coordinates as the starting point and the end point respectively, and draw the quadratic Bezier curve or the cubic Bezier curve provided by the canvas (such as quadraticCurveTo or bezierCurveTo), and further draw the coordinates of all subsequent points in sequence to restore the trajectory input by the user to the canvas.

[0068] In the prior art, regardless of whether the user's writing speed changes, the line width of the restored writing trajectory will not change. On the one hand, this method does not calculate the writing speed based on the coordinate spacing input by the user, resulting in a large difference between the determined writing trajectory and the actual writing trajectory of the user; on the other hand, the use of the canvas native API cannot realize the setting of floating-point line width. Therefore, the restored writing trajectory cannot achieve continuous change in line width.

[0069] It should be noted that canvas is an element of HTML5, which can be used to draw graphics using JavaScript scripts. HTML5 is the specification of HTML, the core language of the Web. HTML5 inherits some features of HTML and adds many new grammatical features, such as semantic features, local storage features, device compatibility features, connection features, and web multimedia features. In addition, HTML5 also defines the specific details of handling illegal documents, so that all browsers and client programs can handle grammatical errors consistently.

[0070] In addition, the native canvas API (application programming interface) provides a method for drawing quadratic Bezier curves (such as quadraticCurveTo). By calling this method, you can draw a Bezier curve path; its parameters are the control point coordinates and the end point coordinates. Among them, quadraticCurveTo and bezierCurveTo are both methods for adding a quadratic curve to the current path. In addition, the native canvas API also provides a method for filling a closed path with color, through which you can fill the drawn path with a specified color.

[0071] In this example implementation, the traditional way of drawing by computer is to draw the path of the line by manipulating the mouse, but the line drawn by manipulating the mouse is not good. Drawing with the Bezier tool can optimize this problem to a certain extent. The Bezier curve used in the Bezier tool can also be called a Bezier curve or a Bezier curve, which is mainly used for mathematical curves in two-dimensional graphics applications. It consists of a starting point, an end point and a control point. By adjusting the control point, the shape of the drawn Bezier curve can be changed. Usually, vector graphics software can accurately draw the required curve through the Bezier curve.

[0072] Among them, according to the number of control points, the Bezier curve can be divided into a first-order Bezier curve including two control points, a second-order Bezier curve including three control points, a third-order Bezier curve including four control points, and an n-order Bezier curve including n+1 control points; wherein n is a positive integer.

[0073] Specifically, the expression corresponding to the first-order Bezier curve is:

[0074] B(t)=(1-t)P0+tP1, t∈[0,1]

[0075] The expression corresponding to the second-order Bezier curve is:

[0076] B(t)=(1-t) 2 P0+2t(1-t)P1+t 2 P2, t∈[0,1]

[0077] The expression corresponding to the third-order Bezier curve is:

[0078] B9t)=(1-t) 3 P0+3t(1-t) 2 P1+3t 2 91-t)P2+t 3 P3, t∈[0,1]

[0079] n-order Bezier curve

[0080]

[0081] Wherein, i is a positive integer.

[0082] In addition, it should be noted that the curve in the embodiment of the present disclosure can be drawn by the above-mentioned second-order Bezier curve expression. Optionally, the embodiment of the present disclosure can also determine four input points to draw the output curve using the above-mentioned third-order Bezier curve; or, the embodiment of the present disclosure can also determine five input points to draw the output curve using the above-mentioned fourth-order Bezier curve; or, the embodiment of the present disclosure can also determine six input points to draw the output curve using the above-mentioned fifth-order Bezier curve. Similarly, the embodiment of the present disclosure can also determine n+1 input points to draw the output curve using the above-mentioned n-order Bezier curve. The embodiment of the present disclosure is not limited; wherein n is a positive integer.

[0083] See also Figure 1 This exemplary embodiment provides a method for simulating a writing trajectory on a terminal device. The method for simulating a writing trajectory on a terminal device can be applied to the above-mentioned server 105, and can also be applied to one or more of the above-mentioned terminal devices 101, 102, and 103, which is not particularly limited in this exemplary embodiment. Figure 3 As shown, the method for simulating a writing trajectory on a terminal device may include the following steps S310 to S340:

[0084] Step S310: determine a first midpoint between the first input point and the second input point, and determine a second midpoint between the second input point and the third input point; wherein the detection time of the first input point is earlier than that of the second input point, and the detection time of the second input point is earlier than that of the third input point.

[0085] Step S320: determining a first line width according to the first input point and the second input point, and determining a second line width according to the second input point and the third input point.

[0086] Step S330: determining the point to be connected according to the first line width, the second line width, the first midpoint and the second midpoint.

[0087] Step S340: Draw a quadrilateral according to the points to be connected and determine the curve to be output according to the quadrilateral.

[0088] It should be noted that there is no sequence relationship between step S310 and step S320.

[0089] Next, the above steps of this exemplary embodiment are described in more detail.

[0090] In step S310, a first midpoint between the first input point and the second input point is determined, and a second midpoint between the second input point and the third input point is determined; wherein the detection time of the first input point is earlier than that of the second input point, and the detection time of the second input point is earlier than that of the third input point.

[0091] In this example implementation, the first input point, the second input point and the third input point may be acquired by the terminal device through detecting a user touch operation, or may be acquired by the terminal device through detecting a cursor movement, and the embodiments of the present disclosure are not limited thereto.

[0092] In this example implementation, the method of determining the first midpoint between the first input point and the second input point, and determining the second midpoint between the second input point and the third input point may specifically be:

[0093] Collecting a first input point, a second input point, and a third input point;

[0094] Determine the coordinates corresponding to the first input point, the second input point, and the third input point respectively;

[0095] A first midpoint between the first input point and the second input point, and a second midpoint between the second input point and the third input point are determined according to the coordinates corresponding to the first input point, the second input point and the third input point, respectively; wherein the first midpoint and the second midpoint have corresponding coordinates.

[0096] In this example implementation, the first input point, the second input point, and the third input point are continuous input points.

[0097] The present disclosure can be implemented based on canvas in HTML5, and the native methods of canvas are packaged to expose the same API as canvas. The specific calling method is as follows:

[0098]

[0099]

[0100] Where canvas is the canvas element declared in HTML. points is the coordinate array corresponding to all points entered by the user.

[0101] Specifically, the canvas element can be obtained from HTML, and the canvas element can be used to instantiate a drawing object (Drawer). Then, the relevant events of the mouse operation on the canvas element can be monitored, and the monitoring of the trigger event can be added for the terminal (such as the mobile terminal), such as the touchend event, the touchmove event, the touchstart event, and the touchcancel event to obtain the user's input content. When the user is writing, the mouse press (i.e., the mousedown event in the code) can be triggered, and then the user can move the drawing focus to the starting point coordinates by controlling the drawing focus movement (i.e., the moveTo method in the code); then, the user can press and move the mouse to trigger the mouse move (mousemove) event. Each time the event is triggered, the coordinates of the acquired points can be recorded in an array. If the length of the array storing the coordinates of the points is greater than 6, the drawing starts, and the first midpoint coordinates of the first point and the second point, and the second midpoint coordinates of the second point and the third point are obtained by calculation. The calculated first midpoint coordinates are used as the starting point, the second midpoint coordinates are used as the end point, and the second point is used as the control point to draw a quadratic Bezier curve.

[0102] In this example implementation, optionally, the canvas can be enlarged 10 times (or 100 times) and its width and height can be reduced 10 times through the style attribute of the cascading style sheet, so that the method of setting the line width provided by the canvas natively supports line widths accurate to 1 (or 2) decimal places. It should be noted that Cascading Style Sheets (CSS) is a computer language used to express file styles such as HTML or XML (a subset of the standard generalized markup language). CSS can not only modify web pages statically, but also dynamically format various elements of web pages in conjunction with various scripting languages. In addition, style is a tag in CSS, and the style tag supports global attributes and event attributes in HTML.

[0103] In step S320, a first line width is determined according to the first input point and the second input point, and a second line width is determined according to the second input point and the third input point.

[0104] In this example implementation, the line width may be understood as the width of the user's writing track.

[0105] In this example implementation, determining the first line width according to the first input point and the second input point, and determining the second line width according to the second input point and the third input point includes:

[0106] determining a first input speed from the first input point to the second input point according to a detection time of the first input point and a detection time of the second input point;

[0107] determining a second input speed from the second input point to the third input point according to the detection time of the second input point and the detection time of the third input point;

[0108] A first line width is determined according to a first input speed and a second line width is determined according to a second input speed.

[0109] In this exemplary embodiment, the first line width and the second line width belong to a preset line width range, and the preset line width range includes a maximum line width and a minimum line width. It can be understood that the first line width and the second line width are not greater than the maximum line width and not less than the minimum line width.

[0110] It can be seen that the implementation of this optional implementation mode can make the line width change accordingly with the writing speed, thereby improving the user's writing effect and the user's writing experience.

[0111] In step S330, a point to be connected is determined according to the first line width, the second line width, the first midpoint and the second midpoint.

[0112] In this example implementation, determining the point to be connected according to the first line width, the second line width, the first midpoint, and the second midpoint includes:

[0113] Dividing the first midpoint into a first to-be-connected point and a second to-be-connected point according to the first line width, the distance between the first to-be-connected point and the second to-be-connected point being the first line width, and the first midpoint being located on a connecting line between the first to-be-connected point and the second to-be-connected point;

[0114] The second midpoint is divided into a third point to be connected and a fourth point to be connected according to the second line width, the distance between the third point to be connected and the fourth point to be connected is the second line width, and the second midpoint is located on the connecting line between the third point to be connected and the fourth point to be connected.

[0115] In this example implementation, the method of dividing the first midpoint into the first to-be-connected point and the second to-be-connected point according to the first line width may specifically be: the first to-be-connected point and the second to-be-connected point are calculated according to the first line width and the coordinates of the first midpoint. In addition, the method of dividing the second midpoint into the third to-be-connected point and the fourth to-be-connected point according to the second line width may specifically be: the third to-be-connected point and the fourth to-be-connected point are calculated according to the second line width and the coordinates of the second midpoint. The first to-be-connected point, the second to-be-connected point, the third to-be-connected point, and the fourth to-be-connected point have corresponding coordinates, respectively.

[0116] In this example implementation, the first line width and the second line width may be the same or different, and the embodiments of the present disclosure are not limited thereto.

[0117] In this example implementation, optionally, the algorithm for determining the line width may also be:

[0118]

[0119]

[0120] Among them, this._setLineWidthBySpeed ​​is used to indicate that the distance is calculated based on the current coordinates and the coordinates of the previous input point, and the current line width is set based on the distance.

[0121] It can be seen that by implementing this optional implementation, the curve to be output can be determined according to the determined quadrilateral, so as to realize the drawing of floating-point line segments.

[0122] In step S340, a quadrilateral is drawn according to the points to be connected and a curve to be output is determined according to the quadrilateral.

[0123] In this example implementation, the following steps may also be included:

[0124] If at least three input points are not detected within the preset time, it is determined that the user input is complete and the process ends.

[0125] In this example implementation, drawing a quadrilateral according to the points to be connected includes:

[0126] A quadrilateral is obtained by connecting the first to-be-connected point, the second to-be-connected point, the third to-be-connected point and the fourth to-be-connected point through a Bezier curve.

[0127] In this example implementation, the method of connecting the first to-be-connected point, the second to-be-connected point, the third to-be-connected point, and the fourth to-be-connected point by using the Bezier curve may specifically be:

[0128] The first point to be connected, the second point to be connected, the third point to be connected, and the fourth point to be connected are connected in a clockwise order through a Bezier curve; or, the first point to be connected, the second point to be connected, the third point to be connected, and the fourth point to be connected are connected in a counterclockwise order through a Bezier curve, and the embodiments of the present disclosure are not limited thereto.

[0129] In this example implementation, the drawing class corresponding to drawing a quadratic Bezier curve is as follows:

[0130]

[0131] Among them, this._scale is used to indicate the canvas scaling ratio to improve the canvas rendering clarity; this.canvas is used to temporarily store the canvas in the form of attributes; this.ctx refers to the canvas drawing context; this._x refers to the x coordinate corresponding to the final position of the last drawing (e.g., the position corresponding to the third input point mentioned above); this._y refers to the y coordinate of the final position of the last drawing (e.g., the position corresponding to the third input point mentioned above). The above drawing class accepts a canvas element as a parameter, records the width and height of the canvas during the instantiation phase, and obtains the canvas drawing context.

[0132] In this example implementation, the algorithm for drawing a quadratic Bezier curve is as follows:

[0133]

[0134]

[0135]

[0136] Among them, this.quadraticCurveTo is used to indicate that a Bezier curve is formed by drawing Bezier curves on both sides, and the width of the Bezier curve is adjusted by floating-point type; this.stroke is used to indicate filling the area enclosed by the Bezier curve; this._getPositions is used to indicate the offset coordinates of the point with the specified line width determined according to the original coordinates; this.moveTo is used to indicate moving the starting position of the drawn trajectory to the specified coordinates.

[0137] Specifically, the quadraticCurveTo method simulates the parameter form of the native quadraticCurveTo method of canvas, but internally decomposes the two known points into four points through the _getPositions method, and then uses the native quadraticCurveTo method to enclose the four calculated points into a closed quadrilateral. Then, when drawing is required, the stroke method is called, and the fill method of canvas is called in the stroke to fill the closed quadrilateral area above, thereby achieving the drawing of floating-point line widths.

[0138] It can be seen that implementing this optional implementation can reduce the difference between the determined writing trajectory and the actual writing trajectory of the user, and improve the effect of the determined writing trajectory.

[0139] In this example implementation, determining the curve to be output according to the quadrilateral includes:

[0140] The quadrilateral is filled with color according to a preset mapping rule, and the curve to be output is determined according to the quadrilateral filled with color.

[0141] In this example implementation, the method of determining the curve to be output based on the color-filled quadrilaterals is specifically: multiple filled quadrilaterals corresponding to the user input are spliced ​​to obtain the curve to be output. In addition, after the curve to be output is obtained, the curve to be output can also be displayed on a display screen, and further, the curve to be output can also be output through preset special effects (such as pop-up, floating, changing from small to large, etc.), which is not limited in the embodiments of the present disclosure.

[0142] In this example implementation, when the user performs a writing operation, the terminal device can detect multiple input points. Since every three consecutive input points correspond to one of the above-mentioned quadrilaterals, the user's writing operation can correspond to multiple quadrilaterals. The output curve (i.e., the user writing trajectory) obtained after filling and splicing each quadrilateral can include one or more colors (i.e., there can be quadrilaterals with different filling colors), which is not limited to the embodiments of the present disclosure.

[0143] In this example implementation, the preset mapping rule is used to represent the correspondence between the border color of the quadrilateral and the color to be filled. The preset mapping rule can be set to: the border color is the same as the filling color. For example, if the border color of the quadrilateral is black, then according to the preset mapping rule, it can be determined that the color to be filled is also black. The preset mapping rule can be a user-defined rule or a rule that is automatically read from a color database and automatically binds the mapping relationship, which is not limited in the embodiments of the present disclosure.

[0144] It can be seen that by implementing this optional implementation, the curve to be output can be determined according to the determined quadrilateral, so as to realize the drawing of floating-point line segments.

[0145] It can be seen that implementation Figure 3 The method shown for simulating writing trajectory on a terminal device can, to a certain extent, overcome the problem of large differences between the determined writing trajectory and the actual writing trajectory of the user, so as to improve the effect of the determined writing trajectory; and can determine the curve to be output based on the determined quadrilateral to realize the drawing of floating-point line segments; and can calculate the line width through the user's input points to realize the continuous change of the line width during the writing restoration process.

[0146] See also Figure 4 , Figure 4 A schematic diagram of determining a point to be connected according to a first line width, a second line width, a first midpoint, and a second midpoint according to an embodiment of the present disclosure is schematically shown. Figure 4 The invention comprises a first quadrilateral drawing diagram and a second quadrilateral drawing diagram; wherein the first quadrilateral drawing diagram comprises a quadrilateral, a first midpoint P1 and a second midpoint P2; and the second quadrilateral drawing diagram comprises a quadrilateral, a first point to be connected P1-1, a second point to be connected P1-2, a third point to be connected P2-1 and a fourth point to be connected P2-2. Specifically, the first midpoint P1 can be divided into the first point to be connected P1-1 and the second point to be connected P1-2 according to the first line width, and the second midpoint P2 can be divided into the third point to be connected P2-1 and the fourth point to be connected P2-2 according to the second line width. Furthermore, the quadrilateral in the second quadrilateral drawing diagram can be drawn and filled according to the first point to be connected P1-1, the second point to be connected P1-2, the third point to be connected P2-1 and the fourth point to be connected P2-2. Compared with the quadrilateral drawn and filled according to the first midpoint P1 and the second midpoint P2 in the first quadrilateral drawing diagram, the continuous change of line width in the process of restoring the user's writing can be achieved to a certain extent.

[0147] Combination Figure 4 FIG. 1 is a schematic diagram showing an embodiment of determining a point to be connected according to a first line width, a second line width, a first midpoint and a second midpoint. Figure 5 , Figure 5A schematic diagram of determining the points to be connected based on the first line width, the second line width, the first midpoint and the second midpoint according to another embodiment of the present disclosure is schematically shown. Specifically, first, the first midpoint P1 between the first input point and the second input point, and the second midpoint P2 between the second input point and the third input point can be determined, and the first line width W1 can be determined based on the first input point and the second input point, and the second line width W2 can be determined based on the second input point and the third input point. The first midpoint P1 can be divided into the first point to be connected P1-1 and the second point to be connected P1-2 based on the first line width W1, and the second midpoint P2 can be divided into the third point to be connected P2-1 and the fourth point to be connected P2-2 based on the second line width W2. Furthermore, the first point to be connected P1-1, the second point to be connected P1-2, the third point to be connected P2-1 and the fourth point to be connected P2-2 can be connected in sequence in a clockwise order to obtain a quadrilateral. According to multiple user input points, every three consecutive input points correspond to a quadrilateral. Then, after filling and splicing the multiple quadrilaterals, a curve to be output can be obtained. The curve to be output can be a simulated user writing trajectory.

[0148] Combination Figure 5 FIG. 1 is a schematic diagram of another embodiment of determining a point to be connected according to a first line width, a second line width, a first midpoint, and a second midpoint. Figure 6 , Figure 6 The following schematically shows a comparison diagram of a curve to be output according to an embodiment of the present disclosure. Figure 6 As shown, Figure 601 is a traditional curve to be output (i.e., the user writing trajectory) that is not drawn according to the line width, and Figure 602 is a curve to be output (i.e., the user writing trajectory) drawn according to an embodiment of the present disclosure. By comparing Figure 601 and Figure 602, it can be seen that the curve to be output drawn according to the embodiment of the present disclosure can make the line width change accordingly with the writing speed, thereby improving the user's writing effect and improving the user's writing experience.

[0149] See also Figure 7 , Figure 7 The flowchart of a method for simulating a writing trajectory on a terminal device according to another embodiment of the present disclosure is schematically shown. Figure 7 As shown, the method for simulating a writing trajectory on a terminal device may include the following steps S700 to S790:

[0150] Step S700: Detect user input.

[0151] Step S710: Detect whether there are at least three input points: a first input point, a second input point and a third input point. If yes, execute step S720; if not, execute step S770.

[0152] Step S720: Determine the coordinates corresponding to the first input point, the second input point, and the third input point respectively.

[0153] Step S730: determining a first midpoint between the first input point and the second input point, and determining a second midpoint between the second input point and the third input point.

[0154] Step S740: determining a first line width according to the coordinates of the first input point and the coordinates of the second input point, and determining a second line width according to the coordinates of the second input point and the coordinates of the third input point.

[0155] Step S750: Determine a first to-be-connected point, a second to-be-connected point, a third to-be-connected point, and a fourth to-be-connected point according to the first line width, the second line width, the first midpoint, and the second midpoint.

[0156] Step S760: Connect the first to-be-connected point, the second to-be-connected point, the third to-be-connected point and the fourth to-be-connected point through a Bezier curve to obtain a quadrilateral and fill the quadrilateral with color.

[0157] Step S770: Read the next input point.

[0158] Step S780: Detect whether the next input point is the last input point, if yes, execute step S790; if no, execute step S710.

[0159] Step S790: End drawing.

[0160] Specifically, the user input can be detected, and the detection method can be: collect the user touch point (or user input point) every preset time. Then, it can be detected whether there are at least three input points, that is, the first input point, the second input point and the third input point; if there are, the coordinates corresponding to the first input point, the second input point and the third input point are determined, if not, the next input point is read until three consecutive input points are detected. Then, the first midpoint between the first input point and the second input point can be determined, and the second midpoint between the second input point and the third input point can be determined, and the first line width is determined according to the coordinates of the first input point and the coordinates of the second input point, and the second line width is determined according to the coordinates of the second input point and the coordinates of the third input point, so as to determine four waiting waiting points according to the first line width, the second line width, the first midpoint and the second midpoint. Then, the first waiting point, the second waiting point, the third waiting point and the fourth waiting point can be connected by a Bezier curve to obtain a quadrilateral and fill the quadrilateral with color. When it is detected that the input point read is the last input point, it is determined that the user's writing operation stops and the drawing ends.

[0161] Visible, combined Figure 4 to Figure 7By implementing the embodiments of the present disclosure, it is possible to overcome, to a certain extent, the problem of large differences between the determined writing trajectory and the actual writing trajectory of the user, so as to improve the effect of the determined writing trajectory; and it is possible to determine the curve to be output based on the determined quadrilateral, so as to realize the drawing of floating-point line segments; and it is possible to calculate the line width through the user's input points, so as to realize the continuous change of the line width during the writing restoration process.

[0162] Furthermore, in this exemplary embodiment, a device for simulating a writing track on a terminal device is also provided. The device for simulating a writing track on a terminal device can be applied to a server or a terminal device. Figure 8 As shown, the apparatus 800 for simulating a writing trajectory on a terminal device may include a midpoint determination unit 801, a line width determination unit 802, a connection point determination unit 803, and a curve drawing unit 804, wherein:

[0163] A midpoint determination unit 801 is used to determine a first midpoint between a first input point and a second input point, and to determine a second midpoint between the second input point and a third input point; wherein the first input point is detected earlier than the second input point, and the second input point is detected earlier than the third input point;

[0164] A line width determination unit 802, configured to determine a first line width according to a first input point and a second input point, and to determine a second line width according to a second input point and a third input point;

[0165] A connection point determination unit 803, configured to determine a to-be-connected point according to the first line width, the second line width, the first midpoint, and the second midpoint;

[0166] The curve drawing unit 804 is used to draw a quadrilateral according to the points to be connected and determine the curve to be output according to the quadrilateral.

[0167] Among them, the first input point, the second input point and the third input point are continuous input points.

[0168] It can be seen that implementation Figure 8 The device shown for simulating writing trajectory on a terminal device can, to a certain extent, overcome the problem of large differences between the determined writing trajectory and the actual writing trajectory of the user, so as to improve the effect of the determined writing trajectory; and can determine the curve to be output based on the determined quadrilateral to realize the drawing of floating-point line segments; and can calculate the line width through the user's input points to realize the continuous change of the line width during the writing restoration process.

[0169] In an exemplary embodiment of the present disclosure, the curve drawing unit 804 determines the curve to be output according to the quadrilateral in the following manner:

[0170] The curve drawing unit 804 fills the quadrilateral with color according to a preset mapping rule, and determines the curve to be output according to the quadrilateral after the color filling.

[0171] It can be seen that by implementing this exemplary embodiment, the curve to be output can be determined according to the determined quadrilateral, so as to realize the drawing of floating-point line segments.

[0172] In an exemplary embodiment of the present disclosure, the line width determining unit 802 determines the first line width according to the first input point and the second input point, and determines the second line width according to the second input point and the third input point in a manner as follows:

[0173] The line width determination unit 802 determines a first input speed from the first input point to the second input point according to the detection time of the first input point and the detection time of the second input point;

[0174] The line width determination unit 802 determines a second input speed from the second input point to the third input point according to the detection time of the second input point and the detection time of the third input point;

[0175] The line width determining unit 802 determines a first line width according to a first input speed and determines a second line width according to a second input speed.

[0176] The first line width and the second line width belong to a preset line width range, and the preset line width range includes a maximum line width and a minimum line width.

[0177] It can be seen that the implementation of this exemplary embodiment can make the line width change accordingly with the writing speed, thereby improving the user's writing effect and the user's writing experience.

[0178] In an exemplary embodiment of the present disclosure, the connection point determining unit 803 determines the to-be-connected point according to the first line width, the second line width, the first midpoint, and the second midpoint in the following manner:

[0179] The connection point determination unit 803 divides the first midpoint into a first to-be-connected point and a second to-be-connected point according to the first line width, the distance between the first to-be-connected point and the second to-be-connected point is the first line width, and the first midpoint is located on the connection line between the first to-be-connected point and the second to-be-connected point;

[0180] The connection point determination unit 803 divides the second midpoint into a third to-be-connected point and a fourth to-be-connected point according to the second line width, the distance between the third to-be-connected point and the fourth to-be-connected point is the second line width, and the second midpoint is located on the connection line between the third to-be-connected point and the fourth to-be-connected point.

[0181] It can be seen that by implementing this optional embodiment, the curve to be output can be determined according to the determined quadrilateral, so as to realize the drawing of floating-point line segments.

[0182] In an exemplary embodiment of the present disclosure, the curve drawing unit 804 may draw a quadrilateral according to the points to be connected in the following manner:

[0183] The curve drawing unit 804 connects the first to-be-connected point, the second to-be-connected point, the third to-be-connected point and the fourth to-be-connected point through a Bezier curve to obtain a quadrilateral.

[0184] It can be seen that the implementation of this optional embodiment can reduce the difference between the determined writing trajectory and the actual writing trajectory of the user, and improve the effect of the determined writing trajectory.

[0185] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0186] Since the various functional modules of the apparatus for simulating writing trajectories on a terminal device in the example embodiment of the present disclosure correspond to the steps of the example embodiment of the method for simulating writing trajectories on a terminal device described above, for details not disclosed in the apparatus embodiment of the present disclosure, please refer to the embodiment of the method for simulating writing trajectories on a terminal device described above in the present disclosure.

[0187] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

[0188] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0189] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0190] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0191] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0192] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for simulating a writing trajectory on a terminal device, characterized in that: include: Collecting coordinates of a first input point, a second input point, and a third input point generated in sequence by a writing operation on the terminal device; Determine the coordinates of a first midpoint between the first input point and the second input point according to the coordinates of the first input point and the coordinates of the second input point, and determine the coordinates of a second midpoint between the second input point and the third input point according to the coordinates of the second input point and the coordinates of the third input point; Determine a corresponding first line width according to a first input speed from the first input point to the second input point, and determine a corresponding second line width according to a second input speed from the second input point to the third input point; Generate a first to-be-connected point and a second to-be-connected point located on both sides of the first midpoint according to the first line width and the coordinates of the first midpoint; and generate a third to-be-connected point and a fourth to-be-connected point located on both sides of the second midpoint according to the second line width and the coordinates of the second midpoint; A quadrilateral is drawn according to the first point to be connected, the second point to be connected, the third point to be connected and the fourth point to be connected, and a curve to be output is determined according to the quadrilateral, and the curve to be output is output as a simulated writing trajectory.

2. The method according to claim 1, characterized in that Determining a curve to be output according to the quadrilateral includes: The quadrilateral is filled with color according to a preset mapping rule, and a curve to be output is determined according to the quadrilateral filled with color.

3. The method according to claim 1, characterized in that The first input point, the second input point and the third input point are continuous input points.

4. The method according to claim 1, characterized in that Determining a corresponding first line width according to a first input speed from the first input point to the second input point, and determining a corresponding second line width according to a second input speed from the second input point to the third input point, comprises: determining a first input speed from the first input point to the second input point according to a detection time of the first input point and a detection time of the second input point; determining a second input speed from the second input point to the third input point according to the detection time of the second input point and the detection time of the third input point; A first line width corresponding to the first input speed is determined according to the first input speed, and a second line width corresponding to the second input speed is determined according to the second input speed.

5. The method according to claim 4, characterized in that The first line width and the second line width belong to a preset line width range, and the preset line width range includes a maximum line width and a minimum line width.

6. The method according to claim 1, characterized in that Generating a first to-be-connected point and a second to-be-connected point located on both sides of the first midpoint according to the first line width and the coordinates of the first midpoint, including: A first point to be connected and a second point to be connected are generated on both sides of the first midpoint according to the first line width, the distance between the first point to be connected and the second point to be connected is the first line width, and the first midpoint is located on the connecting line between the first point to be connected and the second point to be connected.

7. The method according to claim 1, characterized in that Generating a third to-be-connected point and a fourth to-be-connected point located on both sides of the second midpoint according to the second line width and the coordinates of the second midpoint, including: A third point to be connected and a fourth point to be connected are generated on both sides of the second midpoint according to the second line width, the distance between the third point to be connected and the fourth point to be connected is the second line width, and the second midpoint is located on the connecting line between the third point to be connected and the fourth point to be connected.

8. The method according to claim 1, characterized in that Drawing a quadrilateral according to the first to-be-connected point, the second to-be-connected point, the third to-be-connected point, and the fourth to-be-connected point includes: The first to-be-connected point, the second to-be-connected point, the third to-be-connected point and the fourth to-be-connected point are connected by a Bezier curve to obtain a quadrilateral.

9. The method according to claim 8, characterized in that Connecting the first to-be-connected point, the second to-be-connected point, the third to-be-connected point, and the fourth to-be-connected point through a Bezier curve includes: connecting the first to-be-connected point, the second to-be-connected point, the third to-be-connected point and the fourth to-be-connected point in a clockwise order by using a Bezier curve; or The first to-be-connected point, the second to-be-connected point, the third to-be-connected point and the fourth to-be-connected point are sequentially connected in a counterclockwise order by using a Bezier curve.

10. A device for simulating writing tracks on a terminal device, characterized in that: include: a midpoint determination unit, configured to collect coordinates of a first input point, a second input point, and a third input point sequentially generated by a writing operation on the terminal device; determine the coordinates of a first midpoint between the first input point and the second input point according to the coordinates of the first input point and the coordinates of the second input point, and determine the coordinates of a second midpoint between the second input point and the third input point according to the coordinates of the second input point and the coordinates of the third input point; a line width determination unit, configured to determine a corresponding first line width according to a first input speed from the first input point to the second input point, and to determine a corresponding second line width according to a second input speed from the second input point to the third input point; a connection point determination unit, configured to generate a first to-be-connected point and a second to-be-connected point located on both sides of the first midpoint according to the first line width and the coordinates of the first midpoint; and to generate a third to-be-connected point and a fourth to-be-connected point located on both sides of the second midpoint according to the second line width and the coordinates of the second midpoint; A curve drawing unit is used to draw a quadrilateral based on the first point to be connected, the second point to be connected, the third point to be connected and the fourth point to be connected, and determine the curve to be output based on the quadrilateral, and output the curve to be output as a simulated writing trajectory.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

12. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 9 by executing the executable instructions.

13. A computer program product, characterized in that The computer program product comprises a computer program, wherein the computer program is stored in a computer-readable storage medium, and a processor of an electronic device reads and executes the computer program from the computer-readable storage medium, so that the electronic device executes the method according to any one of claims 1 to 9.