Writing and drawing prediction line elimination method and device, electronic equipment and program product

By initializing template values ​​and distinguishing line types in the writing and drawing area, and using background color to render the predicted lines, the problem of writing and drawing prediction lines eliminate traces and low performance in the prior art is solved, and efficient and accurate line elimination is achieved.

CN119205978APending Publication Date: 2024-12-27SHENZHEN XINWEI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411388959.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The prior art may leave traces when removing the prediction lines of writing and drawing, such as white blocks or points, and the calculation volume is large, affecting the user experience and application performance.

Method used

By initializing the template value of the writing and drawing area, rendering the actual and predicted lines according to the writing and drawing input signal, and distinguishing different types of lines according to the template value, and using background color to render the predicted lines to achieve elimination.

Benefits of technology

Accurate lines for writing and drawing prediction are eliminated, traces are retained, user experience and application performance are improved, and the integrity of actual writing and drawing content is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119205978A_ABST
    Figure CN119205978A_ABST
Patent Text Reader

Abstract

According to the writing and drawing prediction line elimination method and device, the electronic equipment and the program product provided by the embodiment of the invention, the template value of each pixel on the writing and drawing area is initialized as the first template value; writing and drawing input signals in the writing and drawing area are obtained, actual writing and drawing lines are rendered in the writing and drawing area according to the writing and drawing input signals, template values of pixels corresponding to the actual writing and drawing lines are updated to second template values, and the second template values are different from the first template values; generating a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keeping the template value of a pixel part where the predicted writing and drawing line is overlapped with the actual writing and drawing line as a second template value, and setting the template value of a pixel where the predicted writing and drawing line is not overlapped with the actual writing and drawing line as a first template value; and obtaining a background color of the writing and drawing area, and rendering the pixel of which the template value is the first template value in the writing and drawing area according to the background color. Through the method, the writing and drawing prediction lines can be accurately eliminated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer graphics, and in particular to a method, device, electronic device and program product for eliminating writing and drawing prediction lines. Background Art

[0002] With the popularity of mobile devices and smart terminals, writing and drawing applications are increasingly used in education, design, entertainment and other fields. In these applications, by predicting the user's writing trajectory, rendering lines in advance, and reducing writing delays, users can be provided with a smooth writing experience. However, redundant predicted lines may appear on the screen. If these lines are not removed in time, they will affect the user's writing experience and the aesthetics of the final work.

[0003] In the related art, the elimination of predicted lines usually involves direct operation of the screen drawing pixels, such as using the canvas background color to redraw and cover the predicted lines. Although this method can achieve the elimination of lines, it may leave traces on the actually drawn lines, such as white blocks or dots. Therefore, how to accurately eliminate the predicted lines has always been a technical problem faced by this field. Summary of the invention

[0004] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a method, device, electronic device and program product for eliminating writing and drawing prediction lines, which can accurately eliminate writing and drawing prediction lines.

[0005] In a first aspect, an embodiment of the present application provides a method for eliminating writing and drawing prediction lines, comprising:

[0006] Initialize the template value of each pixel in the writing and drawing area to the first template value;

[0007] Acquire a drawing input signal in the drawing area, render an actual drawing line in the drawing area according to the drawing input signal, and update a template value of a pixel corresponding to the actual drawing line to a second template value; wherein the second template value is different from the first template value;

[0008] Generate a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keep the template value of the pixel part where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and set the template value of the pixel where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value;

[0009] A background color of the writing and drawing area is obtained, and pixels in the writing and drawing area whose template value is the first template value are rendered according to the background color.

[0010] According to some embodiments of the present application, the writing and drawing input signal includes a plurality of motion event data points, and generating a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keeping the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and setting the template value of the pixel where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value, comprises:

[0011] Establishing a prediction equation based on a plurality of motion event data points, and obtaining predicted motion event data points according to the prediction equation;

[0012] Generating the predicted writing and drawing line in the writing and drawing area according to the predicted motion event data point and a plurality of the motion event data points;

[0013] The template value of the pixel corresponding to the predicted writing and drawing line is set to the first template value.

[0014] According to some embodiments of the present application, generating a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keeping the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and setting the template value of the pixel where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value, includes:

[0015] Obtaining the number of motion event data points in the writing and drawing input signal;

[0016] In response to the number of motion data points being greater than or equal to a preset threshold value, a predicted writing and drawing line is generated in the writing and drawing area according to the writing and drawing input signal, the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line is maintained unchanged as the second template value, and the template value of the pixel portion where the predicted writing and drawing line does not overlap with the actual writing and drawing line is set to the first template value.

[0017] According to some embodiments of the present application, obtaining a writing and drawing input signal in the writing and drawing area, rendering an actual writing and drawing line in the writing and drawing area according to the writing and drawing input signal, and updating a template value of a pixel corresponding to the actual writing and drawing line to a second template value includes:

[0018] Acquire a plurality of motion event data points and a timestamp of each of the motion event data points in the writing and drawing input signal;

[0019] Connecting a plurality of the motion event data points in sequence according to the timestamp of each of the motion event data points to generate the actual writing and drawing line;

[0020] The template value of the pixel corresponding to the actual writing and drawing line is updated to the second template value.

[0021] According to some embodiments of the present application, acquiring the background color of the writing and drawing area, and rendering pixels in the writing and drawing area whose template value is the first template value according to the background color, includes:

[0022] Get the background color of the writing and drawing area;

[0023] Traversing the template value of each pixel in the predicted writing and drawing line;

[0024] In response to retrieving a pixel in the predicted writing and drawing line whose template value is equal to the first template value, setting the color of the pixel to the background color;

[0025] In response to retrieving a pixel in the predicted drawing line whose template value is equal to the second template value, the color of the pixel is kept unchanged.

[0026] According to some embodiments of the present application, after acquiring the background color of the writing and drawing area, and rendering pixels in the writing and drawing area whose template value is the first template value according to the background color, the method further includes:

[0027] Grouping pixels in the writing and drawing area to obtain at least one pixel group, each of the pixel groups including at least one pixel;

[0028] Smoothing the color values ​​of the pixels in each of the pixel groups to obtain a smoothed color value of each of the pixel groups;

[0029] According to the smoothed color value of each pixel group, the color values ​​of the pixels in the corresponding pixel group are updated.

[0030] According to some embodiments of the present application, before initializing the template value of each pixel in the writing and drawing area to the first template value, the method further includes:

[0031] A background color of the writing and drawing area is obtained, and pixels in the writing and drawing area whose template value is the first template value are rendered according to the background color.

[0032] In a second aspect, an embodiment of the present application provides a device for eliminating writing and drawing prediction lines, comprising:

[0033] An initialization module, used for initializing the template value of each pixel in the writing and drawing area to be a first template value;

[0034] A first acquisition module is used to acquire a drawing input signal in the drawing area, render an actual drawing line in the drawing area according to the drawing input signal, and update a template value of a pixel corresponding to the actual drawing line to a second template value, where the second template value is different from the first template value;

[0035] a generating module, configured to generate a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keep the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and set the template value of the pixel where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value;

[0036] The second acquisition module is used to acquire the background color of the writing and drawing area, and render the pixels in the writing and drawing area whose template value is the first template value according to the background color.

[0037] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the method for eliminating writing and drawing prediction lines as described in any one of the embodiments of the first aspect of the present application.

[0038] In a fourth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product stores a program, and the program is executed by a processor to implement a method for eliminating writing and drawing prediction lines as described in any one of the embodiments of the first aspect of the present application.

[0039] The method for eliminating writing and drawing prediction lines according to the embodiment of the present application has at least the following beneficial effects:

[0040] The present application proposes a method, device, electronic device and program product for eliminating predicted writing and drawing lines, which initializes the template value of each pixel in the writing and drawing area to a first template value; obtains a writing and drawing input signal in the writing and drawing area, renders the actual writing and drawing lines in the writing and drawing area according to the writing and drawing input signal, and updates the template value of the pixel corresponding to the actual writing and drawing line to a second template value, which is different from the first template value; generates a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keeps the template value of the pixel part where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and sets the template value of the pixel where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value; obtains the background color of the writing and drawing area, and renders the pixels in the writing and drawing area whose template value is the first template value according to the background color.

[0041] First, the present application provides a unified identification basis for subsequent actual writing and drawing line rendering, predicted writing and drawing line generation, and predicted line elimination by initializing the template value of each pixel in the writing and drawing area to the first template value. Then, after obtaining the writing and drawing input signal in the writing and drawing area, the actual writing and drawing lines are rendered in the writing and drawing area according to the writing and drawing input signal, and the template value of the pixel corresponding to the actual writing and drawing line is updated to a second template value different from the initial template value. By updating the template value, the pixel range of the actual writing and drawing line is clearly identified, which provides important reference information for the subsequent predicted writing and drawing line generation and elimination, and helps to improve the accuracy of prediction and elimination. Next, the predicted writing and drawing lines are generated in the writing and drawing area according to the writing and drawing input signal, the template value of the pixel part where the predicted writing and drawing lines overlap with the actual writing and drawing lines is kept unchanged by the second template value, and the template value of the pixel where the predicted writing and drawing lines do not overlap with the actual writing and drawing lines is set to the first template value to distinguish it from the template value of the actual writing and drawing lines. This method of identifying different types of writing and drawing lines through template values ​​allows actual writing and drawing lines and predicted writing and drawing lines to coexist in the same writing and drawing area and can be accurately distinguished, laying the foundation for the subsequent elimination of predicted lines. Finally, the background color of the writing and drawing area is obtained, and the pixels in the writing and drawing area whose template value is the first template value are rendered according to the background color. Since the pixel template value corresponding to the predicted writing and drawing lines has been set to the first template value before, this step can accurately identify the pixel position of the predicted writing and drawing lines and use the background color for rendering, thereby achieving the visual elimination of the predicted writing and drawing lines. At the same time, since the pixel template value corresponding to the actual writing and drawing lines is the second template value, it will not be rendered by the background color, ensuring the integrity and accuracy of the actual writing and drawing content.

[0042] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0044] Figure 1 A schematic diagram of the prior art provided for an embodiment of the present application;

[0045] Figure 2 An optional flow chart of a method for eliminating writing and drawing prediction lines provided in an embodiment of the present application;

[0046] Figure 3 A schematic diagram of a method for eliminating writing and drawing prediction lines provided in an embodiment of the present application;

[0047] Figure 4 for Figure 2Another optional flow chart before step 201;

[0048] Figure 5 for Figure 2 Another optional flow chart of step 202;

[0049] Figure 6 for Figure 2 Another optional flow chart after step 202;

[0050] Figure 7 for Figure 2 Another optional flow chart of step 203;

[0051] Figure 8 for Figure 2 Another optional flow chart of step 204;

[0052] Fig. 9 for Figure 2 Another optional flow chart after step 204;

[0053] Fig.10 A schematic diagram of a device for eliminating writing and drawing prediction lines provided in an embodiment of the present application;

[0054] Fig.11 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0055] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.

[0056] In the description of this application, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0057] In the description of the present application, it should be understood that descriptions involving orientation, such as up, down, left, right, front, back, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.

[0058] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0059] In the description of this application, it should be noted that, unless otherwise clearly defined, the terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application in combination with the specific content of the technical solution. In addition, the identification of specific steps below does not represent a limitation on the order of steps and execution logic. The execution order and execution logic between each step should be understood and inferred with reference to the contents described in the embodiment.

[0060] With the popularity of mobile devices and smart terminals, the application of writing and drawing applications (apps) in education, design, entertainment and other fields is increasing, and users' requirements for writing and drawing experience are getting higher and higher. In these applications, the predictive line function can provide users with a smooth writing experience. By predicting the user's writing trajectory, the lines are rendered in advance to reduce writing delays. However, as the user's writing speed increases, redundant predicted lines may appear on the screen. If these lines are not eliminated in time, they will affect the user's writing experience and the aesthetics of the final work.

[0061] In the existing technology, the elimination of predicted lines is usually a direct operation on the screen drawing pixels, such as using the canvas background color to redraw and cover the predicted lines. Although this method can achieve the elimination of lines, it may leave traces such as white blocks or dots on the actual drawn lines, especially when the background color is white. Figure 1 In addition, when this method processes a large number of predicted lines, the application performance may be degraded due to excessive calculation. Therefore, how to implement a fast and accurate method for eliminating predicted lines without affecting the user experience has become a technical problem that needs to be solved in the field of writing and drawing applications.

[0062] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a method, device, electronic device and program product for eliminating writing and drawing prediction lines, which can realize fast and efficient electronic pen detection.

[0063] Reference Figure 2According to the method for eliminating the writing and drawing prediction lines provided in the embodiment of the present application, the method may include, but is not limited to, the following steps 201 to 204:

[0064] Step 201, initializing the template value of each pixel in the writing and drawing area to a first template value.

[0065] Step 202, obtaining a drawing input signal in the drawing area, rendering actual drawing lines in the drawing area according to the drawing input signal, and updating the template values ​​of pixels corresponding to the actual drawing lines to second template values.

[0066] Step 203, generate a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keep the template value of the pixel part where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and set the template value of the pixel part where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value.

[0067] Step 204 , obtaining the background color of the writing and drawing area, and rendering the pixels in the writing and drawing area whose template value is the first template value according to the background color.

[0068] Steps 201 to 204 are described in detail below.

[0069] In step 201 of some embodiments, when the writing and drawing application is started or the user starts a new writing session, the writing and drawing area needs to be initialized first. The writing and drawing area refers to the area on the screen of the electronic device where the user can write or draw. The initialization process includes setting the template value of each pixel in the area. The template value is a mark used in graphics rendering to distinguish different rendering objects or states. In this step, a specific value (first template value), usually 0, can be selected to indicate that all pixels are clean, that is, no writing or predicted lines are rendered. This initialization step ensures that every pixel on the screen is in a uniform, unused state before the user starts writing.

[0070] In step 202 of some embodiments, when the user starts writing or drawing in the writing and drawing area, these input signals can be detected and obtained. These signals contain information such as the position, pressure, and movement speed of the user's body part or stylus contacting the screen. Based on these input signals, actual lines are drawn on the screen using graphics rendering technology. These lines are a direct reflection of the user's intention, so their corresponding pixel template values ​​need to be updated to the second template value, usually 1, to distinguish them from the predicted lines.

[0071] In step 203 of some embodiments, in order to improve the fluency of writing, the user's next writing trajectory can be predicted based on the user's writing habits and the current input signal, and the predicted lines can be rendered on the screen. These predicted lines are generated based on algorithms (such as the Kalman filter algorithm), which provide users with visual feedback to help them better control the writing trajectory. Among them, the template value of the pixel corresponding to the predicted line that does not overlap with the actual writing and drawing line is set to the first template value, that is, the value at the time of initialization. The purpose of this is to easily eliminate these predicted lines when the prediction is inaccurate, while also avoiding the mistaken elimination of the actual writing and drawing lines to prevent them from interfering with the user's visual experience.

[0072] In step 204 of some embodiments, during the writing process of the user, if the predicted lines are no longer accurate or the user has completed a stroke, it is necessary to eliminate these no longer needed predicted lines. This step involves obtaining the background color of the writing area and redrawing all pixels whose template values ​​are the first template value to the background color, so that the predicted lines can be "erased" and made to disappear visually, restoring the clean state of the writing area. This process can be implemented through the template test in graphics rendering. The template test is a technology that determines whether to draw a pixel during the rendering process. It determines whether to draw based on the template value of the pixel.

[0073] Reference Figure 3, the present application provides a unified identification basis for subsequent actual writing and drawing line rendering, predicted writing and drawing line generation, and predicted line elimination by initializing the template value of each pixel in the writing and drawing area to the first template value. Then, after obtaining the writing and drawing input signal in the writing and drawing area, the actual writing and drawing lines are rendered in the writing and drawing area according to the writing and drawing input signal, and the template value of the pixel corresponding to the actual writing and drawing line is updated to a second template value different from the initial template value. By updating the template value, the pixel range of the actual writing and drawing line is clearly identified, which provides important reference information for the subsequent predicted writing and drawing line generation and elimination, and helps to improve the accuracy of prediction and elimination. Next, the predicted writing and drawing lines are generated in the writing and drawing area according to the writing and drawing input signal, and the template value of the pixel part where the predicted writing and drawing lines overlap with the actual writing and drawing lines is kept unchanged as the second template value, and the template value of the pixel where the predicted writing and drawing lines do not overlap with the actual writing and drawing lines is set to the first template value to distinguish it from the template value of the actual writing and drawing lines. This method of identifying different types of writing and drawing lines through template values ​​allows actual writing and drawing lines and predicted writing and drawing lines to coexist in the same writing and drawing area and can be accurately distinguished, laying the foundation for the subsequent elimination of predicted lines. Finally, the background color of the writing and drawing area is obtained, and the pixels in the writing and drawing area whose template value is the first template value are rendered according to the background color. Since the pixel template value corresponding to the predicted writing and drawing lines has been set to the first template value before, this step can accurately identify the pixel position of the predicted writing and drawing lines and use the background color for rendering, thereby achieving the visual elimination of the predicted writing and drawing lines. At the same time, since the pixel template value corresponding to the actual writing and drawing lines is the second template value, it will not be rendered by the background color, ensuring the integrity and accuracy of the actual writing and drawing content.

[0074] Reference Figure 4 , before step 201, step 401 may also be included:

[0075] Step 401 , obtaining the background color of the writing and drawing area, and rendering the pixels in the writing and drawing area whose template value is the first template value according to the background color.

[0076] In step 401 of some embodiments, before initializing the writing and drawing area, it is necessary to obtain the background color of the writing and drawing area, and use this background color to render all pixels in the writing and drawing area whose template value is the first template value. This step is the basis of the entire method. Its purpose is to ensure that every pixel on the screen is consistent with the background color before the writing and drawing process begins, thereby providing a clean canvas for the user to write or draw. In this way, any lines that are not actually written by the user, that is, those predicted and rendered lines.

[0077] Reference Figure 5 , step 202 may also include steps 501 to 503:

[0078] Step 501: Acquire multiple motion event data points and a timestamp of each motion event data point in a writing and drawing input signal.

[0079] Step 502, according to the timestamp of each motion event data point, multiple motion event data points are connected in sequence to generate actual writing and drawing lines.

[0080] Step 503: Update the template value of the pixel corresponding to the actual drawing line to the second template value.

[0081] In step 501 of some embodiments, when a user uses an electronic pen or finger to write or draw on the interface of a writing and drawing application, a series of motion events can be captured, each of which contains the position information when the user touches the screen. These position information are called motion event data points, and the timestamp records the exact time when each data point is captured. By collecting these data points and their timestamps, the writing and drawing application can accurately track the user's writing trajectory and provide necessary data for subsequent rendering work.

[0082] In step 502 of some embodiments, the multiple motion event data points obtained in step 501 are connected in sequence to generate actual writing and drawing lines. This process requires sorting the data points according to the timestamp to ensure that the order in which the lines are drawn is consistent with the order in which the user writes. In this way, the application can reconstruct the user's actual writing trajectory and render continuous lines on the screen. These lines reflect the user's writing intention, so they need to be visually distinguished from the predicted lines for easy user recognition.

[0083] In step 503 of some embodiments, the template value of the pixel corresponding to the actual writing and drawing line is updated to the second template value. In graphics rendering, the template value is a mark used to distinguish different types of lines. By setting the pixel template value of the actual writing and drawing line to the second template value, the writing and drawing application can clearly distinguish between the actual line and the predicted line. This distinction is used in the subsequent predicted line elimination process to eliminate only the predicted line and retain the line actually written by the user.

[0084] Through steps 501 to 503, the user's actual writing trajectory can be accurately captured and rendered, while providing clear visual identification for these lines. This not only improves the user's writing experience, but also provides the application with the information needed to manage different types of lines on the screen. This meticulous processing ensures that the writing and drawing application can effectively manage and eliminate no longer needed predicted lines while providing a smooth writing experience.

[0085] Reference Figure 6 , step 203 may also include steps 601 to 602:

[0086] Step 601, obtaining the number of motion event data points in the writing and drawing input signal.

[0087] Step 602, in response to the number of motion data points being greater than or equal to a preset threshold value, a predicted writing and drawing line is generated in the writing and drawing area according to the writing and drawing input signal, the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line is kept unchanged as the second template value, and the template value of the pixel portion where the predicted writing and drawing line does not overlap with the actual writing and drawing line is set to the first template value.

[0088] In step 601 of some embodiments, the number of motion event data points generated by the user on the writing and drawing application interface can be obtained. Specifically, when the user interacts with the writing and drawing area through an electronic pen or finger, the device can capture continuous touch or handwriting input signals, each of which represents a contact point of the user on the screen, and the data of these contact points are collectively referred to as motion event data points. The purpose of this step is to accurately count the total number of these data points in order to evaluate the user's writing action and provide the necessary data basis for subsequent predictions.

[0089] In step 602 of some embodiments, based on step 601, it is further determined whether the number of motion event data points obtained has reached a preset threshold. This threshold is a pre-set parameter used to determine whether there are enough data points for accurate trajectory prediction. If the number of data points does not reach this threshold, no prediction lines will be generated. This design is to avoid making predictions when there are insufficient data points, as this may lead to inaccurate predictions and affect the user's writing experience. The prediction mechanism is only activated when the number of data points reaches or exceeds the threshold. At this point, these data points can be used to predict the user's next writing trajectory through an algorithm (such as a Kalman filter algorithm), and the predicted writing and drawing lines can be rendered in the writing and drawing area.

[0090] Through step 601 to step 602, it is ensured that the generation of the prediction line is based on sufficient and reliable data points, thereby improving the accuracy of the prediction and optimizing the user's writing experience.

[0091] Reference Figure 7 , step 203 may also include steps 701 to 703:

[0092] Step 701: Establish a prediction equation based on a plurality of motion event data points, and obtain predicted motion event data points according to the prediction equation.

[0093] Step 702: Generate a predicted writing and drawing line in a writing and drawing area according to the predicted motion event data point and a plurality of motion event data points.

[0094] Step 703: Set the template value of the pixel corresponding to the predicted writing and drawing line as the first template value.

[0095] In step 701 of some embodiments, while the user is writing or drawing, motion event data points can be continuously collected. These data points contain information such as the position, pressure, and timestamp of the user's contact with the screen. In order to predict the user's next action, a prediction equation is established based on the collected data points. The prediction equation is a mathematical model used to predict the user's future motion trend based on the user's historical motion data. This model takes into account factors such as the user's writing habits, speed, acceleration, etc. to generate a prediction trajectory that conforms to the user's writing style and action rhythm. The prediction equation can be constructed using a Kalman filter algorithm or a particle filter algorithm. Using the prediction equation, a series of predicted motion event data points can be calculated. These data points represent an estimate of the user's future writing position, which are the points that the user's pen tip is expected to pass through. The generation of predicted data points helps to render predicted lines on the screen in advance, allowing users to feel a more fluent and natural writing experience. The generated predicted motion event data points can then be used to draw predicted lines in the writing and drawing area, which provide users with visual assistance to help them predict their writing results. At the same time, these prediction lines are also temporary. Once the user's actual operation does not match the prediction, the system can use the elimination steps described previously to clear these no longer needed prediction lines.

[0096] In step 702 of some embodiments, after the predicted motion event data points are obtained, this step combines these predicted data points with the actual motion event data points to generate predicted writing and drawing lines. This process involves sorting and interpolating the data points to form smooth and continuous lines. The predicted writing and drawing lines are generated based on the user's current writing movements and the estimation of the prediction algorithm, aiming to provide a smoother writing experience. The rendering of these lines on the screen enables the user to see the predicted writing trajectory, so that they can write or draw more naturally.

[0097] In some embodiments, these predicted motion event data points can be used in combination with actual motion event data points to generate predicted writing and drawing lines through a Bezier curve algorithm. The control points of the Bezier curve are set to these data points to define the specific shape of the curve. The advantage of the Bezier curve is that even with a small number of control points, a very smooth curve can be generated, which enables the predicted line to closely follow the user's writing action while reducing the complexity of the curve.

[0098] The method of using Bezier curves to generate predicted lines not only provides a smooth writing experience, but also visually blends with the actual writing lines, making the predicted lines look like part of the user's writing. In addition, the mathematical properties of Bezier curves make them easy to operate and render in computer graphics processing, which helps improve the performance and responsiveness of writing and drawing applications.

[0099] In step 703 of some embodiments, after generating predicted writing and drawing lines, the template values ​​of the pixels corresponding to these lines are set to the first template value. In graphics rendering, the template value is used to distinguish different rendering objects or states. In the present invention, the first template value is usually set to 0, indicating that these pixels belong to the predicted lines. This marking mechanism can distinguish between the actual written lines and the predicted lines. When the user's actual writing trajectory does not match the prediction, these predicted lines can be quickly and accurately eliminated to prevent them from interfering with the user's visual writing experience.

[0100] Through step 701 to step 703, the writing and drawing prediction line elimination method of the present invention can effectively manage and eliminate the prediction lines while ensuring the fluency of writing. This prediction mechanism based on the Kalman filter algorithm not only improves the response speed of the writing and drawing application, but also optimizes the user's writing experience. At the same time, by setting the template value, the pixels on the screen can be flexibly managed to ensure that when the user's actual writing trajectory does not match the prediction, the prediction lines that are no longer needed can be quickly and accurately eliminated.

[0101] Reference Figure 8 , step 204 may further include steps 801 to 804:

[0102] Step 801, obtaining the background color of the writing and drawing area.

[0103] Step 802, traverse the template value of each pixel in the predicted drawing line.

[0104] Step 803, in response to retrieving a pixel in the predicted writing and drawing line whose template value is equal to the first template value, setting the color of the pixel to the background color.

[0105] Step 804: in response to retrieving a pixel in the predicted writing and drawing line whose template value is equal to the second template value, keep the color of the pixel unchanged.

[0106] In step 801 of some embodiments, in the interface design of the writing and drawing application, the background color is pre-set and can be any color, depending on the theme of the application or the user's personalized settings. In step 801, the background color of the current writing and drawing area is first obtained. This color information will be used for the redrawing operation of specific pixels in subsequent steps to ensure that the eliminated prediction lines can be integrated with the background and do not affect the overall visual effect.

[0107] In step 802 of some embodiments, in the graphics rendering process, each pixel, in addition to having color information, may also be assigned one or more template values ​​to control whether the pixel participates in rendering or how to render. In step 802, all pixels in the predicted drawing line are traversed and the template value of each pixel is checked. This step is the basis for achieving precise control of the rendering process to ensure that only pixels that meet the conditions are processed.

[0108] In step 803 of some embodiments, the pixels in the predicted writing and drawing lines are further checked. When it is found that the template value of a certain pixel is equal to the first template value, this indicates that the pixel belongs to the line of wrong prediction and now needs to be eliminated. To this end, the color of these pixels is set to the background color, thereby eliminating the predicted lines. This operation is based on the template test technology, ensuring that only those pixels marked as predicted lines will be redrawn without affecting other pixels.

[0109] In step 804 of some embodiments, pixels in the predicted writing and drawing lines are continuously checked. When it is found that the template value of a certain pixel is equal to the second template value, it means that the pixel overlaps with the line actually written by the user and should be retained for display. Therefore, the colors of these pixels are kept unchanged to ensure that the actually written line continues to be displayed on the interface and is not affected by the operation of eliminating the predicted line.

[0110] Through step 801 to step 804, the writing and drawing prediction line elimination method of the present invention can effectively eliminate the prediction lines that are no longer needed without affecting the display of the user's actual writing lines. This technical means based on template testing not only improves the performance and response speed of the writing and drawing application, but also optimizes the user's writing experience, making the writing and drawing process smoother and more natural. At the same time, this method also avoids the problem of white blocks or dots appearing on the actual drawing lines due to the direct use of line coordinate data for background color redrawing, ensuring the neatness and beauty of the writing and drawing interface.

[0111] Reference Fig. 9 After step 204, the method of the present application can further optimize the display effect of the writing and drawing area to improve the visual experience, which can include steps 901 to 903:

[0112] Step 901, grouping pixels in the writing and drawing area to obtain at least one pixel group, each pixel group including at least one pixel.

[0113] Step 902: Smoothing the color values ​​of the pixels in each pixel group to obtain a smoothed color value of each pixel group.

[0114] Step 903: updating the color values ​​of the pixels in the corresponding pixel group according to the smoothed color value of each pixel group.

[0115] In step 901 of some embodiments, a grouping operation is performed on the pixels in the writing and drawing area. Pixels with similar characteristics can be grouped into the same pixel group so that these pixels can be processed uniformly. The basis for grouping can be the color value, position or other visual features of the pixel. Through grouping, the system can process pixels more efficiently, especially when adjacent pixels need to be processed similarly, such as when rendering gradient effects or smooth edges. Each pixel group contains at least one pixel, which can be a continuous pixel block or a dispersed pixel set, depending on the specific application requirements and rendering effects.

[0116] In some embodiments, pixel grouping can be performed in one of the following two ways:

[0117] (1) Grouping method based on the spatial position of pixels. This method first divides the writing and drawing area into several rectangular grids of equal size, each grid representing a pixel group. Then, all pixels in the same grid are divided into corresponding pixel groups. For example, the writing and drawing area can be divided into a grid of N rows and M columns, and there are a total of N×M pixel groups, each of which contains several pixels. This grouping method is simple, efficient, and easy to implement.

[0118] (2) Grouping method based on pixel color similarity. This method first calculates the color difference between any two pixels in the writing area. Common color difference measurement methods such as Euclidean distance and Manhattan distance can be used. Then, pixels whose color difference is less than a preset threshold are divided into the same pixel group. For example, you can first select a pixel as a seed pixel, group it with pixels whose color difference is less than a threshold, and then select a new seed pixel from the remaining pixels. Repeat the above process until all pixels are assigned to pixel groups. This grouping method can aggregate pixels with similar colors, which helps to improve the effect of subsequent smoothing processing.

[0119] In step 902 of some embodiments, a smoothing process of color values ​​is performed on each pixel group obtained in step 901. The purpose of the smoothing process is to reduce the color difference inside the pixel group so that the color transition in the pixel group is more natural and coherent. This step can be implemented by a variety of algorithms, such as mean filtering, Gaussian filtering or bilateral filtering, etc., and the specific selection depends on the required smoothing effect and performance requirements. Through the smoothing process, the smoothed color value of each pixel group can be obtained, and this color value represents the comprehensive or optimized result of all pixel colors in the pixel group.

[0120] In step 903 of some embodiments, the color value of each pixel in the corresponding pixel group is updated according to the smoothed color value of each pixel group obtained in step 902. This step ensures the color consistency within the pixel group and improves the smoothness and visual quality of the overall rendering effect. The update operation can be implemented by direct assignment or interpolation method, and the specific method depends on the characteristics of the pixel group and the required update accuracy. Through this step, it can ensure that the pixel colors in the writing and drawing area are more harmonious, reduce color faults and visual noise, thereby providing a more delicate and professional writing and drawing experience.

[0121] Through step 901 to step 903, the writing and drawing prediction line elimination method of the present invention can not only effectively eliminate unnecessary prediction lines, but also improve the rendering effect of the writing and drawing area through pixel color smoothing, so that the user can enjoy a smoother and more natural visual experience when writing or drawing. This method of carefully managing pixel colors further enhances the performance and user experience of writing and drawing applications.

[0122] See also Fig.10 The embodiment of the present application further provides a device for eliminating writing and drawing prediction lines, which can implement the above-mentioned method for eliminating writing and drawing prediction lines. The device includes:

[0123] An initialization module, used for initializing the template value of each pixel in the writing and drawing area to be a first template value;

[0124] A first acquisition module is used to acquire a drawing input signal in the drawing area, render an actual drawing line in the drawing area according to the drawing input signal, and update a template value of a pixel corresponding to the actual drawing line to a second template value, where the second template value is different from the first template value;

[0125] a generating module, configured to generate a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keep the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and set the template value of the pixel portion where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value;

[0126] The second acquisition module is used to acquire the background color of the writing and drawing area, and render the pixels in the writing and drawing area whose template value is the first template value according to the background color.

[0127] The specific implementation of the device for eliminating writing and drawing prediction lines is basically the same as the specific implementation of the method for eliminating writing and drawing prediction lines mentioned above, and will not be repeated here.

[0128] See also Fig.11 , Fig.11 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0129] The processor 1101 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0130] The memory 1102 may be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1102 may store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1102, and the processor 1101 calls and executes the method for eliminating the writing and drawing prediction lines in the embodiment of this application;

[0131] Input / output interface 1103, used to implement information input and output;

[0132] The communication interface 1104 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WI FI, Bluetooth, etc.);

[0133] A bus 1105 that transmits information between various components of the device (e.g., the processor 1101, the memory 1102, the input / output interface 1103, and the communication interface 1104);

[0134] The processor 1101 , the memory 1102 , the input / output interface 1103 and the communication interface 1104 are connected to each other in communication within the device via the bus 1105 .

[0135] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method for eliminating the writing and drawing prediction lines is implemented.

[0136] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0137] The embodiment of the present application also provides a computer program product storing computer executable instructions, and the computer executable instructions are used to execute the above-mentioned method for eliminating writing and drawing prediction lines.

[0138] In one embodiment, the computer program product stores computer executable instructions, which are executed by one or more control processors, for example, Figure 2 Steps 201 to 204 of the method, Figure 4 In the method step 401, Figure 5 Steps 501 to 503 of the method, Figure 6 Steps 601 to 602 of the method, Figure 7 Steps 701 to 703 of the method, Figure 8 Method steps 801 to 804 in.

[0139] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0140] The present application proposes a method, device, electronic device and program product for eliminating predicted writing and drawing lines, which initializes the template value of each pixel in the writing and drawing area to a first template value; obtains a writing and drawing input signal in the writing and drawing area, renders actual writing and drawing lines in the writing and drawing area according to the writing and drawing input signal, and updates the template value of the pixel corresponding to the actual writing and drawing line to a second template value, which is different from the first template value; generates predicted writing and drawing lines in the writing and drawing area according to the writing and drawing input signal, and sets the template value of the pixel corresponding to the predicted writing and drawing line to the first template value; obtains the background color of the writing and drawing area, and renders the pixels in the writing and drawing area whose template value is the first template value according to the background color.

[0141] First, the present application provides a unified identification basis for subsequent actual writing and drawing line rendering, predicted writing and drawing line generation, and predicted line elimination by initializing the template value of each pixel in the writing and drawing area to the first template value. Then, after obtaining the writing and drawing input signal in the writing and drawing area, the actual writing and drawing lines are rendered in the writing and drawing area according to the writing and drawing input signal, and the template value of the pixel corresponding to the actual writing and drawing line is updated to a second template value different from the initial template value. By updating the template value, the pixel range of the actual writing and drawing line is clearly identified, which provides important reference information for the subsequent predicted writing and drawing line generation and elimination, and helps to improve the accuracy of prediction and elimination. Next, the predicted writing and drawing lines are generated in the writing and drawing area according to the writing and drawing input signal, and the template value of the pixel part where the predicted writing and drawing lines overlap with the actual writing and drawing lines is kept unchanged as the second template value, and the template value of the pixel where the predicted writing and drawing lines do not overlap with the actual writing and drawing lines is set to the first template value to distinguish it from the template value of the actual writing and drawing lines. This method of identifying different types of writing and drawing lines through template values ​​allows actual writing and drawing lines and predicted writing and drawing lines to coexist in the same writing and drawing area and can be accurately distinguished, laying the foundation for the subsequent elimination of predicted lines. Finally, the background color of the writing and drawing area is obtained, and the pixels in the writing and drawing area whose template value is the first template value are rendered according to the background color. Since the pixel template value corresponding to the predicted writing and drawing lines has been set to the first template value before, this step can accurately identify the pixel position of the predicted writing and drawing lines and use the background color for rendering, thereby achieving the visual elimination of the predicted writing and drawing lines. At the same time, since the pixel template value corresponding to the actual writing and drawing lines is the second template value, it will not be rendered by the background color, ensuring the integrity and accuracy of the actual writing and drawing content.

[0142] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, storage device storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium. It should also be understood that the various implementations provided in the embodiments of the present application can be arbitrarily combined to achieve different technical effects.

[0143] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the above implementation mode. Technical personnel familiar with the field can also make various equivalent modifications or substitutions under the shared conditions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.

Claims

1. A method for eliminating writing and drawing prediction lines, characterized in that: include: Initialize the template value of each pixel in the writing and drawing area to the first template value; Acquire a drawing input signal in the drawing area, render an actual drawing line in the drawing area according to the drawing input signal, and update a template value of a pixel corresponding to the actual drawing line to a second template value; wherein the second template value is different from the first template value; Generate a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keep the template value of the pixel part where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and set the template value of the pixel where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value; A background color of the writing and drawing area is obtained, and pixels in the writing and drawing area whose template value is the first template value are rendered according to the background color.

2. The method for eliminating writing and drawing prediction lines according to claim 1, characterized in that: The writing and drawing input signal includes a plurality of motion event data points, and generating a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keeping the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and setting the template value of the pixel where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value, comprises: Establishing a prediction equation based on a plurality of motion event data points, and obtaining predicted motion event data points according to the prediction equation; Generating the predicted writing and drawing line in the writing and drawing area according to the predicted motion event data point and a plurality of the motion event data points; The template value of the pixel corresponding to the predicted writing and drawing line is set to the first template value.

3. The method for eliminating writing and drawing prediction lines according to claim 1, characterized in that: The method of generating a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, maintaining the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line as the second template value, and setting the template value of the pixel portion where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value, comprises: Obtaining the number of motion event data points in the writing and drawing input signal; In response to the number of motion data points being greater than or equal to a preset threshold value, a predicted writing and drawing line is generated in the writing and drawing area according to the writing and drawing input signal, the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line is maintained unchanged as the second template value, and the template value of the pixel portion where the predicted writing and drawing line does not overlap with the actual writing and drawing line is set to the first template value.

4. The method for eliminating writing and drawing prediction lines according to claim 1, characterized in that: The obtaining of the drawing input signal in the drawing area, rendering the actual drawing line in the drawing area according to the drawing input signal, and updating the template value of the pixel corresponding to the actual drawing line to the second template value includes: Acquire a plurality of motion event data points and a timestamp of each of the motion event data points in the writing and drawing input signal; Connecting a plurality of the motion event data points in sequence according to the timestamp of each of the motion event data points to generate the actual writing and drawing line; The template value of the pixel corresponding to the actual writing and drawing line is updated to the second template value.

5. The method for eliminating writing and drawing prediction lines according to claim 1, characterized in that: The acquiring the background color of the writing and drawing area, and rendering the pixels in the writing and drawing area whose template value is the first template value according to the background color, comprises: Get the background color of the writing and drawing area; Traversing the template value of each pixel in the predicted writing and drawing line; In response to retrieving a pixel in the predicted writing and drawing line whose template value is equal to the first template value, setting the color of the pixel to the background color; In response to retrieving a pixel in the predicted drawing line whose template value is equal to the second template value, the color of the pixel is kept unchanged.

6. The method for eliminating writing and drawing prediction lines according to claim 1, characterized in that: After acquiring the background color of the writing and drawing area and rendering the pixels in the writing and drawing area whose template value is the first template value according to the background color, the method further includes: Grouping pixels in the writing and drawing area to obtain at least one pixel group, each of the pixel groups including at least one pixel; Smoothing the color values ​​of the pixels in each of the pixel groups to obtain a smoothed color value of each of the pixel groups; According to the smoothed color value of each pixel group, the color values ​​of the pixels in the corresponding pixel group are updated.

7. The method for eliminating writing and drawing prediction lines according to claim 1, characterized in that: Before initializing the template value of each pixel in the writing and drawing area to the first template value, the method further includes: A background color of the writing and drawing area is obtained, and pixels in the writing and drawing area whose template value is the first template value are rendered according to the background color.

8. A device for eliminating predicted lines of writing and drawing, characterized in that: include: An initialization module, used for initializing the template value of each pixel in the writing and drawing area to be a first template value; A first acquisition module is used to acquire a drawing input signal in the drawing area, render an actual drawing line in the drawing area according to the drawing input signal, and update a template value of a pixel corresponding to the actual drawing line to a second template value, where the second template value is different from the first template value; a generating module, configured to generate a predicted writing and drawing line in the writing and drawing area according to the writing and drawing input signal, keep the template value of the pixel portion where the predicted writing and drawing line overlaps with the actual writing and drawing line unchanged as the second template value, and set the template value of the pixel where the predicted writing and drawing line does not overlap with the actual writing and drawing line to the first template value; The second acquisition module is used to acquire the background color of the writing and drawing area, and render the pixels in the writing and drawing area whose template value is the first template value according to the background color.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for eliminating writing and drawing prediction lines as described in any one of claims 1 to 7 is implemented.

10. A computer program product, characterized in that The computer program product stores a program, and the program is executed by a processor to implement the method for eliminating writing and drawing prediction lines as described in any one of claims 1 to 7.