Handwriting generation method, electronic equipment and computer readable storage medium

By acquiring and generating replayed handwriting, the problem of inconsistent writing status during replay of the robot arm is solved, the efficiency and accuracy of the adjustment of handwriting generation parameters are improved, and the consistency of writing status is ensured.

CN119248168AActive Publication Date: 2025-01-03HONOR DEVICE CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, when handwriting reproduction is performed by a robotic arm, the consistency of the writing state 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 the reference application, including pressure sense and writing speed, generate playback handwriting and displaying playback handwriting on the target application to restore the writing state on the reference application, thereby improving the consistency of the writing state.

Benefits of technology

It achieves better restoring the writing status of the reference application in the target application, and improves the adjustment efficiency and accuracy of handwriting generation parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248168A_ABST
    Figure CN119248168A_ABST
Patent Text Reader

Abstract

The invention provides a handwriting generation method, electronic equipment and a computer readable storage medium. The handwriting generation method comprises the steps that handwriting data are obtained, the handwriting data are data of reference handwriting collected on a handwriting input page of a reference application, and the handwriting data comprise pressure feelings and writing speeds of a plurality of reference point positions on the reference handwriting; and according to the handwriting data and handwriting generation parameters of the target application, generating a playback handwriting, and displaying the playback handwriting on a handwriting input page of the target application, the handwriting generation parameters being used for representing an association relationship among the pressure sense, the writing speed and the handwriting width. When the replay handwriting is generated on the target application, the pressure sense and the writing speed in the process of writing the reference handwriting on the reference application can be restored, so that the consistency of the writing state corresponding to the replay handwriting and the writing state during writing on the reference application is improved, and 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 the handwriting generated on the target application with the handwriting generated on the reference application with better writing effect, the handwriting generation parameters used to determine the handwriting display effect in the target application can be adjusted. The existing handwriting comparison method generally controls the robot arm to write on the reference application according to the preset trajectory, records the position of each point in the handwriting and the time of generation, and then controls the robot arm to write on the target application according to the position and generation time of each point. After that, the reference handwriting generated on the reference application and the handwriting generated on the target application are compared, and the handwriting generation parameters of the target application are adjusted.

[0004] Due to the mechanical error of the robot arm, when the same robot arm writes on the same device, it is impossible to ensure that the writing state of the robot arm is completely consistent twice. Therefore, writing with the robot arm cannot restore the writing state of the robot arm on the display interface of the reference application, and thus cannot better adjust the handwriting generation parameters of the target application 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 of two times cannot be guaranteed when handwriting is replayed by a mechanical arm.

[0006] In order 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 in an electronic device, comprising:

[0008] 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;

[0009] The replayed handwriting is generated according to the handwriting data and the handwriting generation parameters of the target application, and the replayed handwriting is displayed 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.

[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 generating the replay handwriting on the target application based on the handwriting data, the pressure sensitivity and writing speed during 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.

[0011] In one embodiment, the replayed handwriting is composed of a plurality of target points, and the plurality of target points correspond to a plurality of reference points one by one. The electronic device determines a plurality of handwriting widths of the plurality of target points according to the data of each reference point in the handwriting data and the handwriting generation parameter, and generates the replayed handwriting according to the plurality of handwriting widths of the plurality of target points, so that the structure of the replayed handwriting can be consistent with the structure of the reference handwriting, which is convenient for comparing the replayed handwriting with 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, determines the second width of the second point according to the first pressure sensitivity of the first point based on the correlation between the pressure sensitivity and the handwriting width, 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 obtained target handwriting 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 reference handwriting and the stylus that wrote the reference handwriting, and the multiple reference points correspond to the multiple angles one by one, and 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 multiple target points according to the multiple angles, and the multiple target points correspond to the multiple pixel values ​​one by 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, and 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 finally obtained can be closer to the actual handwriting, and then 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 groups of touch screen point reporting information, and the plurality of groups of touch screen point reporting information corresponds one to one with a plurality of reference points. For any group of first touch screen point reporting information in the plurality of groups 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, and the data of the plurality of reference points is the handwriting data of the reference handwriting. By determining the handwriting data of the reference handwriting through the touch screen point reporting information, the accuracy of the obtained handwriting data can be improved.

[0016] In one embodiment, the reference application receives 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 operation, if the reference application receives a first instruction for instructing to generate the replay handwriting, the multiple sets of touch screen point reporting information are read, and the target application obtains the multiple sets of touch screen point reporting information read by the reference application through InputManager. By collecting and sending the touch screen point reporting information through InputManager, the replay handwriting can be generated on the target application without changing the parameters of the target application, thereby improving the adjustment efficiency of the 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 groups 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 handwriting generation parameters.

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

[0019] An acquisition module, used 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 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. 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 used for:

[0022] Determine 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] The replay handwriting is generated according to the plurality of handwriting widths of the plurality of target points.

[0024] In one embodiment, the handwriting generation parameters include the correlation between writing speed and handwriting width, and the correlation between pressure sensitivity and handwriting width, and the output module is specifically used for:

[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, wherein 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 used for:

[0029] According to the multiple handwriting widths of the multiple target points, the handwriting of the multiple target points is displayed in sequence, and the handwriting of the multiple target points constitutes the playback handwriting.

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

[0031] Based on the correlation between the angles and the pixel values, multiple pixel values ​​of the multiple target points are determined according to the multiple angles, the multiple target points and the multiple pixel values ​​correspond one to one, 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 is generated according to the first pixel value of the second point and the first handwriting width, the second point is any one of the multiple target points, the first pixel value is the pixel value corresponding to the second point among the multiple pixel values, the first handwriting width is the handwriting width corresponding to the second point among the multiple handwriting widths, and the handwriting of the multiple target points constitutes the replayed handwriting.

[0033] In one embodiment, the acquisition module is specifically used for:

[0034] Acquire multiple sets of touch screen point reporting information, wherein the multiple sets of touch screen point reporting information correspond to the multiple reference points one by one, 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, 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 used for:

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

[0038] In one embodiment, the acquisition module is specifically used for:

[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 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, the number of the reference handwriting is multiple, and the acquisition module is further used 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 used 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, wherein the processor is coupled to a memory, and 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 an embodiment of the present application;

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

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

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

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

[0054] Figure 7 A flowchart of generating playback handwriting provided in an embodiment of the present application;

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

[0056] Fig. 9 A specific flow chart for generating playback handwriting provided in an embodiment of the present application;

[0057] Fig.10 A comparison diagram of reference handwriting and replayed handwriting provided in an embodiment of the present application;

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

[0059] Fig.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, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also 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 prevent unnecessary details from obstructing the description of the present application.

[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, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

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

[0063] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" 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 "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" 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" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0066] For example, the electronic device described in the embodiments of the present application may be a mobile phone, a tablet computer, a handheld computer, a personal digital assistant (PDA), an augmented reality (AR) / virtual reality (VR) device, a media player, a 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 devices equipped with Devices running Harmony OS or other operating systems.

[0067] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the Android system of the layered architecture as an example to exemplify 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] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, 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, note, etc.

[0072] The application framework layer provides an application programming interface (API) and a 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 screen size, determine whether there is a status bar, lock the screen, capture the screen, 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 controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can 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 the management of call status (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 enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

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

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

[0083] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0084] The system library may 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 the fusion of 2D and 3D layers for multiple applications.

[0086] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. 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 contains 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 referred to 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 of each point, the generation time and the pre-set handwriting generation parameters (such as the correspondence between the writing speed and the handwriting form), and displays the handwriting on the display interface according to the handwriting form.

[0091] During the application development phase, the developer can adjust the handwriting generation parameters of the target application by comparing the handwriting generated by the target application with the reference handwriting generated by the reference application, wherein the reference application is a pre-set application and can be an application recognized by users as having a better writing effect.

[0092] In one embodiment, when the electronic device displays the handwriting input page of the reference application, the robotic arm is instructed to write according to a 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 that the robotic arm contacts with the touch screen during the writing process. At the same time, the electronic device records the position information and generation time of each reference point in the reference handwriting. When the electronic device displays the handwriting input page of the target application, the robotic arm is adjusted to the same working state, and the robotic 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 respectively use different handwriting generation parameters to generate handwriting. The developer can adjust the handwriting generation parameters of the target application by comparing the handwriting generated by the target application with the reference handwriting.

[0093] Due to the mechanical errors of the robotic arm, even if the same robotic arm writes on the same device, it cannot be guaranteed that the writing state of the robotic arm is completely consistent twice. Therefore, writing with the robotic arm cannot restore the writing state of the robotic arm when it writes on the reference application. Under different writing states, the difference between the handwriting generated by the target application and the reference handwriting cannot accurately reflect the difference in the handwriting generation parameters of the target application and the reference application, and thus 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 the electronic device displays the handwriting input page of the reference application, the reference application displays the reference handwriting written by the finger or stylus on the display interface, and at the same time, the reference application records the handwriting data of the reference handwriting, the handwriting data includes the pressure and writing speed of each reference point in the reference handwriting, and 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 mechanical arm for writing. Since the handwriting data includes pressure and writing speed, compared with writing through a mechanical arm, the process of generating the replay handwriting through handwriting data on the target application can better restore the pressure 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 mechanical 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] A handwriting generation method provided in an embodiment of the present application is used to display 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 notes, memos, drawing boards, etc.), and the current input state is the handwriting input state. The first application can be the above-mentioned reference application. When the stylus 21 is writing, the electronic device displays the handwriting written by the stylus 21 on the display interface.

[0098] Specifically, when the touch screen of the electronic device detects that the stylus starts 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 position, generation time, pressure sense, and event type of the corresponding point. Among them, the point is the position of the induced capacitance generated on the touch screen when the stylus contacts the touch screen, which is used to indicate the position of the touch screen contacted by the stylus. When the touch screen detects that the stylus is writing, it can collect the position of the induced capacitance generated on the touch screen according to the set sampling rate to obtain the position of each point. The pressure sense indicates the pressure sensed by the touch screen. The greater the pressure applied by the stylus to the touch screen, the greater the pressure sense; the smaller the pressure applied by the stylus to the touch screen, the smaller the pressure sense. According to the pre-set correlation between pressure and pressure sense, within the preset pressure range (for example, 0 to 100), the pressure sense 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 according to 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, the writing speed is inversely proportional to the width, and the slower the writing speed, the wider the handwriting. Taking a point as an example, for this point, the writing speed and width satisfy the formula 1: w = k / v, where w represents the width, k represents the coefficient, which is a parameter that can be adjusted, and v represents the writing speed, which is determined according to the position of the point and the adjacent points and the time of generation.

[0103] Within the preset pressure sensitivity range, the pressure sensitivity and width are in a sinusoidal relationship. Take a point as an example. For this point, when the pressure sensitivity is between 0 and 1, the pressure sensitivity and width satisfy Formula 2: F = Esin (aw + b) + t, where E, a, b, t represent coefficients, which are adjustable parameters, F represents the pressure sensitivity, and w represents the width. When the pressure is not within the preset range, the corresponding pressure sensitivity will be greater than 1 or less than 0. When the pressure sensitivity is greater than 1 and the pressure sensitivity is less than 0, the pressure sensitivity and width satisfy the preset fitting relationship. For example, when the stylus is writing on a specified application, if the pressure detected by the electronic device is greater than the pressure corresponding to the maximum pressure sensitivity (for example, 1) or less than the pressure corresponding to the minimum pressure sensitivity (for example, 0), multiple sets of pressure and corresponding handwriting width data are recorded, and then multiple sets of pressure and corresponding handwriting width data are obtained according to the correlation between the multiple sets of pressure and pressure sensitivity. Multiple sets of pressure sensitivity 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 relationship can be a linear function relationship or a polynomial function relationship.

[0104] For example, Figure 3 Indicates the change trend of handwriting width 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 the first width according to the correlation between the writing speed and the handwriting width (e.g., Formula 1) and the writing speed. The second width is determined according to the correlation between the pressure sensitivity and the handwriting width (e.g., Formula 2 or a fitting relationship) and the pressure sensitivity. Then, the two widths are weighted and summed according to the weights corresponding to the writing speed and the 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 point of the point, determines the handwriting width of multiple positions on the line connecting the point and the adjacent point according to the handwriting width of the point and the handwriting width of the adjacent point, generates handwriting connecting 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 (that is, 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 two adjacent points.

[0107] like Figure 2As shown, when the input page of the first application is in the handwriting input state, the display interface displays the available pen types. For example, the currently available pen types are pen 22 and pencil 23. When the electronic device detects the operation of selecting pencil 23, it writes according to the pencil type. During the pencil type writing process, the width and color depth of the handwriting are different depending on the user's holding posture of the stylus.

[0108] Specifically, different postures of the user holding 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 axis information of the stylus can be uploaded by the stylus to the electronic device, or can be detected by a sensor on the electronic device. The axis information includes axis tilt, axis direction, and axis size. Among them, the axis tilt refers to the tilt angle of the stylus relative to the normal of the touch screen, and the axis direction refers to the direction of the projection of the stylus on the plane where the touch screen is located. The axis size refers to the contact area between the stylus and the touch screen.

[0111] For example, Figure 4 As shown, a coordinate system is established with the point where the stylus pen contacts the touch screen as the origin of the coordinates, a first direction (e.g., a direction parallel to one side of the touch screen) as the X-axis, a second direction (e.g., a direction parallel to another side of the touch screen) as the Y-axis, and a normal direction of the touch screen as the Z-axis. OH represents the central axis of the stylus pen 41, and OP represents the central axis of the projection of the stylus pen 41 on the plane where the touch screen is located. 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 according to the axis direction and axis tilt, and can determine the handwriting direction of the handwriting according to the position of the current point where the stylus contacts the touch screen and the position of the previous point. For example, in the handwriting l, on the straight line where the connection line of the current point and the previous point is located, the direction from the previous point to the current point is the handwriting direction. The first application can determine the angle (an angle less than 90 degrees) between the stylus and the handwriting direction according to 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] Combined with the actual application of pencil writing process, it can be understood that the larger the contact area between the stylus and the touch screen, the wider the handwriting. The smaller the angle between the stylus and the handwriting direction, the higher the inclination of the stylus, the wider the handwriting, and the lighter the handwriting color. For the handwriting of any point, the color depth is determined by the pixel value. The larger the pixel value, the lighter the color, and the smaller the pixel value, the darker the color.

[0114] Exemplarily, the angle is inversely proportional to the width, and 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, and 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, and 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 according to the correlation between writing speed and handwriting width (such as formula 1) and the writing speed, determines the second width according to the correlation between pressure sensitivity and handwriting width (such as formula 2 or fitting relationship) and the pressure sensitivity, determines the third width according to the correlation between angle and handwriting width (such as formula 3) and the angle, and determines the fourth width according to 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 the writing speed, pressure sensitivity, 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 according to the correlation between angle and pixel value (such as formula 4) and the angle.

[0116] The handwriting width is obtained by the above method for each point. For each point, the first application determines the handwriting width of the adjacent point of the point, and determines the handwriting width of multiple positions on the line connecting the point and the adjacent point according to the handwriting width of the point and the handwriting width of the adjacent point.

[0117] Each point uses the above method to obtain a pixel value. For each point, the first application determines the pixel value of the adjacent point of the point, and determines the pixel values ​​of multiple positions on the line connecting the point and the adjacent point according to the pixel value of the point and the pixel value of the adjacent point, so that the pixel value between two adjacent points changes evenly. Among them, a linear interpolation algorithm can be used to determine the pixel values ​​of multiple positions on the line connecting 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 and the handwriting width and pixel value of multiple positions between adjacent points, and displays the handwriting on the display interface.

[0119] The handwriting generation method provided in an embodiment of the present application is used to collect data of reference handwriting written on a reference application, generate replay handwriting on a target application and display the replay handwriting. The reference application is an application for handwriting comparison, and the target application is an application to be debugged, such as a note, a drawing board, etc.

[0120] like Figure 5 As shown in (a) of FIG. 1 , the electronic device displays a suspended ball on the display interface, and the suspended ball displays handwriting debugging. Figure 5 As shown in (b) of FIG. 1 , when the electronic device detects that the user clicks the floating ball, the electronic device 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 produced by the stylus or finger writing is displayed on the second page. For example, the handwriting written by the stylus is "Handwritten". The second page also displays a "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) of FIG. 1 , the electronic device displays an input page (e.g., a page for creating a new note 1) of a target application (e.g., a note) on the display interface, and the input state of the input page is a handwriting input state. A floating ball is also displayed on the display interface, and handwriting debugging is displayed on the floating ball. Figure 6 As shown in (b) of FIG. 1 , when the electronic device detects that the user clicks the floating ball, the electronic device 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 playback 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 a 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 that the user opens the reference application through the function portal, it calls the WindowsManager of the application framework layer to generate a floating window, and displays the first page of the reference application in the floating window. When the electronic device detects the instruction to start handwriting collection input on the first page, it calls 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 may include only the TP reporting information of the reference point, or may 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 the 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 feed symbol (such as \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, 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, and 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 according to the initial handwriting data corresponding to the handwriting record.

[0127] In another embodiment, when the electronic device detects that the user opens the reference application through the function portal, it may not display the page of the reference application on the display interface, but call WindowsManager to generate a transparent layer on the page currently displayed on the display interface, and the transparent layer is a page that can be handwritten. In the case of a transparent layer on the display interface, the user can write at any position on the display interface. When the user writes, the InputManager is called to send the initial handwriting data to the handwriting collection module of the reference application.

[0128] Among them, the reference application stores the initial handwriting data through the handwriting collection module, and also generates corresponding reference handwriting on the display interface according to the initial handwriting data, that is, displays the reference handwriting in the floating window. The method of displaying the reference handwriting in the floating window by the reference application is the same as the method of displaying the handwriting on the display interface of the first application, 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 handwritings of multiple reference points, and the replayed handwriting is composed of handwritings of multiple target points. In one embodiment, the multiple target points correspond to the multiple reference points one by one, and for any one of the multiple target points (the second point), there is a point (the first point) corresponding to the second point in the multiple reference points. The target application determines the handwriting of each target point based on the data of each reference point in the initial handwriting data, and 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 method for determining the handwriting of the target point is introduced below by taking any target point (the second point) as an example.

[0132] In one embodiment, the initial handwriting data includes TP information of each reference point. After the target application obtains the initial handwriting data, the writing speed of the first point is determined according to the position and generation time of the first point and the points adjacent to the first point. The TP information also includes the pressure of the first point, thereby obtaining the writing speed and pressure of the first point. The target application determines the handwriting width of the second point corresponding to the first point according to the writing speed and pressure of the first point.

[0133] Specifically, the first width of the second point is determined according to 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 according to the correlation between pressure sensitivity and handwriting width, and the pressure sensitivity of the first point; and the two widths are weightedly 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 the calculation method of the handwriting width of the first application mentioned above, 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 that 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 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 the 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, and 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 points, generate handwriting connecting the second point and the adjacent points, and display it on the display interface.

[0141] In one embodiment, the target application determines the time interval between the generation time of the first point among the multiple reference points and the generation time of the first reference point based on 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 turn, 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 may be to search for initial handwriting data of the handwriting managed by the floating window, and the handwriting managed by the floating window may be the reference handwriting written in the floating window. For example, the electronic device searches for initial handwriting data of the reference handwriting from the storage path corresponding to the floating window. If there is initial handwriting data of the reference handwriting, the handwriting record corresponding to the initial handwriting data is displayed in the initialized floating window. If there is no initial handwriting data, the handwriting record is not displayed in the initialized floating window.

[0144] Afterwards, when the floating window detects the user's instruction to start handwriting collection (for example, clicking the "Start" control on the floating window), an event interception canvas is set on the floating window. InputManager monitors touch events on the touch screen. When a touch event (i.e., writing with a stylus or finger) is detected, 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 the 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 interception canvas, the IO stream is opened 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, the data of the reference points in the memory is periodically streamed 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), the corresponding handwriting record is generated according to 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: Fig. 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 has opened the replay page and detects that the user has selected 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 undergoing handwriting replay). 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 number of data of the current reference point in the memory. When the number of data of the current reference point in the memory is less than the preset value (i.e., the handwriting is insufficient), the data of other reference points in the file will continue to be read into the memory. When the number of data of the reference point in the memory is greater than the preset value (i.e., the handwriting is sufficient), the number of data of the reference point in the memory will continue to be monitored. When the number of data of the reference point in the memory is less than the preset value after the data in the memory is read and cleared, the data of other reference points in the file will continue to be read into the memory.

[0148] After setting the replay semi-transparent 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 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 (i.e., switches the receiving TP point information from the touch screen to reading 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 replay handwriting.

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

[0150] For example, Fig.10 (a) is the reference handwriting. Fig.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 sensitivity from 0 to 1. The more levels of pressure sensitivity obtained by division, the higher the pressure sensitivity. The width of the handwriting in the replayed handwriting does not change significantly, indicating 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, the handwriting is replayed in the target application, and the following is obtained. Fig.10 The replayed handwriting is shown in (c) in Figure 1. It can be seen that the handwriting obtained after 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] Exemplarily, the display interface of the first electronic device displays a handwriting input page of the reference application, and when a stylus or finger is detected to be writing, the reference application obtains initial handwriting data, determines the handwriting width according to the initial handwriting data, and displays the reference handwriting written by the stylus or finger on the display interface. At the same time, the fourth application records the initial handwriting data.

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

[0154] The second electronic device downloads the handwriting data through the target application, and the target application 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 according to the TP reporting information in the initial handwriting data, and determines the handwriting width of the corresponding target point according to the writing speed and pressure of the reference point. Afterwards, the target application determines the position of the corresponding target point according to 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, so as to obtain the replayed handwriting.

[0155] like Fig.11 As shown, a handwriting generation method provided in an embodiment of the present application includes:

[0156] S1101: Acquire handwriting data, where the handwriting data is data of 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, Figure 5 As shown, when the display interface displays the second page of the reference application, 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 the 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 groups of TP reporting information of multiple reference points and axis information corresponding to each reference point. For each group of axis information, the angle and axis size corresponding to the reference point can be determined according to the axis information. Among them, the angle is the angle between the handwriting pen that writes the reference handwriting and the handwriting direction of the reference handwriting. Correspondingly, the handwriting data obtained according to the initial handwriting data includes the writing speed, pressure sensitivity, angle and axis size of each reference point in the multiple reference points.

[0160] In one embodiment, if Figure 7 As shown, when the display interface displays 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 displays the input page of the target application, the electronic device runs the reference application according to the instruction to run the reference application. When the reference application is in the running state, if the first instruction for instructing to generate a replay handwriting is received, 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. Among them, the initial handwriting data includes TP reporting information of multiple reference points, or the initial handwriting data includes TP reporting information and axis information corresponding to each reference point in multiple reference points. By reading and sending the initial handwriting data through the InputManager, the target application can 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 way the target application reads the handwriting data, so that the handwriting generation parameters of the target application can be adjusted 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 page of the reference application. When the number of reference handwritings associated with the reference application is multiple, the reference application can establish multiple reference handwriting indexes based on the handwriting record. For example, Figure 6 As shown, when it is necessary to generate a replay 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, the handwriting data includes writing speed and pressure sensitivity, and the handwriting generation parameters include the correlation between writing speed and handwriting width, and 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., the second point), there is a first point corresponding to the second point among the multiple reference points. 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 the writing speed and the 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 the pressure sensitivity and the 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 sensitivity to obtain the handwriting width of the second point. By determining the handwriting width of the target point according to the writing speed and the pressure sensitivity, the writing speed and pressure sensitivity 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 sensitivity in the reference handwriting writing process.

[0164] In another embodiment, the handwriting data also includes the angle and axis size corresponding to each reference point in the plurality of reference points. After the target application determines the first width and the second width of the second point, the target application determines the third width of the second point according to the correlation between the angle and the handwriting width (e.g., Formula 3) and the angle of the first unit, and determines the fourth width according to the correlation between the axis size and the handwriting width (e.g., Formula 5) and the axis size of the first point. The first width, the second width, the third width, and the fourth width are weighted and summed to obtain the handwriting width of the second point.

[0165] The position of the second point is the same as that of the first point, or the relative position of the second point is the same as that of the first point. 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 playback handwriting composed of the handwriting of multiple target points can be obtained.

[0167] In one embodiment, the handwriting data also includes the angle corresponding to each reference point among multiple reference points, and the handwriting generation parameters also include the correlation between the angle and the pixel value. The target application determines the pixel value corresponding to each target point according to the correlation between the angle and the pixel value and the angle corresponding to each reference point, and obtains multiple pixel values. Among them, the pixel value is used to characterize the color of the handwriting of the target point, for example, it can be 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 angle of the first point corresponding to the second point.

[0168] The angle reflects the posture of the stylus in space, and further reflects the degree of inclination of the stylus relative to the touch screen. The width of the target point is determined according to the writing speed, pressure sensitivity, angle and posture of the stylus of the corresponding reference point, and the pixel of the target point is determined according to the posture of the stylus. The writing speed, pressure sensitivity and inclination 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, pressure sensitivity and inclination of the stylus during the writing process of the reference handwriting.

[0169] After determining the pixel value, handwriting width and position corresponding to each target point among 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 replayed handwriting.

[0170] In one embodiment, after the handwriting of multiple target points is determined, the target application sequentially displays the handwriting of multiple target points on the display interface, so that an 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 of the corresponding target point. When displaying the handwriting of multiple target points, the target application displays the handwriting of each target point in sequence at the same time interval, so that the handwriting can be replayed at the same writing speed on the display interface.

[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 generating the replay handwriting on the target application based on the handwriting data, the pressure sensitivity and writing speed during 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.

[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 the present application.

[0174] Fig.12 A schematic structural diagram of an 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 is to be understood that the structure illustrated in the embodiment 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 in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure 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 processor (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), etc. 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] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

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

[0181] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic 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 in 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] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change 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 1 or N display screens 194, where N is a positive integer greater than 1.

[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 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in 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 the pressure signal and can convert the pressure signal into an electrical signal. 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 parallel plate including at least two conductive materials. 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 acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to 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 control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position 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 the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

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

[0191] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be 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 in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in 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, which 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, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code 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 disk or an optical disk.

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

[0194] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0195] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0196] Finally, it should be noted that the above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A handwriting generation method, characterized in that: include: 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; The replayed handwriting is generated according to the handwriting data and the handwriting generation parameters of the target application, and the replayed handwriting is displayed 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.

2. The method according to claim 1, characterized in that The generating of the playback handwriting according to the handwriting data and the handwriting generation parameters of the target application comprises: Determine 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; The replay handwriting is generated according to the plurality of handwriting widths of the plurality of target points.

3. The method according to claim 2, characterized in that The handwriting generation parameters include the correlation between writing speed and handwriting width, and the correlation between pressure sensitivity and handwriting width. Determining multiple handwriting widths of multiple target points according to the handwriting data and the handwriting generation parameters includes: 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, wherein 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 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; The handwriting width of the second point is determined according to the first width and the second width.

4. The method according to claim 2, characterized in that: Displaying the replayed handwriting on the handwriting input page of the target application includes: According to the multiple handwriting widths of the multiple target points, the handwriting of the multiple target points is displayed in sequence, and the handwriting of the multiple target points constitutes the playback handwriting.

5. The method according to claim 2, characterized in that: The handwriting data also includes a plurality of angles between the handwriting pen that writes the reference handwriting and the handwriting direction of the reference handwriting, the plurality of reference points correspond to the plurality of angles one by one, the handwriting generation parameters are also used to characterize the correlation between the angles and the pixel values, and 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, multiple pixel values ​​of the multiple target points are determined according to the multiple angles, the multiple target points and the multiple pixel values ​​correspond one to one, and the pixel values ​​are used to represent the color of the handwriting of the corresponding 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, the second point is any one of the multiple target points, the first pixel value is the pixel value corresponding to the second point among the multiple pixel values, the first handwriting width is the handwriting width corresponding to the second point among the multiple handwriting widths, and the handwriting of the multiple target points constitutes the replayed handwriting.

6. The method according to any one of claims 1 to 5, characterized in that: The step of obtaining handwriting data comprises: Acquire multiple sets of touch screen point reporting information, wherein the multiple sets of touch screen point reporting information correspond to the multiple reference points one by one, 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, 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.

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

8. The method according to claim 7, characterized in that When the reference application is in a running state, the target application obtains the multiple groups 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 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.

9. The method according to claim 8, characterized in that The number of the reference handwritings is multiple, and after the reference application receives multiple groups of touch screen point reporting information of the reference handwritings collected by InputManager and stores the multiple groups 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.

10. An electronic device, characterized in that: The method 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 9.

11. 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 9 is implemented.

Citation Information

Patent Citations

  • Information processing method and electronic pen

    CN104345917A

  • Implementation method and implementation device for original handwriting as well as electronic equipment

    CN104345948A

  • Method for presenting force touch screen handwriting input as writing pen featured handwriting

    CN108335340A

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

    CN108776575A

  • Handwriting sensing system, and handwriting input control device and method therefor

    CN112654958A