Handwriting drawing method, device, electronic device, medium and program product

By creating buffered canvas and display canvas in electronic devices, obtaining and processing parameter information of touch track points, and forming and drawing handwriting, the problems of poor depth and slow drawing speed in the prior art are solved, and efficient and convenient handwriting drawing effect.

CN114041111BActive Publication Date: 2025-02-18BOE TECHNOLOGY GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202080000778.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-20
Publication Date
2025-02-18
Estimated Expiration
2040-05-20

AI Technical Summary

Technical Problem

The handwriting drawing schemes of existing electronic devices cannot efficiently and conveniently present the different depths of the handwriting, resulting in differences between the drawn handwriting and the real handwriting, and the drawing speed is slow and there is a lag.

Method used

By creating a buffered canvas and display canvas in an electronic device, obtain parameter information of multiple touch track points, determine the position, size and transparency of the track points based on these parameter information, form a handwriting, and draw the handwriting on the buffered canvas and draw it. onto the display canvas.

Benefits of technology

It realizes the efficient and convenient presentation of different depths of handwriting on electronic devices, making the drawn handwriting closer to the real handwriting, and improves the drawing speed and reduces lag.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114041111B_ABST
    Figure CN114041111B_ABST
Patent Text Reader

Abstract

The present disclosure provides a handwriting drawing method for an electronic device, comprising: creating a buffer canvas and a display canvas in the electronic device; sequentially acquiring parameter information of multiple touch trajectory points, the parameter information including touch time, touch position parameter and sensing parameter; and performing drawing processing for each of the multiple touch trajectory points. For each touch trajectory point, based on the parameter information of the touch trajectory point and a predetermined number of touch trajectory points whose touch time is later than the touch trajectory point, determine the position parameters, size and transparency of each of the multiple trajectory points to be displayed. Based on the position parameters, size and transparency of each of the multiple trajectory points, first draw the handwriting on the buffer canvas, and then draw the handwriting on the buffer canvas on the display canvas, so that the electronic device displays the display canvas. The present disclosure also provides a handwriting drawing device for an electronic device, an electronic device, a medium and a program product.
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 handwriting drawing method for an electronic device and a device thereof, an electronic device, a medium, and a program product. Background Art

[0002] Generally, the handwriting drawing scheme used in electronic devices can present different thicknesses of handwriting according to the user's touch operation, but cannot efficiently and conveniently present different depths of handwriting. The drawn handwriting is different from the user's real handwriting, or the operation is not efficient and convenient enough. In addition, when drawing handwriting, the system of the electronic device draws the next section of handwriting after the previous section of handwriting is drawn, and the drawing speed is relatively slow. Summary of the invention

[0003] The embodiments of the present disclosure provide a handwriting drawing method for an electronic device, a device thereof, an electronic device, a medium, and a program product.

[0004] According to one aspect of an embodiment of the present disclosure, a handwriting drawing method for an electronic device is provided, comprising: creating a buffer canvas and a display canvas in the electronic device; obtaining parameter information of multiple touch trajectory points, the parameter information comprising: touch moment, touch position parameter and sensing parameter; and performing drawing processing on each of the multiple touch trajectory points. The drawing processing on each touch trajectory point comprises: determining the position parameters, size and transparency of each of the multiple trajectory points to be displayed based on the touch position parameters and sensing parameters of the touch trajectory point and a predetermined number of touch trajectory points whose touch moments are later than the touch moment of the touch trajectory point among the multiple touch trajectory points, wherein the multiple trajectory points constitute the handwriting for the touch trajectory point. Then, based on the position parameters, size and transparency of each of the multiple trajectory points, the handwriting is first drawn on the buffer canvas, and then the handwriting on the buffer canvas is drawn on the display canvas, so that the electronic device displays the display canvas.

[0005] For example, the above-mentioned drawing of the handwriting on the buffer canvas on the display canvas includes: obtaining a first selection box and a second selection box. Using the area of ​​the buffer canvas containing the handwriting as the current selection content of the first selection box; determining whether the previous selection content of the second selection box is empty. If so, using the current selection content of the first selection box as the current selection content of the second selection box. If not, drawing the previous selection content of the second selection box on the display canvas.

[0006] For example, the above-mentioned drawing of the handwriting on the buffer canvas on the display canvas further includes: after drawing the last selected content of the second selection box on the display canvas, determining whether there is an overlapping area between the last selected content of the second selection box and the current selected content of the first selection box. If there is an overlapping area, setting the transparency of the overlapping area in the current selected content of the first selection box so that the transparency of the overlapping area is a predetermined value, and using the current selected content of the first selection box with the transparency set as the current selected content of the second selection box.

[0007] For example, the above-mentioned drawing of the handwriting on the buffer canvas on the display canvas also includes: if there is no overlapping area, using the current selection content of the first selection box as the current selection content of the second selection box.

[0008] For example, the buffer canvas and the display canvas have the same height, and the buffer canvas and the display canvas have the same width. The last selected content of the second selection box includes: the selected image targeted by the last selected content and the position parameters of the selected image in the buffer canvas. Drawing the last selected content of the second selection box on the display canvas includes: drawing the selected image on the display canvas according to the position parameters of the selected image in the buffer canvas.

[0009] For example, the above-mentioned using the area containing handwriting in the buffer canvas as the current selection content of the first selection box includes: after determining that the previous selection content of the first selection box has been used as the previous selection content of the second selection box, using the area containing the above handwriting as the current selection content of the first selection box.

[0010] For example, the above-mentioned determination of the position parameters, size and transparency of the plurality of track points based on the touch track point and the touch position parameters and sensing parameters of the predetermined number of touch track points whose touch moments are later than the touch moment of the touch track point includes: fitting a curve based on the touch track point and the touch position parameters and sensing parameters of the predetermined number of touch track points, and determining the position parameters and sensing parameters of the plurality of points on the curve. The determined position parameters of the plurality of points are used as the position parameters of the plurality of track points, and the sizes and transparency of the plurality of track points are determined based on the determined sensing parameters of the plurality of points.

[0011] For example, the above-mentioned fitting curve and determining the position parameters and sensing parameters of each of the multiple points on the curve include: determining the position parameters and sensing parameters of the starting point, the control point, and the end point based on the parameter information of the touch trajectory point and the touch position parameters and sensing parameters of the next two touch trajectory points whose touch moments are later than the touch moment of the touch trajectory point. Determine the second-order Bezier curve equation for the position parameters of the starting point, the control point, and the end point. Determine the position parameters of each of the multiple points based on the second-order Bezier curve equation, and determine the sensing parameters of each of the multiple points based on the second-order Bezier curve equation, the sensing parameters of the starting point, the control point, and the end point.

[0012] For example, the touch position parameter of the touch trajectory point includes the position parameter of the center point of the touch trajectory point, and the sensing parameter of the touch trajectory point includes: the sensing parameter of the center point of the touch trajectory point. The above-mentioned determination of the position parameters and sensing parameters of the starting point, the control point and the end point based on the parameter information of the touch trajectory point and the parameter information of the two subsequent touch trajectory points of the touch trajectory point includes: calculating the position parameter and sensing parameter of the midpoint of the line between the touch trajectory point and the first subsequent touch trajectory point according to the parameter information of the touch trajectory point and the parameter information of the first subsequent touch trajectory point of the touch trajectory point, as the position parameter and sensing parameter of the starting point. The position parameter and sensing parameter of the center point of the first subsequent touch trajectory point are used as the position parameter and sensing parameter of the control point. The position parameter and sensing parameter of the midpoint of the line between the first subsequent touch trajectory point and the second subsequent touch trajectory point are calculated according to the parameter information of the first subsequent touch trajectory point of the touch trajectory point and the parameter information of the second subsequent touch trajectory point of the touch trajectory point, as the position parameter and sensing parameter of the end point.

[0013] For example, the determining of the size and transparency of each of the plurality of track points based on the sensing parameters of each of the plurality of points includes: presetting a first mapping table and a second mapping table. For each of the plurality of points, according to the first mapping table, determining a size corresponding to the sensing parameter of the point as the size of one of the plurality of track points, and according to the second mapping table, determining a transparency corresponding to the sensing parameter of the point as the transparency of the one of the track points.

[0014] For example, the sensing parameter of the touch track point includes at least one of the following: a pressure sensing value of the touch track point, a touch sliding speed of the touch track point, and a touch area of ​​the touch track point.

[0015] For example, when each of the plurality of trajectory points is circular, the size of the trajectory point is the radius of the trajectory point.

[0016] For example, the above method further includes: after acquiring the parameter information of the touch trajectory point, storing the parameter information of the touch trajectory point in a buffer area. The above determination of the position parameters, size and transparency of the plurality of trajectory points based on the parameter information of the touch trajectory point and the parameter information of the predetermined number of touch trajectory points after the touch trajectory point includes: determining the position parameters, size and transparency of the plurality of trajectory points based on the parameter information of the touch trajectory point in the buffer area and the parameter information of the predetermined number of touch trajectory points after the touch trajectory point. The above method further includes: after determining the position parameters, size and transparency of the plurality of trajectory points, deleting the parameter information of the touch trajectory point in the buffer area.

[0017] According to another aspect of an embodiment of the present disclosure, a handwriting drawing device for an electronic device is provided, comprising: a creation module, for creating a buffer canvas and a display canvas in the electronic device. An acquisition module, for sequentially acquiring parameter information of multiple touch trajectory points. And a drawing module, for performing drawing processing on each of the multiple touch trajectory points. The drawing module comprises: a determination submodule, for determining the position parameters, size and transparency of each of the multiple trajectory points based on the parameter information of the touch trajectory point and the parameter information of a predetermined number of touch trajectory points after the touch trajectory point, wherein the multiple trajectory points constitute the handwriting for the touch trajectory point. And a buffer drawing submodule, for first drawing handwriting on the buffer canvas based on the position parameters, size and transparency of each of the multiple trajectory points, and then drawing the handwriting on the buffer canvas on the display canvas, so that the electronic device can display the display canvas.

[0018] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, including: a display unit configured to receive a touch event and at least one processor configured to execute a method according to an embodiment of the present disclosure in response to the touch event, so that the display unit displays a presentation canvas.

[0019] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a memory configured to store instructions; and at least one processor, wherein the at least one processor executes the instructions stored in the memory to implement the method according to an embodiment of the present disclosure.

[0020] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the method according to the embodiment of the present disclosure is implemented.

[0021] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including executable instructions, which implement the method according to an embodiment of the present disclosure when the instructions are executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present disclosure or the traditional technical solutions, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the following figure:

[0023] Figure 1A to Figure 1B An example application scenario of the handwriting drawing method according to an embodiment of the present disclosure is schematically shown;

[0024] Figure 2A to Figure 2B A flowchart of a handwriting drawing method for an electronic device according to an embodiment of the present disclosure is schematically shown;

[0025] Figure 3 An exemplary flow chart of a handwriting drawing method for an electronic device according to another embodiment of the present disclosure is schematically shown;

[0026] Figure 4 An example diagram schematically shows a handwriting on a buffered canvas according to an embodiment of the present disclosure;

[0027] Figure 5 An example diagram schematically shows a handwriting on a buffered canvas according to another embodiment of the present disclosure;

[0028] Figure 6 An example flow chart of a handwriting drawing method for an electronic device according to another embodiment of the present disclosure is schematically shown:

[0029] Fig. 7A Schematically shows an example diagram of a first cache area and a second cache area according to an embodiment of the present disclosure;

[0030] Figure 7B Schematically shows an example diagram of a fitting curve according to an embodiment of the present disclosure;

[0031] Figure 8 A block diagram schematically shows a handwriting drawing device for an electronic device according to an embodiment of the present disclosure;

[0032] Fig. 9 A block diagram schematically shows an electronic device according to an embodiment of the present disclosure; and

[0033] Fig.10 A block diagram of an electronic device according to another embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of them. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present disclosure. It should be noted that throughout the accompanying drawings, the same elements are represented by the same or similar figure marks. In the following description, some specific embodiments are used for descriptive purposes only and should not be understood as any limitation to the present disclosure, but are only examples of the embodiments of the present disclosure. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0035] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0036] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.

[0037] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0038] Figure 1A to Figure 1B The example application scenario of the handwriting drawing method according to the embodiment of the present disclosure is schematically shown. It should be noted that: Figure 1A to Figure 1B The examples shown are merely scenarios in which the embodiments of the present disclosure can be applied, to help those skilled in the art understand the technical content of the present disclosure, but do not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.

[0039] like Figure 1A As shown, the electronic device 100 has a touch screen 110. In response to a user's touch operation (such as writing, drawing, etc.) on the touch screen 110 through a finger or an input device (such as a stylus pen, a digital pen, etc.) 120, the electronic device 110 can draw and display the handwriting corresponding to the above touch operation. For example, when the user draws a curve on the touch screen 110 using the stylus pen 120, the touch screen 110 displays the following Figure 1B The drawing strokes shown.

[0040] The electronic device 100 may include but is not limited to a smart phone, a smart tablet, a portable computer, a desktop computer, an e-book, etc. The handwriting drawing method according to the embodiment of the present disclosure can be applied to various scenarios where handwriting display is required. For example, when conducting a meeting or academic report, the user can display the corresponding handwriting on the large-screen smart tablet through writing operations, so as to display and explain the meeting content or academic program more flexibly and dynamically.

[0041] Generally, the handwriting drawing scheme used in electronic devices can present different thicknesses of handwriting according to the user's touch operation, but cannot present different depths of handwriting, which results in a large difference between the drawn handwriting and the user's real handwriting. In addition, when drawing handwriting, the next section of handwriting can only be drawn after the previous section of handwriting is completed, resulting in a slow drawing speed and lag.

[0042] According to an embodiment of the present disclosure, a handwriting drawing method for an electronic device is provided, and the method is described below. It should be noted that the sequence numbers of the steps in the following method are only used as representations of the steps for the purpose of description, and should not be regarded as representing the execution order of the steps. Unless explicitly stated, the method does not need to be executed completely in the order shown.

[0043] Figure 2A to Figure 2B The flowchart of the handwriting drawing method for an electronic device according to an embodiment of the present disclosure is schematically shown.

[0044] like Figure 2A As shown, the method may be executed by a processor and may include the following steps S210 to S230.

[0045] In step S210, a buffer canvas and a presentation canvas are created in the electronic device.

[0046] Among them, canvas belongs to HTML (Hyper Text Markup Language) elements. As a graphic container, users can use scripts to draw written content (such as written text or graphics) in the canvas. According to an embodiment of the present disclosure, the buffer canvas can be, for example, an off-screen canvas (OffscreenCanvas), which is used to cache graphic data but is not used for display on the screen of an electronic device. The display canvas is used for display on the screen of an electronic device and the user can write on the canvas. When creating a buffer canvas and a display canvas, it is necessary to initialize various properties of the buffer canvas and the display canvas, such as setting the height and width of the buffer canvas and the display canvas when they are to be displayed.

[0047] In step S220, parameter information of a plurality of touch track points is obtained.

[0048] For example, during the process of a user performing a touch operation on the screen of an electronic device, the user's finger or input device contacts the screen of the electronic device to form multiple touch areas (also called touch points), and multiple touch track points can be sampled and selected from the multiple touch areas. The multiple touch track points can be all or part of the touch points, or a combination of all the touch points and interpolation points, or a combination of part of the touch points and interpolation points. The interpolation points are not touch points, but points simulated by the system or algorithm according to the rule of equal spacing or equal time intervals of coordinates, and finally a group of touch track points (hereinafter referred to as multiple touch track points) is obtained.

[0049] The parameter information of each touch trajectory point among the multiple touch trajectory points may include, for example, one or more of the touch time when the touch trajectory point occurs (the touch time may be represented as a timestamp, for example), the touch position parameter of the touch trajectory point in the coordinate system of the screen of the display screen (the touch position parameter may be represented as a coordinate value, for example), and the sensing parameter, etc. The sensing parameter may be a parameter of various sensing quantities related to the touch operation, which will be described in detail below.

[0050] In step S230, drawing may be performed sequentially or synchronously for each of the plurality of touch track points.

[0051] For example, the implementation process of step S230 can refer to Figure 2B .like Figure 2B As shown, for each acquired touch track point (the currently selected touch track point), step S230 may include steps S231 to S232.

[0052] In step S231, based on the touch position parameters and sensing parameters of the selected current touch trajectory point and a predetermined number of touch trajectory points whose touch moments are later than the touch trajectory point among the multiple touch trajectory points, the position parameters, size and transparency of the multiple trajectory points to be displayed are determined.

[0053] According to an embodiment of the present disclosure, for a touch trajectory point, a predetermined number of touch trajectory points whose touch moments are later than the touch moment of the touch trajectory point among the above-mentioned multiple touch trajectory points can be referred to as: a predetermined number of touch trajectory points after the touch trajectory point. "Before" and "after" in this article can refer to a sequence formed by multiple touch trajectory points in order from the beginning to the end according to the touch moments, or can refer to a sequence formed by multiple touch trajectory points in order from the beginning to the end according to the acquisition time.

[0054] Among them, the track point is a graphic used to constitute the handwriting, and the above-mentioned multiple track points are used to constitute the handwriting for the touch track point. The position parameters of multiple track points can present the track changes of the handwriting, the size of multiple track points can present the thickness of the handwriting, and the transparency of multiple track points can present the depth of the handwriting. The size and transparency of the track point can be determined according to the corresponding sensing parameters. For example, the larger the pressure sensing value corresponding to a track point, the larger the size and the greater the transparency (the more opaque); or the greater the touch sliding speed corresponding to a track point, the smaller the size and the smaller the transparency (the more transparent); or the larger the touch area corresponding to a track point, the larger the size and the greater the transparency; and so on.

[0055] For example, the electronic device determines M touch trajectory points in chronological order during the user's touch operation, and the above-mentioned predetermined number of touch trajectory points is the N-th touch trajectory points. For the i-th touch trajectory point among the above-mentioned M touch trajectory points acquired, the "predetermined number of touch trajectory points" includes the i+1-th touch trajectory point, ..., the i+N-th touch trajectory point, where M is an integer greater than N, N is an integer greater than or equal to 1, and i is an integer greater than or equal to 1. Thus, based on the parameter information of the i-th touch trajectory point, the parameter information of the i+1-th touch trajectory point, ..., the parameter information of the i+N-th touch trajectory point, the position parameters, size and transparency of each of the multiple trajectory points can be determined. Among them, the determined multiple trajectory points are used to constitute the handwriting for the i-th touch trajectory point (the "handwriting for the i-th touch trajectory point" can be referred to as the "i-th segment of handwriting"). By analogy, the first handwriting segment is determined based on the parameter information of the first touch track point and the N touch track points after the first touch track point; the second handwriting segment is determined based on the parameter information of the second touch track point and the N touch track points after the second touch track point; ...; the MNth handwriting segment is determined based on the parameter information of the MNth touch track point and the N touch track points after the MNth touch track point. Therefore, according to the processing process of this step S231, a total of MN handwriting segments are generated based on the above-mentioned user's touch operation.

[0056] In step S232, based on the position parameters, size and transparency of each of the above-mentioned multiple trajectory points, the handwriting is first drawn on the buffer canvas, and then the handwriting on the buffer canvas is drawn on the display canvas, so that the electronic device displays the display canvas.

[0057] For example, after determining the position parameters, size and transparency of each of the multiple track points used to constitute the i-th handwriting segment, each track point can be drawn on the buffer canvas according to its corresponding position parameters, size and transparency. The multiple track points drawn on the buffer canvas constitute the i-th handwriting segment, and this process is invisible to the user. After completing the drawing of the i-th handwriting segment as a whole, the i-th handwriting segment as a whole is drawn on the display canvas so that the user can view the i-th handwriting segment drawn on the display canvas. By analogy, the above buffer drawing method is adopted for the above-mentioned MN segments of handwriting. After the i-th handwriting segment is drawn on the buffer canvas, regardless of whether the drawing of the i-th handwriting segment on the display canvas is completed, the subsequent handwriting can continue to be drawn on the buffer canvas, that is, the drawing on the display canvas and the drawing on the buffer canvas can be executed by independent threads respectively.

[0058] Those skilled in the art can understand that according to the handwriting drawing method of the embodiment of the present disclosure, in response to the user's touch operation on the electronic device screen, parameter information of multiple touch track points is obtained. Based on the parameter information of each touch track point and its subsequent touch track points, relevant information of multiple track points can be determined, including the position, size and transparency of each track point, and a section of handwriting for the touch track point is formed by drawing multiple track points. Since the track point has the attributes of position, size and transparency, the handwriting drawn can show the degree of thickness and depth (for example, Figure 1B The handwriting shown in the figure is closer to the user's real handwriting. In addition, the drawing process of each segment of handwriting implements dual canvas buffer drawing based on the buffer canvas and the display canvas. The dual canvas buffer mechanism can support multi-threaded parallel drawing of different segments of handwriting on different canvases, which can effectively improve the drawing efficiency. In addition, after completing multiple drawing of multiple trajectory points on the buffer canvas, a single drawing of the entire handwriting is performed on the display canvas, which can also reduce the refresh frequency of the display canvas, thereby reducing the screen flicker visible to the user and improving the display and drawing effect of the handwriting.

[0059] Figure 3 An example flow chart of a handwriting drawing method for an electronic device according to another embodiment of the present disclosure is schematically shown, which is used to exemplarily illustrate the implementation process of drawing the handwriting on the buffer canvas on the display canvas in step S232 above.

[0060] like Figure 3 As shown, taking the i-th handwriting as an example, the process of drawing the i-th handwriting on the buffer canvas on the display canvas may include the following steps S2321 to S2329.

[0061] In step S2321, a first selection box and a second selection box are obtained.

[0062] For example, when creating the buffer canvas and the display canvas, a first selection box and a second selection box may be created. The selection contents of the first selection box and the second selection box initially created are empty. In the subsequent handwriting drawing process, the first selection box and the second selection box may be cyclically assigned and used.

[0063] In step S2322, the area in the buffer canvas containing the i-th segment of handwriting is used as the current selection content of the first selection box.

[0064] For example, according to the shape of the first selection box, the minimum area that meets the shape of the first selection box and contains the i-th segment of handwriting can be used as the current selection content of the first selection box, see Figure 4 . Figure 4The figure shows a section of handwriting 420 drawn on the buffer canvas 410, which is composed of multiple track points. For example, the first selection box 430 is a rectangle, as shown by the dotted line in the figure). The first selection box 430 selects a rectangular area 440 containing the handwriting 420 as the current selection content of the first selection box 430. The current selection content of the first selection box 430 may include: the picture targeted by the selected rectangular area 440 (which may be called the "selected picture") and the position parameters of the selected rectangular area 440 in the buffer canvas, such as the coordinate parameters of at least one of the upper left corner, the upper right corner, the lower left corner, and the lower right corner.

[0065] Continue to refer Figure 3 In step S2323, it is determined whether the last selected content of the second selection box is empty. If yes, step S2324 is executed. If no, step S2325 is executed.

[0066] For example, when i is equal to 1, it means that the handwriting has not been drawn before, and the second selection box has not been assigned a value, so the previous selection content of the second selection box is empty. When i is greater than 1, the previous selection content of the second selection box is the area on the buffer canvas containing the i-1th handwriting segment, and the previous selection content of the second selection box is not empty.

[0067] In step S2324, the current selection content of the first selection box is used as the current selection content of the second selection box. Then, the process returns to step S2321 to start a new round.

[0068] According to an embodiment of the present disclosure, when the previous selection content of the second selection box is empty, the current selection content of the first selection box can be directly assigned to the second selection box. As described above, the current selection content of the first selection box is the area on the buffer canvas containing the i-th segment of handwriting, so the current selection content of the second selection box is also the area, and the area has position attributes and image attributes. It can be understood that "this time" and "previous time" in the embodiment of the present disclosure refer to the handwriting that is currently being drawn. For example, when drawing the i+1th segment of handwriting, the area in the first selection box containing the i-th segment of handwriting becomes the previous selection content of the first selection box, and the area in the second selection box containing the i-th segment of handwriting becomes the previous selection content of the second selection box.

[0069] In step S2325, the previously selected content of the second selection box is drawn on the display canvas.

[0070] According to an embodiment of the present disclosure, when the previous selection content of the second selection box is the area containing the i-1th segment of handwriting on the buffer canvas, it is necessary to first draw the area containing the i-1th segment of handwriting on the display canvas, and then use the current selection content of the first selection box to assign a value to the second selection box.

[0071] Exemplarily, in order to facilitate the unified measurement of the coordinate position of the drawing graphics, the buffer canvas and the display canvas can be set to have the same size, that is, the height of the two is the same, and the width of the two is the same. The previous selection content of the second selection box may include: the selected picture targeted by the previous selection content of the second selection box (for example, the picture targeted by the area containing the i-1th section of handwriting on the buffer canvas) and the position parameters of the selected picture in the buffer canvas (for example, the coordinates of the upper left corner of the selected picture). This step S2325 of drawing the previous selection content of the second selection box on the display canvas may include: according to the position parameters of the selected picture targeted by the previous selection content of the second selection box in the buffer canvas, drawing the selected picture as a whole on the display canvas (for example, pasting the selected picture as a whole on the display canvas), thereby drawing the i-1th section of handwriting on the display canvas.

[0072] In step S2326, it is determined whether there is an overlapping area between the previous selection of the second selection box and the current selection of the first selection box. If yes, step S2327 is executed. If not, step S2329 is executed.

[0073] In step S2327, the transparency of the overlapping area in the currently selected content of the first selection box is set so that the transparency of the overlapping area is a predetermined value.

[0074] In step S2328, the current selection content of the first selection box with transparency setting is used as the current selection content of the second selection box. Then, the process returns to step S2321 to start a new round.

[0075] Reference below Figure 5 Steps S2326 to S2328 are exemplarily described. Figure 5 As shown, the i-1th segment of handwriting 420 is drawn on the buffer canvas. i-1 、The i-th paragraph handwriting 420 i and the i+1th paragraph handwriting 420 i+1 When it is desired to draw the i-th handwriting on the display canvas, the previous selection content of the second selection box is the area 440 on the buffer canvas containing the i-1-th handwriting. i-1 , the area 440 containing the i-th handwriting in the buffer canvas i The current selection as the first selection box.

[0076] Since area 440 i-1 and Area 440 i There are overlapping areas (e.g., area 440 i-1 The upper right corner and area 440 i ), if we first set area 440 i-1Draw on the display canvas, and then move area 440 i Drawing on the display canvas will cause the overlapping area between the two to be drawn repeatedly, which will cause the transparency of the trajectory points in the overlapping area to be repeatedly superimposed. To avoid transparency superposition errors caused by repeated drawing of overlapping areas, the previous selection of the second selection box is 440 i-1 After drawing on the display canvas, the current selection content of the first selection box is 440 i For example, the transparency of the pixels in the overlapping area 441 is set to 0, so that the overlapping area 441 is completely transparent, and the area 440 is obtained. i '. Then the area 440 i 'Assign the value to the second selection box as the current selection content of the second selection box. When the selection content of the first selection box is assigned to the area containing the i+1th handwriting in the buffer canvas next time, the area 440 in the second selection box is assigned to the area containing the i+1th handwriting in the buffer canvas next time. i 'Draw on the display canvas. At this time, due to the area 440 i 'Relative to the area 440 that has been drawn on the display canvas i-1 The overlapping area 441 is completely transparent, which avoids repeated drawing of the overlapping area 441 on the display canvas, thereby avoiding transparency superposition errors.

[0077] Continue to refer Figure 3 , when there is no overlapping area between the previous selection of the second selection box and the current selection of the first selection box, it means that there is no repeated drawing between the previous drawing content and the current drawing content on the display canvas, so in step S2329, the current selection of the first selection box can be directly used as the current selection of the second selection box. Then, the process returns to step S2321.

[0078] Those skilled in the art can understand that the handwriting drawing method according to the embodiment of the present disclosure can sequentially generate multiple handwriting segments with size (such as width) and transparency based on the acquired parameter information of the touch track point. Figure 3 In the process shown, the first selection box and the second selection box are used to draw the handwriting drawn on the buffer canvas on the display canvas in a step-by-step manner. This step-by-step drawing method ensures that the drawing process on the buffer canvas and the drawing process on the display canvas do not affect each other. Figure 5When the i-1th and ith handwriting segments are drawn on the display canvas, the drawing of the i+1th handwriting segment on the buffer canvas is not affected. This can effectively optimize the handwriting drawing speed and improve the lag of the handwriting drawing process relative to the actual touch operation process. In addition, during the distributed drawing process, the transparency of the overlapping area in the first selection box relative to the second selection box is set to avoid repeated drawing of the overlapping area on the display canvas, thereby avoiding the influence of transparency superposition error on the depth of the handwriting.

[0079] According to an embodiment of the present disclosure, the parameter information of each touch trajectory point among the multiple touch trajectory points obtained above may include, for example: the touch position parameter of the touch trajectory point and the sensing parameter of the touch trajectory point. Exemplarily, the sensing parameter of a touch trajectory point may include at least one of the following: the pressure sensing value of the touch trajectory point, the touch sliding speed of the touch trajectory point (for example, the average touch sliding speed from the previous touch trajectory point of the touch trajectory point to the touch trajectory point, etc., for the first touch trajectory point obtained, the touch sliding speed can be set to 0), and the touch area of ​​the touch trajectory point. The above sensing parameters can reflect the different characteristics of the user when performing touch operations such as writing and drawing on the electronic device. The size and transparency of the handwriting can be designed based on these characteristics, so as to obtain drawing handwriting that is more in line with the user's handwriting.

[0080] Reference below Figure 6 , the handwriting drawing method disclosed in the present invention is exemplarily described in combination with another embodiment. It can be understood that Figure 6 Another implementation of the handwriting drawing method according to the embodiment of the present disclosure is used to exemplarily illustrate, and does not limit the embodiment of the present disclosure.

[0081] Figure 6 An example flowchart of a handwriting drawing method for an electronic device according to another embodiment of the present disclosure is schematically shown.

[0082] like Figure 6 As shown, after the execution starts, steps S601 to S612 may be included.

[0083] In step S601, a presentation canvas, a buffer canvas, a first selection box, and a second selection box are created and initialized.

[0084] According to an embodiment of the present disclosure, this step S601 can create and initialize the canvas and the selection box according to the implementation of the above step S210 and step S2321. Exemplarily, a display canvas canvas1 and a buffer canvas canvas2 can be created. The initialization setting makes the size of the display canvas canvas1 and the buffer canvas canvas2 consistent, for example, both are 150 pixels × 300 pixels. Create the first selection box dirtyRect1 and the second selection box dirtyRect2 required for step-by-step drawing. The initial selection content of the first selection box dirtyRect1 and the second selection box dirtyRect2 are both empty through the initialization setting.

[0085] In step S602, parameter information of the touch track point is obtained.

[0086] Exemplarily, the electronic device periodically determines the touch track points and generates parameter information of each touch track point based on the user's touch operation such as writing and drawing on the screen. In this example, the parameter information of each touch track point may include the touch time of the touch track point, the touch position parameter and the pressure sensing value of the touch track point.

[0087] In step S603, the acquired parameter information of the touch track point is stored in the first buffer area.

[0088] In step S604, it is determined whether there is parameter information of touch track points greater than a predetermined number in the current first buffer area. If yes, step S605 is executed. If no, it means that the number of touch track points is insufficient to generate handwriting, and the process returns to step S602.

[0089] In step S605, based on the parameter information of the touch track points in the first buffer area, the position parameters, size and transparency of each of the plurality of track points are determined, and the position parameters, size and transparency of each of the plurality of track points are stored in the second buffer area.

[0090] Reference below Fig. 7A , steps S604 to S605 are described illustratively with reference to a specific example. Fig. 7AAs shown, for example, the predetermined number is 2. After the parameter information of the i+2th touch trajectory point is obtained, the parameter information of the i+2th touch trajectory point is stored in the first cache area Cache 701. If the first cache area Cache 701 currently has the parameter information of the i-th touch trajectory point and the parameter information of the i+1th touch trajectory point, it is determined that the parameter information of the touch trajectory points in the first cache area Cache 701 is sufficient to determine the i-th handwriting. Therefore, based on the parameter information of the i-th touch trajectory point, the parameter information of the i+1th touch trajectory point, and the parameter information of the i+2th touch trajectory point, the position parameters, size, and transparency of each of the multiple trajectory points used to constitute the i-th handwriting are determined and stored in the second cache area Collection 702 to overwrite the original data in the second cache area Collection 702.

[0091] According to an embodiment of the present disclosure, exemplarily, the process of determining the position parameters, size and transparency of each of the multiple track points in step S605 may include: fitting a curve based on the parameter information of the i-th touch track point and the parameter information of each of a predetermined number of touch track points after the i-th touch track point, and determining the position parameters and sensing parameters of each of the multiple points on the curve. Then, the position parameters of each of the multiple points are used as the position parameters of each of the multiple track points, and the size and transparency of each of the multiple track points are determined based on the sensing parameters of each of the multiple points.

[0092] Using the example in which the predetermined number is 2, for the i-th touch track point, the first touch track point after the i-th touch track point is the i+1-th touch track point, and the second touch track point after the i-th touch track point is the i+2-th touch track point. Based on the parameter information of the i-th touch track point, the parameter information of the i+1-th touch track point, and the parameter information of the i+2-th touch track point, a starting point P for curve fitting is determined. i0 , control point P i1 and the end point P i2 The respective position parameters and sensing parameters. For the implementation of this process, please refer to e.g. Figure 7B .

[0093] Figure 7B An example diagram of a fitting curve according to an embodiment of the present disclosure is schematically shown. Figure 7B As shown, in the rectangular coordinate system o-xy, the touch position parameter of the i-th touch track point A is (x i ,y i ) (for example, the position coordinates of the center point of the i-th touch track point), the sensing parameter of the i-th touch track point A is the pressure sensing value F i(For example, the pressure sensing value of the center point of the i-th touch track point, or the average pressure sensing value of the i-th touch track point, or the maximum pressure sensing value of the i-th touch track point, etc.) Similarly, the touch position parameter of the i+1-th touch track point B is (x i+1 ,y i+1 ), the sensing parameter of the i+1th touch track point B is the pressure sensing value F i+1 The touch position parameter of the i+2th touch track point C is (x i+2 ,y i+2 ), the sensing parameter of the i+2th touch track point C is the pressure sensing value F i+2 .

[0094] For example, select the line between the i-th touch track point A and the i+1-th touch track point B (such as Figure 7B A point on the dotted line between A and B (e.g., the midpoint) is taken as the starting point P i0 According to ((x i ,y i ), F i ) and ((x i+1 ,y i+1 ), F i+1 ), use the interpolation algorithm to calculate the starting point P i0 The position parameters and sensing parameters ((x i0 ,y i0 ), F i0 ). Select the center point of the i+1th touch track point B as the control point P i1 . Control point P i1 The position parameters and sensing parameters ((x i1 ,y i1 ), F i1 ) is equal to ((x i+1 ,y i+1 ), F i+1 ). Select the line between the i+1th touch track point B and the i+2th touch track point C (such as Figure 7B A point on the dotted line between B and C (e.g., the midpoint) is taken as the end point P i2 According to ((x i+1 ,y i+1 ), F i+1 ) and ((x i+2 ,y i+2 ), F i+2 ), use the interpolation algorithm to calculate the end point P i2 The position parameters and sensing parameters ((x i2 ,y i2 ), F i2 ).

[0095] Next, for the starting point P i0 , control point P i1 and the end point P i2 The respective position parameters are used to fit the second-order Bezier curve, thereby determining the second-order Bezier curve equation. According to the predetermined step length, the starting point P is selected from the second-order Bezier curve according to the second-order Bezier curve equation. i0 and the end point P i2 Then the second-order Bezier curve equation, the starting point P i0 , control point P i1 and the end point P i2 Respective sensing parameters, determine the sensing parameters of the plurality of points selected above.

[0096] The selected multiple points correspond to the multiple track points used to form the i-th handwriting segment. For example, the position parameter of the j-th point selected can be used as the position parameter of the j-th track point among the multiple track points, and the sensing parameter of the j-th point selected can be used as the sensing parameter of the j-th track point among the multiple track points. Wherein j is an integer greater than or equal to 1.

[0097] According to an embodiment of the present disclosure, the electronic device may be pre-set with: a first mapping table for characterizing the correspondence between the sensing parameters and the size of the trajectory point, and a second mapping table for characterizing the correspondence between the sensing parameters and the transparency of the trajectory point. After determining the sensing parameters of each trajectory point, the size corresponding to the sensing parameters of the trajectory point is determined according to the first mapping table (for example, when the trajectory point is a circle, the size represents the radius; or when the trajectory point is a square, the size represents the side length; etc.), as the size of the trajectory point. Similarly, according to the second mapping table, the transparency corresponding to the sensing parameters of the trajectory point is determined as the transparency of the trajectory point.

[0098] It can be understood that in the above-mentioned embodiment of the present disclosure, a second-order Bezier curve fitting method is adopted to generate each segment of handwriting. Only three touch track points need to be obtained to generate a segment of handwriting, which is highly efficient. And because the points in the real touch track points are directly used as control points in curve fitting, the amount of calculation can be reduced. Further, the embodiment of the present disclosure determines the size and transparency of multiple track points used to constitute the handwriting based on curve fitting, so that the thickness and depth of the handwriting finally presented change with the change of the sensing parameters. For example, when the pressure sensing value is larger, the width of the handwriting is larger and more opaque, when the touch sliding speed is larger, the width of the handwriting is smaller and more transparent, when the touch area is larger, the width of the handwriting is larger and more opaque, and so on. Thereby, the drawn handwriting reflects the handwriting characteristics of the user during the touch operation process such as writing and painting. In other examples, the predetermined number can be set to other values, and other types of curves can also be fitted when performing curve fitting. The sensing parameters can be selected according to actual needs. This example is only used to illustrate the implementation principle of the embodiment of the present disclosure and does not limit the embodiment of the present disclosure.

[0099] Continue to refer Figure 6 In step S606, the parameter information of the latest predetermined number of touch track points is retained in the first buffer area.

[0100] Exemplarily, after determining the position parameters, size and transparency of each of the plurality of track points constituting the i-th handwriting segment based on the parameter information of the i-th touch track point, the parameter information of the i+1-th touch track point and the parameter information of the i+2-th touch track point and storing them in the second cache area Collection, in order to avoid unnecessary occupation of storage space, the redundant parameter information of the touch track point can be deleted from the first cache area Cache. For example, the parameter information of the i-th touch track point is deleted from the first cache area Cache to optimize the operating speed of the electronic device.

[0101] In step S607, the second buffer area is traversed, and the plurality of track points are drawn on the buffer canvas according to the position parameters, size and transparency of the plurality of track points in the second buffer area.

[0102] Exemplarily, since the current second buffer area Collection stores the position parameters, size and transparency of multiple trajectory points used to constitute the i-th segment of handwriting, after the multiple trajectory points are drawn on the buffer canvas with their respective positions, sizes and transparencies, the i-th segment of handwriting is formed on the buffer canvas.

[0103] In step S608, based on the position parameters of the plurality of track points in the second buffer area, an area on the buffer canvas including the plurality of track points is determined as the current selection content of the first rectangular frame.

[0104] In step S609, it is determined whether the last selected content of the second rectangular frame is empty. If not, step S610 is executed. If yes, step S612 is executed.

[0105] In step S610, the previously selected content of the second rectangular frame is drawn on the display canvas.

[0106] In step S611, the overlapping area of ​​the currently selected content of the first rectangular frame relative to the previously selected content of the second rectangular frame is set to be completely transparent.

[0107] In step S612, the currently selected content of the first rectangular frame is used as the currently selected content of the second selection frame.

[0108] The above steps S608 to S612 can be performed as follows: Figure 3 The implementation method shown has been described in detail above and will not be repeated here.

[0109] Figure 8 The block diagram of a handwriting drawing apparatus for an electronic device according to an embodiment of the present disclosure is schematically shown.

[0110] like Figure 8 As shown, the handwriting drawing device 800 for electronic device may include: a creation module 810, an acquisition module 820 and a drawing module 830. The drawing module 830 may include a determination submodule 831 and a buffer drawing submodule 832.

[0111] The creation module 810 is used to create a buffer canvas and a display canvas in the electronic device.

[0112] The acquisition module 820 is used to acquire parameter information of multiple touch track points. The parameter information of each touch track point may include: touch time, touch position parameter and sensing parameter.

[0113] The drawing module 830 is used to perform drawing processing on each of the multiple touch trajectory points. Exemplarily, the determination submodule 831 is used to determine the position parameters, size and transparency of the multiple trajectory points to be displayed based on the touch position parameters and sensing parameters of the touch trajectory point and a predetermined number of touch trajectory points whose touch moments are later than the touch trajectory point among the multiple touch trajectory points, and the multiple trajectory points constitute a section of handwriting for the touch trajectory point. The buffer drawing submodule 832 is used to draw handwriting on the buffer canvas first, based on the position parameters, size and transparency of the multiple trajectory points, and then draw the handwriting on the buffer canvas on the display canvas, so that the display canvas can be displayed by the electronic device.

[0114] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.

[0115] Fig. 9 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Fig. 9 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.

[0116] like Fig. 9 As shown, the electronic device 900 may include a display unit 910 and at least one processor 920. The display unit 910 is configured to receive a touch event. For example, when a user performs a touch operation such as writing or drawing on the screen of the electronic device, the display unit 910 receives a touch event for the touch operation. The at least one processor 920 is configured to execute a method according to an embodiment of the present disclosure in response to the above touch event, so that the display unit 910 displays the handwriting drawn on the display canvas.

[0117] Fig.10 A block diagram of an electronic device suitable for implementing the method described above according to another embodiment of the present disclosure is schematically shown. Fig.10 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.

[0118] like Fig.10 As shown, the electronic device 1000 includes one or more processors 1010 and a computer-readable storage medium 1020. The electronic device 1000 can execute the method according to the embodiment of the present disclosure.

[0119] For example, the processor 1010 may include a general-purpose microprocessor, an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1010 may also include an onboard memory for cache purposes. The processor 1010 may be a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.

[0120] The computer-readable storage medium 1020 may be, for example, a non-volatile computer-readable storage medium, and specific examples include but are not limited to: a magnetic storage device, such as a magnetic tape or a hard disk (HDD); an optical storage device, such as a compact disk (CD-ROM); a memory, such as a random access memory (RAM) or a flash memory; and the like.

[0121] The computer-readable storage medium 1020 may include a computer program 1021 , which may include code / computer-executable instructions that, when executed by the processor 1010 , cause the processor 1010 to perform a method according to an embodiment of the present disclosure or any variation thereof.

[0122] The computer program 1021 may be configured to have, for example, a computer program code including a computer program module. For example, in an example embodiment, the code in the computer program 1021 may include one or more program modules, for example, 1021A, module 1021B, ... It should be noted that the division method and number of modules are not fixed, and those skilled in the art may use appropriate program modules or program module combinations according to actual conditions, and when these program module combinations are executed by the processor 1010, the processor 1010 may execute the method according to the embodiment of the present disclosure or any variation thereof.

[0123] The embodiments of the present disclosure also provide a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiments of the present disclosure is implemented.

[0124] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: 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), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0125] The embodiments of the present disclosure also provide a computer program product, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer program product carries executable instructions, and when the above executable instructions are executed, the method according to the embodiments of the present disclosure is implemented.

[0126] Although the present disclosure has been shown and described with reference to specific exemplary embodiments of the present disclosure, it should be understood by those skilled in the art that various changes in form and details may be made to the present disclosure without departing from the spirit and scope of the present disclosure as defined by the appended claims and their equivalents. Therefore, the scope of the present disclosure should not be limited to the above-mentioned embodiments, but should be determined not only by the appended claims, but also by the equivalents of the appended claims.

Claims

1. A handwriting drawing method for an electronic device, comprising: Creating a buffer canvas and a display canvas in the electronic device; Acquire parameter information of a plurality of touch track points, the parameter information including: touch time, touch position parameter and sensing parameter; and For each of the plurality of touch track points, perform the following steps: Determining the position parameters, sizes and transparency of the plurality of track points to be displayed based on the touch position parameters and sensing parameters of the touch track point and a predetermined number of touch track points whose touch moments are later than the touch moment of the touch track point among the plurality of touch track points; and Based on the position parameters, sizes and transparency of the plurality of trajectory points, firstly drawing handwriting on the buffer canvas, and then drawing the handwriting on the buffer canvas on the display canvas, so that the electronic device displays the display canvas; The step of drawing the handwriting on the buffer canvas on the display canvas comprises: Get the first selection box and the second selection box; Using the area of ​​the buffer canvas containing the handwriting as the current selection content of the first selection box; Determine whether the last selected content of the second selection box is empty; If yes, the current selection content of the first selection box is used as the current selection content of the second selection box; and If not, the last selected content of the second selection box is drawn on the display canvas.

2. The method according to claim 1, wherein: The step of drawing the handwriting on the buffer canvas on the display canvas further comprises: After drawing the last selected content of the second selection box on the display canvas, Determine whether there is an overlapping area between the previous selection of the second selection frame and the current selection of the first selection frame; If there is an overlapping area, setting the transparency of the overlapping area in the currently selected content of the first selection frame so that the transparency of the overlapping area is a predetermined value; and The currently selected content of the first selection box after the transparency setting is used as the currently selected content of the second selection box.

3. The method according to claim 2, wherein: The step of drawing the handwriting on the buffer canvas on the display canvas further comprises: If there is no overlapping area, the currently selected content of the first selection box is used as the currently selected content of the second selection box.

4. The method according to any one of claims 1 to 3, wherein: The buffer canvas and the display canvas have the same height, and the buffer canvas and the display canvas have the same width; The last selected content of the second selection frame includes: a selected picture targeted by the last selected content and a position parameter of the selected picture in the buffer canvas; and Drawing the previously selected content of the second selection box on the display canvas includes: drawing the selected image on the display canvas according to the position parameters of the selected image in the buffer canvas.

5. The method according to any one of claims 1 to 3, wherein: The step of using the area of ​​the buffer canvas containing the handwriting as the current selection content of the first selection frame includes: After determining that the last selected content of the first selection box has been used as the last selected content of the second selection box, the area containing the handwriting is used as the current selected content of the first selection box.

6. The method according to any one of claims 1 to 3, wherein: The determining, based on the touch position parameters and sensing parameters of the touch trajectory point and a predetermined number of touch trajectory points whose touch moments are later than the touch moment of the touch trajectory point, the position parameters, size and transparency of the plurality of trajectory points to be displayed comprises: Fitting a curve based on the touch track point and the touch position parameters and sensing parameters of each of the predetermined number of touch track points, and determining the position parameters and sensing parameters of each of a plurality of points on the curve; Using the position parameters of each of the plurality of points as the position parameters of each of the plurality of trajectory points; and Based on the sensing parameters of the plurality of points, the size and transparency of the plurality of track points are determined.

7. The method according to claim 6, wherein: The fitting curve and determining the position parameters and sensing parameters of each of the plurality of points on the curve include: Determine the position parameters and sensing parameters of the start point, the control point and the end point based on the touch position parameters and sensing parameters of the touch trajectory point and two subsequent touch trajectory points whose touch moments are later than the touch moment of the touch trajectory point among the multiple touch trajectory points; Determine a second-order Bezier curve equation for the position parameters of the starting point, the control point, and the end point; Based on the second-order Bezier curve equation, determining position parameters of each of the plurality of points; and Based on the second-order Bezier curve equation, the sensing parameters of the starting point, the control point, and the end point, the sensing parameters of each of the plurality of points are determined.

8. The method according to claim 7, wherein: The touch position parameter of the touch track point includes: the position parameter of the center point of the touch track point, and the sensing parameter of the touch track point includes: the sensing parameter of the center point of the touch track point; The determining of the position parameters and sensing parameters of the start point, the control point, and the end point based on the touch position parameters and sensing parameters of the touch trajectory point and two subsequent touch trajectory points whose touch moments are later than the touch moment of the touch trajectory point among the multiple touch trajectory points comprises: Calculate the position parameter and sensing parameter of the midpoint of the line between the touch trajectory point and the first touch trajectory point in the second two touch trajectory points according to the touch position parameter and sensing parameter of the touch trajectory point and the first touch trajectory point in the second two touch trajectory points, so as to use the position parameter and sensing parameter of the starting point; Using the touch position parameter and sensing parameter of the center point of the first subsequent touch track point as the position parameter and sensing parameter of the control point; and According to the touch position parameters and sensing parameters of the first touch trajectory point and the second touch trajectory point among the two touch trajectory points, the position parameters and sensing parameters of the midpoint of the line between the first touch trajectory point and the second touch trajectory point are calculated as the position parameters and sensing parameters of the termination point.

9. The method according to claim 6, wherein: The determining the size and transparency of each of the plurality of track points based on the sensing parameters of each of the plurality of points comprises: Presetting a first mapping table and a second mapping table; For each of the plurality of points, determining a size corresponding to the sensing parameter of the point according to the first mapping table, so as to serve as the size of a trajectory point among the plurality of trajectory points; and According to the second mapping table, a transparency corresponding to the sensing parameter of the point is determined as the transparency of the one trajectory point.

10. The method according to claim 6, wherein: The sensing parameter of the touch track point includes at least one of the following: The pressure sensing value of the touch track point; The touch sliding speed of the touch track point; and The touch area of ​​the touch track point.

11. The method according to claim 1, wherein: When each of the plurality of trajectory points is circular, the size of the trajectory point is the radius of the trajectory point.

12. The method according to claim 1, further comprising: After acquiring the parameter information of the touch track point, storing the parameter information of the touch track point in a buffer area; The determining, based on the touch position parameters and sensing parameters of the touch trajectory point and a predetermined number of touch trajectory points whose touch moments are later than the touch moment of the touch trajectory point, the position parameters, sizes and transparency of the plurality of trajectory points to be displayed comprises: determining, based on the touch position parameters and sensing parameters of the touch trajectory point and the predetermined number of touch trajectory points in the buffer area, the position parameters, sizes and transparency of the plurality of trajectory points; The method further includes: after determining the position parameters, size and transparency of each of the plurality of track points to be displayed, deleting the parameter information of the touch track points in the buffer area.

13. A handwriting drawing device for an electronic device, comprising: A creation module, used to create a buffer canvas and a display canvas in the electronic device; an acquisition module, used to acquire parameter information of a plurality of touch track points, wherein the parameter information includes: touch time, touch position parameter and sensing parameter; and The drawing module is used to perform the following processing on each of the multiple touch track points, including: a determination submodule, configured to determine the position parameters, size and transparency of each of the plurality of track points to be displayed based on the touch position parameters and sensing parameters of each of the touch track point and a predetermined number of touch track points among the plurality of touch track points whose touch moments are later than the touch moment of the touch track point; and a buffer drawing submodule, for drawing handwriting on the buffer canvas based on the position parameters, size and transparency of each of the plurality of trajectory points, and then drawing the handwriting on the buffer canvas on the display canvas, so that the electronic device displays the display canvas; The buffer drawing submodule draws the handwriting on the buffer canvas on the display canvas, including: Get the first selection box and the second selection box; Using the area of ​​the buffer canvas containing the handwriting as the current selection content of the first selection box; Determine whether the last selected content of the second selection box is empty; If yes, the current selection content of the first selection box is used as the current selection content of the second selection box; and If not, the last selected content of the second selection box is drawn on the display canvas.

14. An electronic device comprising: A display unit configured to receive a touch event; At least one processor is configured to execute the method according to any one of claims 1 to 13 in response to the touch event, so that the display unit displays the presentation canvas.

15. An electronic device, comprising: a memory configured to store instructions; At least one processor: The at least one processor executes instructions stored in the memory to implement the method according to any one of claims 1 to 12.

16. A computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions, when executed by a processor, implement the method according to any one of claims 1 to 12.

17. A computer program product, comprising executable instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Method for beautifying handwriting in real time and electronic equipment

    CN102937849A

  • Canvas element rendering method and device realized on Android system based on GPU (Graphic Processing Unit)

    CN103336816A