Handwriting generation method, electronic device and computer-readable storage medium

By generating and replaying handwriting on the target application and utilizing the correlation between pressure sensitivity and writing speed, the problem of inconsistent writing status of the robotic arm is solved, and a better handwriting display effect is achieved.

CN119248168BActive Publication Date: 2025-10-10HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410026983.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-04
Publication Date
2025-10-10
Estimated Expiration
2044-01-04

AI Technical Summary

Technical Problem

In the prior art, when handwriting is replayed by a robotic arm, the consistency of the two writing states cannot be guaranteed, resulting in the inability to accurately adjust the handwriting generation parameters of the target application.

Method used

By obtaining handwriting data on a reference application, including pressure sensitivity and writing speed, replay handwriting is generated and displayed on a target application. The handwriting generation parameters of the target application are adjusted by utilizing the correlation between pressure sensitivity, writing speed and handwriting width.

Benefits of technology

Improves the consistency of the writing status between the replayed handwriting and the reference handwriting, enables better adjustment of the handwriting generation parameters of the target application, and improves the handwriting display effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248168B_ABST
    Figure CN119248168B_ABST
Patent Text Reader

Abstract

The application provides a handwriting generation method, an electronic device and a computer readable storage medium. The handwriting generation method comprises: obtaining handwriting data, the handwriting data being data of reference handwriting collected on a handwriting input page of a reference application, the handwriting data comprising pressure and writing speed of a plurality of reference points on the reference handwriting; generating replay handwriting according to the handwriting data and handwriting generation parameters of a target application, the handwriting generation parameters being used to represent the correlation between pressure, writing speed and handwriting width; and displaying the replay handwriting on a handwriting input page of the target application. When the replay handwriting is generated on the target application, the pressure and writing speed in the process of writing the reference handwriting on the reference application can be restored, thereby improving the consistency between the writing state corresponding to the replay handwriting and the writing state when writing on the reference application, so that the handwriting generation parameters of the target application can be better adjusted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal devices, and in particular to a handwriting generation method, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the trend towards paperless office, there are more and more applications on electronic devices that can be input by handwriting, such as notes and drawings, and their functions are becoming more and more abundant.

[0003] By comparing handwriting generated on a target application with handwriting generated on a reference application with better writing results, the handwriting generation parameters used to determine the handwriting display effect in the target application can be adjusted. Existing handwriting comparison methods generally control a robotic arm to write on a reference application along a preset trajectory, record the position and generation time of each point in the handwriting, and then control the robotic arm to write on the target application based on the position and generation time of each point. Afterwards, the reference handwriting generated on the reference application is compared with the handwriting generated on the target application, and the handwriting generation parameters of the target application are adjusted.

[0004] Due to mechanical errors in the robotic arm, there's no guarantee that the same robotic arm will write in exactly the same state twice on the same device. Therefore, writing with the robotic arm can't recreate the same state as on the reference application's display interface, making it impossible to better adjust the target application's handwriting generation parameters based on the generated handwriting. Summary of the Invention

[0005] The present application provides a handwriting replay method, an electronic device and a computer-readable storage medium, which solves the problem in the prior art that the consistency of the writing states cannot be guaranteed when handwriting is replayed by a robotic arm.

[0006] To achieve the above objectives, this application adopts the following technical solutions:

[0007] In a first aspect, a handwriting playback method is provided, which is executed on an electronic device and includes:

[0008] Acquiring handwriting data, wherein the handwriting data is data of a reference handwriting collected on a handwriting input page of a reference application, the handwriting data including pressure sensitivity and writing speed of multiple reference points on the reference handwriting;

[0009] The replayed handwriting is generated according to the handwriting data and handwriting generation parameters of the target application, and the replayed handwriting is displayed on the handwriting input page of the target application. The handwriting generation parameters are used to characterize the correlation between pressure sensitivity, writing speed and handwriting width.

[0010] In the above embodiment, the handwriting data acquired by the electronic device includes the pressure sensitivity and writing speed of each reference point of the reference handwriting collected on the reference application. Therefore, when replaying handwriting on the target application based on the handwriting data, the pressure sensitivity and writing speed of the reference handwriting written on the reference application can be restored, thereby improving the consistency between the writing state corresponding to the replay handwriting and the writing state when writing on the reference application, thereby better adjusting the handwriting generation parameters of the target application.

[0011] In one embodiment, the replayed handwriting is composed of multiple target points, each of which corresponds to a plurality of reference points. The electronic device determines multiple handwriting widths for the multiple target points based on the data of each reference point in the handwriting data and handwriting generation parameters, and generates the replayed handwriting based on the multiple handwriting widths for the multiple target points. This ensures that the structure of the replayed handwriting is consistent with that of the reference handwriting, facilitating comparison between the replayed handwriting and the reference handwriting.

[0012] In one embodiment, the handwriting data includes the pressure sensitivity and writing speed of multiple reference points, and the handwriting generation parameters include the correlation between the writing speed and the handwriting width, and the correlation between the pressure sensitivity and the handwriting width. For any second point among the multiple target points, there is a first point corresponding to the second point among the multiple reference points. Based on the correlation between the writing speed and the handwriting width, the electronic device determines the first width of the second point according to the first writing speed of the first point, based on the correlation between the pressure sensitivity and the handwriting width, determines the second width of the second point according to the first pressure sensitivity of the first point, and determines the handwriting width of the second point according to the first width and the second width. By determining the handwriting width through the pressure sensitivity and the writing speed, the target handwriting obtained can be made close to the handwriting produced in the actual writing process, thereby improving the writing effect of the handwriting in the target application.

[0013] In one embodiment, the electronic device displays the handwriting of multiple target points in sequence according to the multiple handwriting widths of the multiple target points, and obtains the replayed handwriting composed of the handwriting of the multiple target points, so that the writing process of the replayed handwriting can be presented on the display interface, which is convenient for the subsequent adjustment of the handwriting generation parameters of the target application.

[0014] In one embodiment, the handwriting data also includes multiple angles between the handwriting direction of the stylus that wrote the reference handwriting and the reference handwriting, and the multiple reference points correspond to the multiple angles one-to-one. The handwriting generation parameters are also used to characterize the correlation between the angles and the pixel values. Based on the correlation between the angles and the pixel values, the electronic device determines multiple pixel values ​​of the multiple target points according to the multiple angles. The multiple target points correspond to the multiple pixel values ​​one-to-one, and the pixel values ​​are used to characterize the color of the handwriting of the corresponding target points. For any second point among the multiple target points, the handwriting of the second point is generated according to the first pixel value of the second point and the first handwriting width, and then the handwriting of the multiple target points is obtained. The handwriting of the multiple target points constitutes the replayed handwriting. By determining the handwriting of each target point by pixels and width, the replayed handwriting obtained can be closer to the actual written handwriting, and the handwriting generation parameters of the target application can be better adjusted.

[0015] In one embodiment, the electronic device obtains a plurality of pre-stored sets of touch screen point reporting information, and the plurality of sets of touch screen point reporting information corresponds one to one with a plurality of reference points. For any one set of first touch screen point reporting information in the plurality of sets of touch screen point reporting information, the first touch screen point reporting information includes a first position, a first generation time, and a first pressure sense. The electronic device determines the first writing speed of the first point corresponding to the first touch screen point reporting information based on the first position and the first generation time, and can obtain the first writing speed and the first pressure sense corresponding to the first point, that is, obtain the data of the first point, and then obtain the data of the plurality of reference points. The data of the plurality of reference points is the handwriting data of the reference handwriting. Determining the handwriting data of the reference handwriting through the touch screen point reporting information can improve the accuracy of the obtained handwriting data.

[0016] In one embodiment, a reference application receives and stores multiple sets of touchscreen point reporting information collected by the InputManager. While the reference application is running, upon receiving a first instruction to generate the replayed handwriting, the reference application reads the multiple sets of touchscreen point reporting information. The target application then obtains the multiple sets of touchscreen point reporting information read by the reference application via the InputManager. By collecting and distributing the touchscreen point reporting information via the InputManager, replayed handwriting can be generated on the target application without changing the target application's parameters, thereby improving the efficiency of adjusting handwriting generation parameters.

[0017] In one embodiment, the reference application is associated with multiple reference handwritings. The reference application generates corresponding handwriting records based on multiple sets of touch screen point reporting information of the reference handwritings, and establishes indexes of multiple reference handwritings based on the handwriting records, so that the handwriting of multiple stored reference handwritings can be replayed at the same time, thereby improving the adjustment efficiency of the handwriting generation parameters.

[0018] In a second aspect, a handwriting generation device is provided, comprising:

[0019] An acquisition module, configured to acquire handwriting data, wherein the handwriting data is data of a reference handwriting collected on a handwriting input page of a reference application, and the handwriting data includes pressure sensitivity and writing speed of multiple reference points on the reference handwriting;

[0020] The output module is used to generate replayed handwriting based on the handwriting data and handwriting generation parameters of the target application, and display the replayed handwriting on the handwriting input page of the target application. The handwriting generation parameters are used to characterize the correlation between pressure sensitivity, writing speed and handwriting width.

[0021] In one embodiment, the output module is specifically configured to:

[0022] Determining a plurality of handwriting widths of a plurality of target points according to the handwriting data and the handwriting generation parameters, wherein the plurality of target points correspond to the plurality of handwriting widths in a one-to-one manner;

[0023] Replay handwriting is generated according to the multiple handwriting widths of the multiple target points.

[0024] In one embodiment, the handwriting generation parameters include a correlation between writing speed and handwriting width, and a correlation between pressure sensitivity and handwriting width. The output module is specifically configured to:

[0025] Based on the correlation between the writing speed and the handwriting width, determining a first width of a second point according to a first writing speed of the first point, where the second point is any one of the multiple target points, and the first point is a point among the multiple reference points corresponding to the second point;

[0026] Based on the correlation between the pressure sensitivity and the handwriting width, determining the second width of the second point according to the first pressure sensitivity of the first point;

[0027] The handwriting width of the second point is determined according to the first width and the second width.

[0028] In one embodiment, the output module is specifically configured to:

[0029] The handwritings of the target points are displayed in sequence according to the plurality of handwriting widths of the target points, and the handwritings of the target points constitute the playback handwriting.

[0030] In one embodiment, the handwriting data further includes a plurality of angles between a handwriting pen used to write the reference handwriting and a handwriting direction of the reference handwriting, the plurality of reference points corresponding to the plurality of angles, and the handwriting generation parameters are further used to characterize the correlation between the angles and the pixel values. The output module is specifically configured to:

[0031] Based on the correlation between the angles and the pixel values, determining a plurality of pixel values ​​of the plurality of target points according to the plurality of angles, wherein the plurality of target points correspond to the plurality of pixel values ​​in a one-to-one manner, and the pixel values ​​are used to represent the color of the handwriting of the corresponding target points;

[0032] The handwriting of the second point position is generated according to the first pixel value of the second point position and the first handwriting width, wherein the second point position is any one of the multiple target point positions, the first pixel value is the pixel value corresponding to the second point position among the multiple pixel values, the first handwriting width is the handwriting width corresponding to the second point position among the multiple handwriting widths, and the handwriting of the multiple target point positions constitutes the replayed handwriting.

[0033] In one embodiment, the acquisition module is specifically configured to:

[0034] Acquire multiple sets of touch screen point reporting information, wherein the multiple sets of touch screen point reporting information correspond one-to-one to the multiple reference points, wherein the first touch screen point reporting information includes a first position, a first generation time, and a first pressure sense, and the first touch screen point reporting information is any set of the multiple sets of touch screen point reporting information;

[0035] A first writing speed is determined according to the first position and the first generation time, where the first writing speed is the writing speed of a first point among the multiple reference points, and the first pressure sensitivity is the pressure sensitivity of the first point.

[0036] In one embodiment, the acquisition module is specifically configured to:

[0037] When the reference application is in a running state, the target application obtains the multiple sets of touch screen point reporting information read by the reference application through InputManager.

[0038] In one embodiment, the acquisition module is specifically configured to:

[0039] The reference application receives the multiple sets of touch screen point reporting information collected by InputManager and stores the multiple sets of touch screen point reporting information;

[0040] When the reference application is in a running state, if the reference application receives a first instruction, the reference application reads the multiple sets of touch screen point reporting information, and the target application obtains the multiple sets of touch screen point reporting information read by the reference application through InputManager, and the first instruction is used to instruct the generation of the playback handwriting.

[0041] In one embodiment, there are multiple reference handwritings, and the acquisition module is further configured to:

[0042] The reference application generates corresponding handwriting records according to the multiple groups of touch screen point reporting information of the reference handwriting, and the handwriting records are used to establish multiple indexes of the reference handwriting.

[0043] In a third aspect, an electronic device is provided, comprising a processor, wherein the processor is configured to execute a computer program stored in a memory to implement the handwriting generation method as described in the first aspect above.

[0044] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the handwriting generation method as described in the first aspect is implemented.

[0045] In a fifth aspect, a chip is provided, comprising a processor coupled to a memory, wherein the processor executes a computer program or instruction stored in the memory to implement the handwriting generation method as described in the first aspect above.

[0046] In a sixth aspect, a computer program product is provided. When the computer program product is run on an electronic device, the electronic device executes the handwriting generation method described in the first aspect.

[0047] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A software architecture diagram of an electronic device provided in one embodiment of the present application;

[0049] Figure 2 This is an interface diagram of a handwriting generation method provided in one embodiment of the present application;

[0050] Figure 3 A graph showing the correlation between handwriting width and pressure sensitivity provided in one embodiment of the present application;

[0051] Figure 4 A schematic diagram of the positional relationship between a stylus pen and a touch screen provided in an embodiment of the present application;

[0052] Figure 5 This is an interface diagram for collecting reference handwriting provided in one embodiment of the present application;

[0053] Figure 6 This is an interface diagram for generating and replaying handwriting provided in an embodiment of the present application;

[0054] Figure 7 A flowchart of generating and replaying handwriting provided in one embodiment of the present application;

[0055] Figure 8A specific flow chart for collecting initial handwriting data provided in one embodiment of the present application;

[0056] Figure 9 A specific flow chart for generating and replaying handwriting provided in an embodiment of the present application;

[0057] Figure 10 A comparison chart of reference handwriting and replayed handwriting provided in an embodiment of the present application;

[0058] Figure 11 A flowchart of a handwriting generation method provided in one embodiment of the present application;

[0059] Figure 12 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0060] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.

[0061] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.

[0062] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0063] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0064] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0065] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0066] For example, the electronic device described in the embodiments of the present application may be a mobile phone, tablet computer, handheld computer, personal digital assistant (PDA), augmented reality (AR) / virtual reality (VR) device, media player, wearable device, or other device that can be held / operated with one hand. The embodiments of the present application do not impose any special restrictions on the specific form / type of the electronic device. The above-mentioned electronic devices include but are not limited to those equipped with Devices running Harmony OS or other operating systems.

[0067] The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system with a layered architecture is used as an example to illustrate the software structure of the electronic device.

[0068] Figure 1 It is a software structure block diagram of the electronic device according to an embodiment of the present invention.

[0069] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0070] The application layer can include a series of application packages.

[0071] like Figure 1 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, drawing, and note.

[0072] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0073] like Figure 1 As shown, the application framework layer may include a window manager (WindowsManager), a content provider, a view system, a phone manager, a resource manager, a notification manager, an input manager (inputmanager), and the like.

[0074] The input manager is used to read input events and dispatch input events.

[0075] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.

[0076] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0077] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.

[0078] The phone manager is used to provide communication functions for electronic devices, such as call status management (including answering, hanging up, etc.).

[0079] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0080] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.

[0081] Android Runtime includes core libraries and a virtual machine. Android Runtime is responsible for scheduling and management of the Android system.

[0082] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0083] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0084] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0085] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0086] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0087] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0088] A 2D graphics engine is a drawing engine for 2D drawings.

[0089] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.

[0090] When the electronic device is in the handwriting input state, the handwriting written by the finger or stylus can be displayed on the display interface. The method for generating handwriting is as follows. When the handwriting input page is displayed on the display interface of the electronic device, the touch screen of the electronic device collects the position information of the points where the finger or stylus contacts the touch screen and the contact time of each point (also known as the generation time of the point), and sends the position information and generation time of each point to the application where the handwriting input page is located. The application determines the handwriting form according to the position information, generation time and pre-set handwriting generation parameters of each point (such as the correspondence between writing speed and handwriting form), and displays the handwriting on the display interface according to the handwriting form.

[0091] In the development stage of the application, the developer can adjust the handwriting generation parameters of the target application by comparing the handwriting generated by the target application and the reference handwriting generated by the reference application. The reference application is a pre-set application, which can be an application with a good writing effect recognized by users.

[0092] In an embodiment, when the electronic device displays the handwriting input page of the reference application, the mechanical arm is instructed to write according to the preset trajectory, and the reference application displays the reference handwriting on the display interface according to the position information and generation time of each reference point position in contact with the touch screen during the writing process of the mechanical arm. At the same time, the electronic device records the position information and generation time of each reference point position in the reference handwriting. When the electronic device displays the handwriting input page of the target application, the mechanical arm is adjusted to the same working state, and the mechanical arm is instructed to write according to the same position information and at the same writing speed, and the target application displays the corresponding handwriting on the display interface. The reference application and the target application generate handwriting respectively by using different handwriting generation parameters, and the developer can adjust the handwriting generation parameters of the target application by comparing the handwriting generated by the target application and the reference handwriting.

[0093] Since the mechanical arm has mechanical errors, even if the same mechanical arm writes on the same device, it cannot be guaranteed that the writing state of the mechanical arm is completely consistent twice, therefore, writing by the mechanical arm cannot restore the writing state of the mechanical arm when writing on the reference application, and in different writing states, the difference between the handwriting generated by the target application and the reference handwriting cannot accurately reflect the difference between the handwriting generation parameters of the target application and the reference application, and further cannot better adjust the handwriting generation parameters of the target application.

[0094] To this end, the present application provides a handwriting generation method. When the display interface of an electronic device displays the handwriting input page of a reference application, the reference application displays the reference handwriting written by a finger or a stylus on the display interface. At the same time, the reference application records the handwriting data of the reference handwriting. The handwriting data includes the pressure sensitivity and writing speed of each reference point in the reference handwriting. The reference application is an application with a better writing effect. Afterwards, when the electronic device displays the handwriting input page (replay page) of the target application, the target application reads the handwriting data and generates the replay handwriting according to the handwriting data and the handwriting generation parameters of the target application, so that the replay handwriting can be generated directly on the target application according to the handwriting data without using a robotic arm for writing. Since the handwriting data includes pressure sensitivity and writing speed, compared to writing through a robotic arm, the process of generating the replay handwriting through the handwriting data on the target application can better restore the pressure sensitivity and speed when writing on the first application, so that the writing state when writing on the reference application can be better restored without using a robotic arm to rewrite, thereby improving the consistency of the writing state on the target application and the reference application. Since the reference handwriting is generated according to the handwriting generation parameters on the reference application, the writing effect is better, and the replayed handwriting is generated according to the handwriting generation parameters on the target application, therefore, when the writing state consistency is better, by comparing the replayed handwriting and the reference handwriting, the handwriting generation parameters of the target application can be better adjusted.

[0095] The handwriting generation method provided in the embodiment of the present application is introduced in detail below.

[0096] An embodiment of the present application provides a handwriting generation method for displaying written handwriting on a display interface.

[0097] For example, Figure 2 As shown, the display interface of the electronic device displays the input page of the first application (such as a note, memo, sketchpad, etc.), and the current input state is the handwriting input state. The first application can be the reference application mentioned above. When the stylus 21 is writing, the electronic device displays the handwriting of the stylus 21 on the display interface.

[0098] Specifically, when the touch screen of an electronic device detects that a stylus has started writing, it reports the touch screen (touch panel, TP) reporting information of each point (i.e., reporting point) where the stylus contacts the touch screen. Each set of TP reporting information includes the location of the corresponding point, the time of generation, the pressure sensitivity, and the event type. Among them, the point is the location of the induced capacitance generated on the touch screen when the stylus contacts the touch screen, which is used to indicate the location of the touch screen where the stylus contacts the touch screen. When the touch screen detects that the stylus is writing, it can collect the location of the induced capacitance generated on the touch screen according to the set sampling rate to obtain the location of each point. The pressure sensitivity indicates the amount of pressure sensed by the touch screen. The greater the pressure applied by the stylus to the touch screen, the greater the pressure sensitivity; the smaller the pressure applied by the stylus to the touch screen, the smaller the pressure sensitivity. According to the pre-set correlation between pressure and pressure sensitivity, within a pre-set pressure range (e.g., 0 to 100), the pressure sensitivity is a value between 0 and 1. The event type corresponding to each point is press (down), release (UP), or slide (move). For example, among the points of a stroke, the event type of the first contact point of the stylus is press, the event type of the last contact point of the stylus is release, and the event type of the points between the first contact point and the last contact point is slide.

[0099] When the InputManager of the electronic device monitors the touch operation on the touch screen, it sends the collected TP point information to the first application in sequence. The first application determines the handwriting width based on each group of TP point information and the preset handwriting generation parameters, and displays the handwriting of the corresponding width on the display interface.

[0100] Specifically, the first application starts displaying the handwriting from the position where the event type is pressed, and sequentially connects the points where the event type is sliding, and stops displaying the handwriting at the position where the event type is released.

[0101] During the handwriting display process, for each point, the first application determines the writing speed corresponding to the point based on the position and generation time of the point and adjacent points, and then determines the handwriting width corresponding to the point based on the writing speed and pressure sensitivity corresponding to the point.

[0102] For example, writing speed and width are inversely proportional: the slower the writing speed, the wider the handwriting. For a single point, for example, the writing speed and width satisfy the formula 1: w = k / v, where w represents the width, k represents a coefficient (a tunable parameter), and v represents the writing speed, which is determined by the position of the point and adjacent points, as well as the time of creation.

[0103] Within a preset pressure sensitivity range, pressure sensitivity and width have a sinusoidal relationship. For a single point, for example, when pressure sensitivity is between 0 and 1, the relationship between pressure sensitivity and width satisfies Formula 2: F = Esin(aw + b) + t, where E, a, b, and t represent coefficients and adjustable parameters, F represents pressure sensitivity, and w represents width. When pressure is outside the preset range, the pressure sensitivity will be greater than 1 or less than 0. When the pressure sensitivity is greater than 1 or less than 0, the pressure sensitivity and width satisfy a preset fitting relationship. For example, when writing with a stylus pen on a designated application, if the pressure detected by the electronic device is greater than the pressure corresponding to the maximum pressure sensitivity (e.g., 1) or less than the pressure corresponding to the minimum pressure sensitivity (e.g., 0), multiple sets of pressure and corresponding handwriting width data are recorded. Based on the correlation between the multiple sets of pressure and pressure sensitivity, multiple sets of pressure and corresponding handwriting width data are then obtained. The multiple sets of pressure and handwriting width data are fitted to obtain the relationship between pressure sensitivity and width when the pressure sensitivity is greater than 1, and the relationship between pressure sensitivity and width when the pressure sensitivity is less than 0. The relational expression can be a linear function relational expression or a polynomial function relational expression.

[0104] For example, Figure 3 Indicates the trend of handwriting width changing with pressure sensitivity. When the pressure sensitivity is 0, 0.5, and 1, the corresponding handwriting width can be determined according to the sine relationship. When the pressure sensitivity is greater than 1 and less than 0, the corresponding handwriting width is determined according to the corresponding fitting relationship.

[0105] For each point, the first application determines a first width based on the correlation between writing speed and handwriting width (e.g., Formula 1) and the writing speed. A second width is determined based on the correlation between pressure sensitivity and handwriting width (e.g., Formula 2 or a fitting relationship) and the pressure sensitivity. Subsequently, the two widths are weighted and summed based on the weights corresponding to the writing speed and pressure sensitivity, respectively, to obtain the handwriting width corresponding to the point.

[0106] For each point, after determining the handwriting width of the point, the first application determines the handwriting width of the adjacent points of the point, and based on the handwriting width of the point and the handwriting width of the adjacent points, determines the handwriting width of multiple positions on the line connecting the point and the adjacent points, generates handwriting connecting the two adjacent points according to the corresponding handwriting width and displays it on the display interface, so that the handwriting width of the handwriting connecting the two adjacent points changes smoothly (i.e., the handwriting width gradually increases or the handwriting width gradually decreases). Among them, a linear interpolation algorithm can be used to determine the handwriting width of multiple positions on the line connecting the two adjacent points.

[0107] like Figure 2As shown, when the input page of the first application is in the handwriting input mode, the display interface shows the available pen types. For example, the currently available pen types are pen 22 and pencil 23. When the electronic device detects the selection of pencil 23, it writes using the pencil type. During pencil writing, the width and color of the handwriting vary depending on the user's holding position of the stylus.

[0108] Specifically, different user holding postures of the stylus result in different postures of the stylus in space, which in turn result in different angles between the stylus and the handwriting direction and different contact areas between the stylus and the touch screen, which in turn result in different widths and color depths of the handwriting.

[0109] In one embodiment, the first application determines the posture of the stylus and the contact area between the stylus and the touch screen according to the axis information of the stylus, and determines the angle between the stylus and the handwriting direction according to the posture of the stylus and the handwriting direction.

[0110] Specifically, the stylus's axis information can be uploaded to the electronic device by the stylus or detected by sensors on the electronic device. This axis information includes axis tilt, axis direction, and axis size. Axis tilt refers to the stylus's tilt angle relative to the touchscreen's normal, while axis direction refers to the direction of the stylus's projection on the touchscreen's plane. Axis size refers to the contact area between the stylus and the touchscreen.

[0111] For example, Figure 4 As shown, a coordinate system is established with the point where the stylus touches the touch screen as the coordinate origin, a first direction (e.g., parallel to one edge of the touch screen) as the X-axis, a second direction (e.g., parallel to another edge of the touch screen) as the Y-axis, and the normal to the touch screen as the Z-axis. OH represents the center axis of the stylus 41, and OP represents the center axis of the projection of the stylus 41 onto the plane of the touch screen. The angle between OP and the OZ axis is the axis tilt, and the angle between OH and the OX axis is the axis direction.

[0112] The first application can determine the posture of the stylus in three-dimensional space based on the axis direction and axis tilt, and can determine the handwriting direction based on the position of the current point where the stylus contacts the touch screen and the position of the previous point. For example, in handwriting l, on the straight line connecting the current point and the previous point, the direction from the previous point to the current point is the handwriting direction. The first application can determine the angle (less than 90 degrees) between the stylus and the handwriting direction based on the posture and handwriting direction of the stylus. For example, the angle r between the central axis OH of the stylus and the handwriting direction OL is the angle between the stylus and the handwriting direction.

[0113] In practical applications, when writing with a pencil, we can understand that the larger the contact area between the stylus and the touchscreen, the wider the handwriting. The smaller the angle between the stylus and the writing direction, and the higher the stylus tilt, the wider and lighter the handwriting. The color depth of any handwriting point is determined by the pixel value: larger pixel values ​​indicate lighter colors, while smaller pixel values ​​indicate darker colors.

[0114] Exemplarily, the angle is inversely proportional to the width. The smaller the angle, the wider the handwriting. For example, the angle and width satisfy Formula 3: w = m / g, where w represents the width, m represents the coefficient, which is a parameter that can be adjusted, and g represents the angle. The angle is inversely proportional to the pixel value. The smaller the angle, the larger the pixel value. For example, the angle and pixel value satisfy Formula 4: s = n / g, where s represents the pixel value, n represents the coefficient, which is a parameter that can be adjusted, and g represents the angle. The axis size is directly proportional to the width. The larger the axis size, the wider the handwriting. For example, the width and axis size satisfy Formula 5: w = u / q, where w represents the width, u represents the coefficient, and q represents the axis size.

[0115] For each point, the first application determines the first width based on the correlation between writing speed and handwriting width (such as Formula 1) and the writing speed, determines the second width based on the correlation between pressure and handwriting width (such as Formula 2 or fitting relationship) and the pressure, determines the third width based on the correlation between angle and handwriting width (such as Formula 3) and the angle, and determines the fourth width based on the correlation between axis size and handwriting width (such as Formula 5) and the axis size. Afterwards, the first application performs weighted summation of the four widths according to the weights corresponding to writing speed, pressure, angle, and axis size, respectively, to obtain the handwriting width corresponding to the point. The first application also determines the pixel value corresponding to the point based on the correlation between angle and pixel value (such as Formula 4) and the angle.

[0116] The handwriting width is obtained at each point using the above method. For each point, the first application determines the handwriting width of the adjacent points of the point, and based on the handwriting width of the point and the handwriting width of the adjacent points, determines the handwriting width of multiple positions on the line connecting the point and the adjacent points.

[0117] The above method is used to obtain a pixel value for each point. For each point, the first application determines the pixel values ​​of the points adjacent to the point. Based on the pixel value of the point and the pixel values ​​of the adjacent points, the pixel values ​​of multiple positions on the line connecting the point and the adjacent points are determined, so that the pixel values ​​between the two adjacent points vary uniformly. A linear interpolation algorithm can be used to determine the pixel values ​​of multiple positions on the line connecting the two adjacent points.

[0118] Afterwards, the first application generates handwriting connecting two adjacent points according to the handwriting width and pixel value of each point, as well as the handwriting width and pixel value of multiple positions between adjacent points, and displays the handwriting on the display interface.

[0119] An embodiment of the present application provides a handwriting generation method for collecting reference handwriting data written on a reference application, generating and displaying replayed handwriting on a target application. The reference application is the application used for handwriting comparison, and the target application is the application to be debugged, such as a notepad or sketchpad application.

[0120] like Figure 5 As shown in (a) of FIG, the electronic device displays a floating ball on the display interface, and the floating ball displays handwriting debugging. Figure 5 As shown in (b) of FIG, when the electronic device detects that the user clicks the floating ball, it displays the first page of the reference application in the form of a floating window on the display interface, and the first page of the reference application displays the "Start" control. Figure 5 As shown in (c) in the figure, when the electronic device detects the operation of clicking the "Start" control, it determines to start handwriting collection and displays the second page of the reference application on the display interface. When the electronic device detects that the stylus is writing on the second page, the handwriting generated by the stylus or finger writing is displayed on the second page. For example, the handwriting written by the stylus is "Handwriting". The second page also displays the "Close" control. Figure 5 As shown in (d), when the electronic device detects the operation of clicking the "Close" control, it displays the first page of the reference application on the display interface, and displays the handwriting record "Record 1" corresponding to the written handwriting on the first page.

[0121] like Figure 6 As shown in (a) in the figure, the electronic device displays the input page (e.g., the page for creating a new note 1) of the target application (e.g., note) on the display interface, and the input state of the input page is the handwriting input state. The display interface also displays a floating ball, which displays handwriting debugging. Figure 6 As shown in (b) of FIG, when the electronic device detects that the user clicks the floating ball, it displays the first page of the reference application in the form of a floating window on the display interface. The first page of the reference application displays the "Start" control and the handwriting record "Record 1". Figure 6 As shown in (c), when the electronic device detects the operation of clicking "Record 1", it closes the first page of the reference application, plays the generation process of the replayed handwriting "handwriting" on the target application, and displays the replayed handwriting "handwriting" after writing.

[0122] In one embodiment, the process of generating the playback handwriting is as follows: Figure 7 shown.

[0123] A reference application and a target application are installed on the electronic device, and the reference application includes a handwriting collection module, a handwriting storage module, and a handwriting replay module. The reference application includes a function entrance, and the user can open the page of the reference application through the function entrance. For example, the function entrance can be an application icon displayed on the desktop of the electronic device, and the electronic device opens the page of the reference application according to the user clicking the application icon. For another example, when the electronic device detects that the user minimizes the reference application after opening the reference application, the electronic device displays a floating ball on the display interface, and displays the indication information corresponding to the reference application (such as the handwriting debugging logo) or the icon of the reference application in the floating ball. The electronic device opens the page of the reference application when it detects that the user clicks the floating ball.

[0124] When the electronic device detects a user opening a reference application through a function portal, it invokes the WindowsManager of the application framework layer to generate a floating window, displaying the first page of the reference application in the floating window. When the electronic device detects an input command to begin handwriting collection on the first page, it invokes the InputManager to collect initial handwriting data and sends the initial handwriting data to the handwriting collection module. The handwriting collection module stores the collected initial handwriting data in the handwriting storage module.

[0125] Among them, the initial handwriting data is the data of the reference handwriting written on the first page, and the initial handwriting data includes the data of each reference point in the reference handwriting. The data of the reference point can include only the TP reporting information of the reference point, or can include the TP reporting information of the reference point and the axis information of the handwriting pen corresponding to the reference point. Exemplarily, each reference point corresponds to a TP reporting information and axis information. The TP reporting information and axis information are stored in the handwriting storage module according to a preset format. For example, each reference point corresponds to a set of data, and the data includes multiple fields, and the multiple fields are used to identify the point coordinate X, point coordinate Y, point generation time, time type, axis tilt, axis direction and axis size of the reference point, respectively, and each field can be separated by a space. The data of each reference point can be stored in sequence according to the generation time of each reference point, and the data of two reference points can be separated by a line break symbol (for example, \n).

[0126] When the page of the target application is displayed on the display interface of the electronic device, if it is detected that the user selects the handwriting record operation, the handwriting replay instruction is sent to the handwriting replay module, and the handwriting replay module reads the initial handwriting data corresponding to the handwriting record from the handwriting storage module according to the handwriting replay instruction, and sends the initial handwriting data corresponding to the handwriting record to the InputManager. The InputManager then sends the initial handwriting data corresponding to the handwriting record to the target application, and the target application generates the replayed handwriting based on the initial handwriting data corresponding to the handwriting record.

[0127] In another embodiment, upon detecting a user opening a reference application through a function portal, the electronic device may not display the reference application's page on the display interface. Instead, it may call WindowsManager to generate a transparent layer on the currently displayed page on the display interface. This transparent layer is a page that allows handwriting input. With the transparent layer on the display interface, the user can write anywhere on the display interface. As the user writes, InputManager is called to send the initial handwriting data to the handwriting collection module of the reference application.

[0128] The reference application not only stores the initial handwriting data via the handwriting acquisition module but also generates corresponding reference handwriting on the display interface based on the initial handwriting data, i.e., displays the reference handwriting in a floating window. The method for displaying the reference handwriting in the floating window by the reference application is the same as the method for displaying handwriting on the display interface by the first application described above, and will not be repeated here.

[0129] The method by which the target application generates replayed handwriting based on the initial handwriting data is as follows.

[0130] The reference handwriting is composed of handwriting at multiple reference points, and the replayed handwriting is composed of handwriting at multiple target points. In one embodiment, the multiple target points correspond to the multiple reference points in a one-to-one manner. For any one of the multiple target points (the second point), there exists a point (the first point) in the multiple reference points that corresponds to the second point. The target application determines the handwriting of each target point based on the data of each reference point in the initial handwriting data. The handwriting composed of the handwriting of each target point is the replayed handwriting.

[0131] The method for determining the handwriting of each target point is the same. The following takes any target point (the second point) as an example to introduce the method for determining the handwriting of the target point.

[0132] In one embodiment, the initial handwriting data includes TP information for each reference point. After obtaining the initial handwriting data, the target application determines the writing speed of the first point based on the position and generation time of the first point and its adjacent points. The TP information also includes the pressure sensitivity of the first point, thereby obtaining the writing speed and pressure sensitivity of the first point. The target application then determines the handwriting width of a second point corresponding to the first point based on the writing speed and pressure sensitivity of the first point.

[0133] Specifically, the first width of the second point is determined based on the correlation between writing speed and handwriting width, and the writing speed of the first point; the second width of the second point is determined based on the correlation between pressure sensitivity and handwriting width, and the pressure sensitivity of the first point; and the two widths are weighted and summed according to the weights corresponding to the writing speed and pressure sensitivity respectively to obtain the handwriting width corresponding to the second point.

[0134] The calculation method of the handwriting width is the same as that of the first application, and will not be repeated here.

[0135] After determining the handwriting width of the second point, the handwriting of the second point can be obtained according to the position of the second point and the handwriting width. The position of the second point can be the same as or different from the position of the first point. When the positions of the first point and the second point are different, the relative position of the first point in the reference handwriting is the same as the relative position of the second point in the replayed handwriting. For example, the reference points in the reference handwriting are sorted according to the generation time of each reference point, and the order of the first point in the reference handwriting is the same as the order of the second point in the replayed handwriting. In this case, the relative position of the first point and the first reference point of the reference handwriting can be used as the relative position of the second point and the first target point of the replayed handwriting. According to the position and relative position of the first target point, the position of the second point can be determined. The position of the first target point can be specified by the user or randomly determined by the target application.

[0136] In another embodiment, the initial handwriting data includes the TP reporting information of each reference point and the corresponding axis information. After the target application obtains the initial handwriting data, it determines the writing speed of the first point according to the position and generation time of the first point and the points adjacent to the first point, and determines the angle between the stylus and the handwriting direction and the axis size according to the axis information corresponding to the first point. Afterwards, the target application determines the first width of the second point according to the correlation between the writing speed and the handwriting width, and the writing speed of the first point; determines the second width of the second point according to the correlation between the pressure and the handwriting width, and the pressure of the first point; determines the third width of the second point according to the correlation between the angle and the handwriting width and the angle corresponding to the first point, and determines the fourth width of the second point according to the correlation between the axis size and the handwriting width and the axis size corresponding to the first point. Afterwards, the target application performs a weighted summation of the four widths according to the weights corresponding to the writing speed, pressure, angle, and axis size, and obtains the handwriting width corresponding to the second point. At the same time, the target application determines the pixel value of the second point according to the correlation between the angle and the pixel value and the angle corresponding to the first point.

[0137] The calculation method of the handwriting width and pixel value is the same as the calculation method of the handwriting width of the first application mentioned above, and will not be repeated here.

[0138] After the handwriting width and pixel value of the second point are determined, the handwriting of the second point can be obtained according to the position, handwriting width and pixel value of the second point.

[0139] The handwriting of all target points is determined according to the above method for determining the handwriting of the second point. The target application displays the handwriting of each target point in turn to obtain the replayed handwriting.

[0140] In one embodiment, similar to the first application determining the handwriting width (and pixel value) of multiple positions between adjacent points, the target application can also determine the handwriting width (and pixel value) of multiple positions between the second point and the adjacent point, generate handwriting connecting the second point and the adjacent point, and display it on the display interface.

[0141] In one embodiment, the target application determines the time interval between the first reference point and the generation time of the first reference point according to the generation time of the multiple reference points, and uses the time interval of the first point as the time interval of the corresponding second point. After obtaining the handwriting of the first target point and displaying the handwriting of the first target point, the handwriting of the second point is displayed according to the time interval of the second point, so that the handwriting of each target point can be displayed in sequence, and the writing speed of the replayed handwriting is made the same as the writing speed of the reference handwriting.

[0142] In one embodiment, the specific process of collecting initial handwriting data is as follows: Figure 8 shown.

[0143] When the electronic device detects the operation of opening a floating window (i.e., a reference application), it determines whether it has floating window permission. If there is no floating window permission, the electronic device displays a permission application interface on the display interface. If there is floating window permission, the electronic device initializes the floating window and displays the initialized floating window on the display interface. Among them, initializing the floating window can be to search for the initial handwriting data of the handwriting managed by the floating window, and the handwriting managed by the floating window can be the reference handwriting written in the floating window. For example, the electronic device searches for the initial handwriting data of the reference handwriting from the storage path corresponding to the floating window. If the initial handwriting data of the reference handwriting exists, the handwriting record corresponding to the initial handwriting data is displayed in the initialized floating window. If the initial handwriting data does not exist, the handwriting record is not displayed in the initialized floating window.

[0144] Afterwards, when the floating window detects a user instruction to start handwriting capture (for example, by clicking the "Start" control on the floating window), it sets up an event interception canvas on the floating window. The InputManager listens for touch events on the touch screen. When a touch event (i.e., a stylus or finger writing) is detected, the InputManager reports the initial handwriting data generated by the touch event. The event interception canvas intercepts the touch event and records the initial handwriting data to memory, which can be a cache.

[0145] Wherein, the initial handwriting data includes data of multiple reference points, and recording the initial handwriting data into the memory means recording the data of each reference point into the memory in sequence according to the generation time of each reference point. After the floating window sets the event to intercept the canvas, it opens the IO stream at the same time to monitor the data of multiple reference points in the memory and write the data of multiple reference points in the memory into the file of the specified path. In one embodiment, when the floating window detects the addition of reference point data in the memory, it periodically streams the data of the reference points in the memory into the specified file. Wherein, periodic streaming writing can refer to writing the data of each reference point in sequence according to the generation time of each reference point. When the floating window determines that the handwriting collection is finished (for example, clicking the "Close" control on the floating window), it generates a corresponding handwriting record based on the initial handwriting data recorded in the file, and the handwriting record can be displayed on the floating window.

[0146] In one embodiment, the specific process of generating the playback handwriting is as follows: Figure 9 shown.

[0147] When the electronic device detects the operation of opening a floating window, it determines whether it has floating window permission. If there is no floating window permission, the electronic device displays a permission application interface on the display interface. If there is floating window permission, the electronic device initializes the floating window and displays the initialized floating window on the display interface. The handwriting record is displayed in the initialized floating window. When the floating window detects that the user opens the replay page and detects that the user selects the handwriting record, a replay translucent window is set on the replay page (for example, a border is added to the writing area of ​​the repeat interface or a prompt text is added to the replay page to remind the user that the current interface is replaying the handwriting). Afterwards, the floating window creates a file reading thread to open the IO stream to read the initial handwriting data in the file into the memory. Among them, reading the initial handwriting data into the memory means reading the data of each reference point into the memory in sequence according to the generation time of each reference point. The floating window determines the amount of data for the current reference point in the memory. When the amount of data for the current reference point in the memory is less than the preset value (i.e., insufficient handwriting), the data for other reference points in the file will continue to be read into the memory. When the amount of data for the reference point in the memory is greater than the preset value (i.e., sufficient handwriting), the number of data for the reference point in the memory will continue to be monitored. If the amount of data for the reference point in the memory is less than the preset value after the data in the memory is read and cleared, the data for other reference points in the file will continue to be read into the memory.

[0148] After setting up the replay translucent interface, the floating window also creates a replay event thread to read the reference point data from the memory when it detects that there is reference point data in the memory. After the floating window reads the reference point data from the memory, it performs interval asynchronous playback of the reference point data. Interval asynchronous playback means that the floating window reads the reference point data and sends the reference point data at the same time, and when sending the reference point data, it determines the time interval between the generation times of adjacent points based on the generation time of each reference point, and sends the data of each reference point at the same time interval. The floating window sending the reference point data means that the floating window generates an input event based on the reference point data read, and sends the input event to the InputManager. InputManager switches the data reading channel according to the received input events (that is, switches the TP point information received from the touch screen to reading the input events from the floating window), obtains the data of the reference point according to the read input events, generates a replay event according to the data of the reference point, and sends the replay event to the application where the replay page is located. The application where the replay page is located obtains the data of each reference point according to the replay event, determines the handwriting of each corresponding target point according to the data of each reference point, and displays the handwriting of each target point in turn on the replay page to obtain the replayed handwriting.

[0149] After obtaining the reference handwriting generated by the reference application and the replayed handwriting generated by the target application, the reference handwriting and the replayed handwriting are compared, and the handwriting generation parameters of the target application can be adjusted.

[0150] For example, Figure 10 (a) is the reference handwriting. Figure 10 (b) in the figure is the replayed handwriting. It can be seen that there is no pen-lifting detail of the first stroke “,” in the replayed handwriting, which indicates that the pressure sensitivity in the handwriting generation parameters of the target application is low. Among them, the same pressure range is divided into multiple levels of pressure from 0 to 1. The more levels of pressure obtained, the higher the pressure sensitivity. The width of the handwriting in the replayed handwriting does not change significantly, which indicates that the width change parameters of the replayed handwriting need to be adjusted. Since there are mixed changes in writing speed and pressure during the writing process, the correlation between speed and handwriting width, as well as the correlation between pressure and handwriting width in the handwriting generation parameters can be adjusted. By increasing the pressure sensitivity in the handwriting generation parameters, resetting the correlation between speed and handwriting width, as well as the correlation between pressure and handwriting width, and replaying the handwriting in the target application, the following is obtained. Figure 10 The replayed handwriting is shown in (c) in the figure. It can be seen that the handwriting obtained by adjusting the handwriting generation parameters can retain the stroke details and the thickness changes of the strokes are more vivid.

[0151] An embodiment of the present application provides a handwriting generation method for replaying handwriting on display interfaces of different devices.

[0152] For example, the display interface of the first electronic device displays a handwriting input page of a reference application. When a stylus or finger is detected writing, the reference application obtains initial handwriting data, determines a handwriting width based on the initial handwriting data, and displays the reference handwriting written by the stylus or finger on the display interface. Simultaneously, the fourth application records the initial handwriting data.

[0153] When the reference application detects an operation to upload handwriting data, it uploads the initial handwriting data to the server.

[0154] The second electronic device downloads the handwriting data through the target application, which can be the same application as the reference application. When the target application detects that the user selects the handwriting data for handwriting replay, it determines the writing speed and pressure of each reference point in the reference handwriting based on the TP reporting information in the initial handwriting data, and determines the handwriting width of the corresponding target point based on the writing speed and pressure of the reference point. Afterwards, the target application determines the position of the corresponding target point based on the relative position of each reference point in the reference handwriting, and uses the time interval between the generation time of each reference point and the first reference point as the time interval between the generation time of the corresponding target point and the first target point. Starting from the first target point, the handwriting of each target point is displayed in sequence according to the handwriting width of each target point, the position of each target point, and the time interval between each target point and the first target point to obtain the replayed handwriting.

[0155] like Figure 11 As shown, the handwriting generation method provided in one embodiment of the present application includes:

[0156] S1101: Acquire handwriting data, where the handwriting data is data of a reference handwriting collected on a handwriting input page of a reference application, and the handwriting data includes pressure sensitivity and writing speed of multiple reference points on the reference handwriting.

[0157] Specifically, if Figure 5 As shown, when the second page of the reference application is displayed on the display interface, the reference application collects the initial handwriting data of the reference handwriting. Figure 6 As shown, when the input page of the target application is displayed on the display interface, the target application obtains the initial handwriting data read by the reference application and obtains handwriting data according to the initial handwriting data.

[0158] In one embodiment, the initial handwriting data includes multiple groups of TP reporting information for multiple reference points, and the multiple groups of touch screen reporting information correspond one to one to the multiple reference points. Any group of TP reporting information (first TP reporting information) in the multiple groups of touch screen reporting information includes a first position, a first generation time, and a first pressure sense. The target application determines a first writing speed based on the first position and the first generation time. The first writing speed is the writing speed of the first point corresponding to the first TP reporting information, and the first pressure sense in the first TP reporting information is the pressure sense of the first point. The writing speed and pressure sense corresponding to each group of touch screen reporting information are the writing speed and pressure sense of a reference point.

[0159] In another embodiment, the initial handwriting data includes multiple sets of TP reporting information for multiple reference points and axis information corresponding to each reference point. For each set of axis information, the angle and axis size corresponding to the reference point can be determined based on the axis information. The angle is the angle between the stylus used to write the reference handwriting and the handwriting direction of the reference handwriting. Correspondingly, the handwriting data obtained based on the initial handwriting data includes the writing speed, pressure sensitivity, angle, and axis size of each of the multiple reference points.

[0160] In one embodiment, if Figure 7 As shown, when the display interface shows the second page of the reference application, the reference application receives the initial handwriting data of the reference handwriting collected by the InputManager and stores the initial handwriting data. When the display interface shows the input page of the target application, the electronic device runs the reference application according to the instruction to run the reference application. While the reference application is running, if it receives a first instruction to generate a replay handwriting, the reference application reads the initial handwriting data and sends the initial handwriting data to the InputManager. The target application obtains the initial handwriting data read by the reference application through the InputManager. The initial handwriting data includes TP reporting information for multiple reference points, or the initial handwriting data includes TP reporting information and axis information corresponding to each reference point in the multiple reference points. Reading and sending the initial handwriting data through the InputManager allows the target application to obtain the initial handwriting data from the InputManager. Since the InputManager is used to collect handwriting input information, the replay handwriting can be generated without changing the method by which the target application reads handwriting data, thereby adjusting the handwriting generation parameters of the target application without changing the target application.

[0161] In one embodiment, the reference application collects and stores the initial handwriting data and generates a handwriting record corresponding to the initial handwriting data. Figure 5As shown, the reference application generates a handwriting record and displays the handwriting record on the reference application page. When the number of reference handwritings associated with the reference application is multiple, the reference application can create multiple reference handwriting indexes based on the handwriting record. For example, Figure 6 As shown, when it is necessary to generate a replayed handwriting, the initial handwriting data corresponding to the handwriting record can be read through the handwriting record.

[0162] S1102: Generate replayed handwriting according to the handwriting data and handwriting generation parameters of the target application, and display the replayed handwriting on the handwriting input page of the target application, wherein the handwriting generation parameters are used to characterize the correlation between pressure sensitivity, writing speed and handwriting width.

[0163] In one embodiment, handwriting data includes writing speed and pressure sensitivity, and handwriting generation parameters include the correlation between writing speed and handwriting width, as well as the correlation between pressure sensitivity and handwriting width. The reference handwriting is composed of multiple reference points, and the replayed handwriting is composed of multiple target points. For any target point (i.e., a second point), there is a first point among the multiple reference points that corresponds to the second point. The target application determines the handwriting width of the second point based on the handwriting data of the first point. Specifically, the target application determines the first width of the second point according to the first writing speed of the first point based on the correlation between writing speed and handwriting width (for example, Formula 1), determines the second width of the second point according to the first pressure of the first point based on the correlation between pressure and handwriting width (for example, Formula 2), and determines the handwriting width of the second point according to the first width and the second width. For example, the first width and the second width are weightedly summed according to the weight corresponding to the writing speed and the weight corresponding to the pressure to obtain the handwriting width of the second point. By determining the handwriting width of the target point according to the writing speed and pressure, the writing speed and pressure of the target point and the corresponding reference point can be made consistent, so that the generation process of the replayed handwriting can better restore the writing speed and pressure during the reference handwriting writing process.

[0164] In another embodiment, the handwriting data further includes the angle and axis size corresponding to each of the multiple reference points. After determining the first width and second width of the second point, the target application determines the third width of the second point based on the relationship between the angle and the handwriting width (e.g., Formula 3) and the angle of the first unit, and determines the fourth width based on the relationship between the axis size and the handwriting width (e.g., Formula 5) and the axis size of the first point. A weighted sum of the first width, the second width, the third width, and the fourth width is performed to obtain the handwriting width of the second point.

[0165] The second point has the same position as the first point, or the relative positions of the second point and the first point are the same, the relative position of the second point refers to the position of the second point relative to the first target point, and the relative position of the first point refers to the position of the first point relative to the first reference point.

[0166] The target application determines the position of the second point according to the position of the first point, or determines the position of the second point according to the relative position corresponding to the first point and the position of the first target point. After determining the position of the second point, the handwriting of the second point can be generated according to the handwriting width of the second point, that is, the handwriting of any target point can be generated. After generating the handwriting of multiple target points, the replay handwriting composed of the handwriting of multiple target points can be obtained.

[0167] In an embodiment, the handwriting data further includes an included angle corresponding to each reference point in the multiple reference points, and the handwriting generation parameter further includes an association relationship between the included angle and the pixel value. The target application determines the pixel value corresponding to each target point according to the association relationship between the included angle and the pixel value and the included angle corresponding to each reference point, and obtains multiple pixel values. The pixel value is used to represent the color of the handwriting of the target point, for example, the depth of the color. Specifically, for any target point (second point), the target application determines the first pixel value of the second point according to the included angle of the first point corresponding to the second point.

[0168] The included angle reflects the posture of the handwriting pen in space, and further reflects the inclination degree of the handwriting pen relative to the touch screen. The width of the target point is determined according to the writing speed, pressure, included angle and posture of the handwriting pen of the corresponding reference point, and the pixel of the target point is determined according to the posture of the handwriting pen, so that the writing speed, pressure and inclination degree of the handwriting pen of the target point and the corresponding reference point can be consistent, and further the generation process of the replay handwriting can better restore the writing speed, pressure and inclination degree of the handwriting pen in the handwriting process of the reference handwriting.

[0169] After determining the pixel value, handwriting width and position of each target point in the multiple target points, for any second point, the handwriting width is the first handwriting width, the pixel value is the first pixel value, and the target application generates the handwriting of the second point at the corresponding position according to the first pixel value and the first handwriting width of the second point, that is, the handwriting of any target point can be generated, and the handwriting of each target point constitutes the replay handwriting.

[0170] In an embodiment, after determining the handwriting of the multiple target points, the target application displays the handwriting of the multiple target points on the display interface in sequence, so that the animation of the replay handwriting writing process can be presented on the display interface. After the display interface displays the handwriting of all target points, the replay handwriting is obtained.

[0171] In one embodiment, the target application determines the time interval between each reference point and the time interval between each reference point and the first reference point, and uses the time interval as the time interval for the corresponding target point. When displaying handwriting at multiple target points, the target application sequentially displays the handwriting at each target point at the same time interval, thereby allowing handwriting to be replayed on the display interface at the same writing speed.

[0172] In the above embodiment, the handwriting data acquired by the target application includes the pressure sensitivity and writing speed of each reference point of the reference handwriting collected on the reference application. Therefore, when replaying handwriting generated on the target application based on the handwriting data, the pressure sensitivity and writing speed during the reference handwriting writing process on the reference application can be restored, thereby improving the consistency between the writing state corresponding to the replay handwriting and the writing state when writing on the reference application, thereby better adjusting the handwriting generation parameters of the target application.

[0173] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0174] Figure 12 A schematic structural diagram of the electronic device 100 is shown.

[0175] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0176] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0177] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0178] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0179] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0180] In some embodiments, processor 110 may include one or more interfaces.

[0181] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0182] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0183] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0184] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

[0185] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0186] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0187] The pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a device comprising at least two parallel plates with conductive material. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is applied to the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.

[0188] The touch sensor 180K is also called a "touch-sensitive device." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a location different from that of the display screen 194.

[0189] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of this application. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here.

[0190] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0191] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0192] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.

[0193] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0194] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / network device and method can be implemented in other manners. For example, the embodiments of the apparatus / network device described above are merely schematic, and the division of the modules or units is merely logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.

[0195] Those skilled in the art can clearly understand the units and algorithm steps of each example described in combination with the embodiments disclosed in the present application, which can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0196] Finally, it should be noted that: the above description is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto, any changes or replacements within the technical scope disclosed by the present application should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A handwriting generation method, characterized in that: include: Acquiring handwriting data, the handwriting data being data of a reference handwriting collected on a handwriting input page of a reference application, the handwriting data including pressure sensitivity, writing speed, angles, and axis sizes of multiple reference points on the reference handwriting, the angles being multiple angles between a stylus used to write the reference handwriting and a handwriting direction of the reference handwriting, and the axis sizes being contact areas between the stylus and a touch screen displaying the reference handwriting corresponding to the multiple reference points; Determining multiple handwriting widths of multiple target points according to the handwriting data and handwriting generation parameters of the target application; generating a replayed handwriting according to the multiple handwriting widths of the multiple target points, and displaying the replayed handwriting on the handwriting input page of the target application, wherein the handwriting generation parameter is used to characterize the correlation between pressure sensitivity, writing speed and handwriting width; The handwriting generation parameters include a first correlation between writing speed and handwriting width, a second correlation between pressure sensitivity and handwriting width, a third correlation between angle and handwriting width, and a fourth correlation between axis size and handwriting width. The determining of multiple handwriting widths of multiple target points based on the handwriting data and the handwriting generation parameters of the target application includes: Based on the first association relationship, determining a first width of a second point according to a first writing speed of the first point, where the second point is any one of the multiple target points, and the first point is a point among the multiple reference points corresponding to the second point; Based on the second association relationship, determining a second width of the second point according to the first pressure sensation of the first point; Based on the third association relationship, determining a third width of the second point according to the first angle of the first point; Based on the fourth association relationship, determining a fourth width of the second point according to the first axis size of the first point; The handwriting width of the second point is determined based on the first width, the second width, the third width, the fourth width, and the first weight corresponding to the first width, the second weight corresponding to the second width, the third weight corresponding to the third width, and the fourth weight corresponding to the fourth width.

2. The method according to claim 1, characterized in that Displaying the replayed handwriting on the handwriting input page of the target application includes: The handwritings of the target points are displayed in sequence according to the plurality of handwriting widths of the target points, and the handwritings of the target points constitute the playback handwriting.

3. The method according to claim 1, characterized in that The handwriting generation parameter is further used to characterize the correlation between the angle and the pixel value. The replay handwriting is generated according to the plurality of handwriting widths of the plurality of target points, including: Based on the correlation between the angles and the pixel values, determining a plurality of pixel values ​​of the plurality of target points according to the plurality of angles, wherein the plurality of target points correspond to the plurality of pixel values ​​in a one-to-one manner, and the pixel values ​​are used to represent the color of the handwriting of the corresponding target points; The handwriting of the second point position is generated according to the first pixel value of the second point position and the first handwriting width, wherein the second point position is any one of the multiple target point positions, the first pixel value is the pixel value corresponding to the second point position among the multiple pixel values, the first handwriting width is the handwriting width corresponding to the second point position among the multiple handwriting widths, and the handwriting of the multiple target point positions constitutes the replayed handwriting.

4. The method according to any one of claims 1 to 3, characterized in that The obtaining of handwriting data includes: Acquire multiple sets of touch screen point reporting information, wherein the multiple sets of touch screen point reporting information correspond one-to-one to the multiple reference points, wherein the first touch screen point reporting information includes a first position, a first generation time, and a first pressure sense, and the first touch screen point reporting information is any set of the multiple sets of touch screen point reporting information; A first writing speed is determined according to the first position and the first generation time, where the first writing speed is the writing speed of a first point among the multiple reference points, and the first pressure sensitivity is the pressure sensitivity of the first point.

5. The method according to claim 4, characterized in that The step of obtaining multiple sets of touch screen reporting information includes: When the reference application is in a running state, the target application obtains the multiple sets of touch screen point reporting information read by the reference application through InputManager.

6. The method according to claim 5, characterized in that When the reference application is in a running state, the target application obtains the multiple sets of touch screen point reporting information read by the reference application through InputManager, including: The reference application receives the multiple sets of touch screen point reporting information collected by InputManager and stores the multiple sets of touch screen point reporting information; When the reference application is in a running state, if the reference application receives a first instruction, the reference application reads the multiple sets of touch screen point reporting information, and the target application obtains the multiple sets of touch screen point reporting information read by the reference application through InputManager, and the first instruction is used to instruct the generation of the playback handwriting.

7. The method according to claim 6, characterized in that There are multiple reference handwritings. After the reference application receives multiple sets of touch screen point reporting information of the reference handwritings collected by InputManager and stores the multiple sets of touch screen point reporting information, the method further includes: The reference application generates corresponding handwriting records according to the multiple groups of touch screen point reporting information of the reference handwriting, and the handwriting records are used to establish multiple indexes of the reference handwriting.

8. An electronic device, characterized in that: The device comprises a processor configured to execute a computer program stored in a memory to implement the method according to any one of claims 1 to 7.

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

Citation Information

Patent Citations

  • Information processing method and electronic pen

    CN104345917A

  • User handwritten note synchronization method, electronic book reading equipment and storage medium

    CN108776575A