Terminal device and handwriting generation method
By obtaining the touch point position and pressure value during writing on the terminal device, calculating the radius value and target number, and adjusting the pixel point value to simulate the writing effect of the pencil or brush, the problems of poor effect and distortion in the prior art are solved. , achieves display closer to the actual writing effect.
Patent Information
- Application Number
- CN202210609248.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2042-05-31
AI Technical Summary
The prior art is difficult to effectively simulate the writing effect of a pencil or brush, resulting in poorer effects when displayed on terminal devices, especially when zooming in or shrinking, distortion and brush-like effects are prone to occur.
By obtaining the position and pressure values of the touch points during writing, calculating the radius value and the number of targets, and using these values to determine the pixel values of pixels in the target circle, randomly adjusting to simulate the writing effect of a pencil or brush.
It improves the authenticity of the writing effect and is close to the actual writing situation, avoids distortion problems, and enhances the simulation ability of the pencil or brush writing effect.
Smart Images

Figure CN114924658B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a terminal device and a handwriting generation method. Background Art
[0002] With the development of electronic products, handwriting input has become popular as a unique way of human-computer interaction. It is relatively simple to display ballpoint pen handwriting on the screen. The terminal device only needs to determine the handwriting and fill the center of the handwriting with different colors, and control the screen to display it. However, it is difficult to display handwriting with textures such as pencils and brushes. However, pencils and brushes, as representatives of hard pen calligraphy, are of great significance to the art of Chinese calligraphy.
[0003] The current method of determining the writing effect of pencils and brushes is to cover the touch points with different black and white pixel images to form a writing effect. However, the effect of covering the touch points with black and white pixel images is often poor in actual applications. During the process of zooming in or out, distortion will occur because the black and white pixel images covering each touch point are the same. At the same time, this solution will produce a brush-like effect. Figure 1a , Figure 1b and Figure 1c is a schematic diagram of a black and white pixel image in the prior art, Figure 1a , Figure 1b and Figure 1c It can be seen that different black and white pixel images only have different pixel values, and will not differ much with the different writing trajectories of users. Figure 2 It is a schematic diagram of writing effect in the prior art. Figure 2 It can be seen that covering the touch points with different black and white pixel images will result in poor writing effects and a brush-like effect. Summary of the invention
[0004] The embodiments of the present application provide a terminal device, a handwriting generation method, an apparatus and a medium, which are used to solve the problem in the prior art that when writing through the device, the writing effect of a pencil or a brush is poor and cannot simulate the actual writing effect.
[0005] In a first aspect, an embodiment of the present application provides a terminal device, the terminal device comprising:
[0006] A display, the display being used for displaying;
[0007] A processor configured to execute:
[0008] Acquire a first writing position corresponding to a touch point and a target pressure value of the touch during the writing process; acquire a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point; determine a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed, determine a target circle with the first writing position as the center and the radius value as the radius, randomly acquire the target number of pixel points within the target circle, adjust the pixel values of the target number of pixel points to preset values, and control the display to display.
[0009] In a second aspect, the present application also provides a handwriting generation method, the method comprising:
[0010] Acquire a first writing position and a target touch pressure value corresponding to the touch point during the writing process; acquire a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point;
[0011] Determining a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed;
[0012] A target circle is determined with the first writing position as the center and the radius as the radius. Within the target circle, the target number of pixel points are randomly acquired, and the pixel values of the target number of pixel points are adjusted to preset values and displayed.
[0013] In a third aspect, the present application also provides a handwriting generation device, the device comprising:
[0014] An acquisition module, used to acquire a first writing position corresponding to a touch point and a target touch pressure value during a writing process; and acquire a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point;
[0015] a determination module, configured to determine a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed;
[0016] A processing module is used to determine a target circle with the first writing position as the center and the radius value as the radius, randomly obtain the target number of pixel points within the target circle, adjust the pixel values of the target number of pixel points to preset values and display them.
[0017] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the handwriting generation method as described in any one of the above items.
[0018] In an embodiment of the present application, the terminal device includes a processor and a display, the processor is connected to the display, the processor obtains a first writing position corresponding to a touch point and a target pressure value of the touch during a writing process, obtains a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point, the processor determines a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed, the processor determines a target circle with the first writing position as the center and the radius value as the radius, randomly obtains a target number of pixel points within the target circle, adjusts the pixel values of the target number of pixel points to preset values, and controls the display to display. In the embodiment of the present application, the processor determines the corresponding radius value and target number according to the target writing speed and the target pressure value. The processor determines the target circle with the first writing position as the center and the radius value as the radius. Within the target circle, a target number of pixels are randomly obtained, and the pixel values of the target number of pixels are adjusted to preset values. Since the radius value and target number determined by the processor are not fixed, and the target number of pixels obtained are also random, the writing effect is more in line with the actual writing situation, and there will be no distortion even if it is zoomed in or out. Moreover, since the radius value and target number are positively correlated with the target pressure value and negatively correlated with the target writing speed, they are closer to the actual writing situation of a pencil or brush, thereby improving the writing effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the implementation methods in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technology descriptions. Obviously, the drawings described below are some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.
[0020] Figure 1a It is a schematic diagram of a black and white pixel image in the prior art;
[0021] Figure 1b It is a schematic diagram of a black and white pixel image in the prior art;
[0022] Figure 1c It is a schematic diagram of a black and white pixel image in the prior art;
[0023] Figure 2 It is a schematic diagram of writing effect in the prior art;
[0024] Figure 3A schematic diagram of the structure of a terminal device 300 is shown;
[0025] Figure 4 is a software structure block diagram of a terminal device 300 according to an embodiment of the present application;
[0026] Figure 5 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0027] Figure 6 A schematic diagram of a target circle provided in an embodiment of the present application;
[0028] Figure 7 A schematic diagram of the effect of adjusting the pixel values of a target number of pixels to preset values provided in an embodiment of the present application;
[0029] Figure 8 A schematic diagram of a circle determined according to several consecutive touch points during writing provided in an embodiment of the present application;
[0030] Fig. 9 A partial schematic diagram of an image displayed by a display provided in an embodiment of the present application;
[0031] Fig.10 A schematic diagram of a display process when a touch point is not an initial touch point provided in an embodiment of the present application;
[0032] Fig.11 A schematic diagram of a display process in which a touch point is an initial touch point provided in an embodiment of the present application;
[0033] Fig.12 A schematic diagram of a process for obtaining a target number of pixels provided in an embodiment of the present application;
[0034] Fig.13 A detailed schematic diagram of a display process provided by an embodiment of the present application;
[0035] Fig.14 A schematic diagram of the number of images saved for different pressure values and writing speeds in an embodiment of the present application;
[0036] Fig.15 A schematic diagram of the structure of another handwriting generation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] The present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0038] With the development of electronic products, handwriting input has become popular as a unique way of human-computer interaction. It is relatively simple to display ballpoint pen handwriting on the screen. The terminal device only needs to determine the handwriting and fill the center of the handwriting with different colors, and control the screen to display it. However, it is difficult to display handwriting with textures such as pencils and brushes. However, pencils and brushes, as representatives of hard pen calligraphy, are of great significance to the art of Chinese calligraphy.
[0039] The current method of determining the writing effect of pencils and brushes is to cover the touch points with different black and white pixel images to form a writing effect. However, the effect of covering the touch points with black and white pixel images is often poor in actual applications. During the process of zooming in or out, distortion will occur because the black and white pixel images covering each touch point are the same. At the same time, this solution will produce a brush-like effect.
[0040] In order to simulate the writing effect of pencils and brushes and improve the display effect when writing, the embodiments of the present application provide a terminal device, a handwriting generation method, an apparatus and a medium.
[0041] In an embodiment of the present application, the terminal device includes a processor and a display, the processor is connected to the display, the processor obtains a first writing position corresponding to a touch point and a target pressure value of the touch during a writing process, obtains a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point, the processor determines a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed, the processor determines a target circle with the first writing position as the center and the radius value as the radius, randomly obtains a target number of pixel points within the target circle, adjusts the pixel values of the target number of pixel points to preset values, and controls the display to display.
[0042] Figure 3 Schematic diagram of the structure of a terminal device 300 is shown. It should be understood that Figure 3 The terminal device 300 shown is only an example, and the terminal device 300 may have more Figure 3 The more or less components shown in the figure can be combined with two or more components, or can have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0043] Figure 3 FIG. 2 exemplarily shows a hardware configuration block diagram of a terminal device 300 according to an exemplary embodiment. Figure 3As shown, the terminal device 300 includes: a radio frequency (RF) circuit 310, a memory 320, a display unit 330, a camera 340, a sensor 350, an audio circuit 360, a wireless fidelity (Wi-Fi) module 370, a processor 380, a Bluetooth module 381, and a power supply 390 and other components.
[0044] The RF circuit 310 can be used to receive and send signals during the process of sending and receiving information or making calls. It can receive downlink data from the base station and hand it over to the processor 380 for processing; it can send uplink data to the base station. Generally, the RF circuit includes but is not limited to antennas, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer and other devices.
[0045] The memory 320 can be used to store software programs and data. The processor 380 executes various functions and data processing of the terminal device 300 by running the software programs or data stored in the memory 320. The memory 320 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, or other volatile solid-state storage device. The memory 320 stores an operating system that enables the terminal device 300 to run. In the present application, the memory 320 can store an operating system and various application programs, and can also store program codes for executing the power saving method of the terminal of the embodiment of the present application.
[0046] The display unit 330 may be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal device 300. Specifically, the display unit 330 may include a touch screen 331 disposed on the front of the terminal device 300, which may collect user touch operations thereon or near the touch screen, such as clicking a button.
[0047] The display unit 330 can also be used to display information input by the user or information provided to the user and a graphical user interface (GUI) of various menus of the terminal device 300. Specifically, the display unit 330 may include a display 332 disposed on the front of the terminal device 300. The display 332 may be configured in the form of a liquid crystal display, a light emitting diode, etc. The display unit 330 may be used to display the screen display area of the terminal in the present application.
[0048] The touch screen 331 can be covered on the display 332, or the touch screen 331 and the display 332 can be integrated to realize the input and output functions of the terminal device 300, and the integrated display can be referred to as a touch display. In this application, the display unit 330 can display the application and the corresponding operation steps.
[0049] The camera 340 can be used to capture still images or videos. The object is projected onto the photosensitive element through the lens to generate an optical image. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then passed to the processor 380 for conversion into a digital image signal.
[0050] The terminal device 300 may further include at least one sensor 350, such as an acceleration sensor 351, a distance sensor 352, a fingerprint sensor 353, and a temperature sensor 354. The terminal device 300 may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, a light sensor, and a motion sensor.
[0051] The audio circuit 360, the speaker 361, and the microphone 362 can provide an audio interface between the user and the terminal device 300. The audio circuit 360 can transmit the electrical signal converted from the received audio data to the speaker 361, which is converted into a sound signal for output. The terminal device 300 can also be configured with a volume button for adjusting the volume of the sound signal, and can also be used to combine other buttons to adjust the closed area. On the other hand, the microphone 362 converts the collected sound signal into an electrical signal, which is received by the audio circuit 360 and converted into audio data, and then the audio data is output to the RF circuit 310 to be sent to, for example, another terminal, or the audio data is output to the memory 320 for further processing.
[0052] Wi-Fi is a short-range wireless transmission technology. The terminal device 300 can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 370, which provides users with wireless broadband Internet access.
[0053] The processor 380 is the control center of the terminal device 300. It uses various interfaces and lines to connect various parts of the entire terminal. It executes various functions of the terminal device 300 and processes data by running or executing software programs stored in the memory 320 and calling data stored in the memory 320. In some embodiments, the processor 380 may include one or more processing units; the processor 380 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes an operating system, a user interface, and an application program, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor 380. In the present application, the processor 380 can run an operating system, an application program, a user interface display and a touch response, as well as a power saving method for a terminal in an embodiment of the present application. In addition, the processor 380 is coupled to the display unit 330.
[0054] The Bluetooth module 381 is used to exchange information with other Bluetooth devices having Bluetooth modules through the Bluetooth protocol. For example, the terminal device 300 can establish a Bluetooth connection with a wearable terminal device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module 381 to exchange data.
[0055] The terminal device 300 also includes a power supply 390 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 380 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption. The terminal device 300 can also be configured with a power button for turning on and off the terminal, as well as locking the screen and other functions.
[0056] Figure 4 It is a software structure block diagram of a terminal device 300 according to an embodiment of the present application.
[0057] 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 can be 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.
[0058] The application layer can include a series of application packages.
[0059] like Figure 4 As shown, the application package may include phone, MMS, WiFi, WeChat, information, alarm clock, gallery, calendar, WLAN and other applications.
[0060] 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.
[0061] like Figure 4 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0062] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0063] Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, short messages, etc.
[0064] 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 short message notification icon can include a view for displaying text and a view for displaying images.
[0065] The phone manager is used to provide communication functions of the terminal device 300, such as management of call status (including connection, disconnection, etc.).
[0066] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc.
[0067] The notification manager enables applications to display notification information (such as the content of short messages) 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, the terminal vibrates, the indicator light flashes, etc.
[0068] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0069] 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.
[0070] 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.
[0071] 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.
[0072] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0073] 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.
[0074] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0075] A 2D (animation mode) graphics engine is a drawing engine for 2D drawing.
[0076] 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.
[0077] The terminal device 300 in the embodiment of the present application may include but is not limited to a smart phone, a tablet computer, a wearable terminal device (such as a smart watch), a laptop computer, a television and other devices.
[0078] The display 332 of the terminal device 300 is used to display the target image;
[0079] The processor 380 of the terminal device 300 is configured to execute the following contrast adjustment method.
[0080] For ease of understanding, a terminal device provided by the present application is described in detail below through a specific embodiment. The following specific embodiment is described using the terminal device as an example. Figure 5 FIG. 4 shows a flow chart of a handwriting generation method. Figure 5 As shown, the method may include the following steps:
[0081] S501: Acquire a first writing position and a target touch pressure value corresponding to a touch point during a writing process; and acquire a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point.
[0082] In order to display the writing effect and accurately simulate the writing effect of a brush or pencil, in an embodiment of the present application, a display 332 and a processor 380 are provided in the terminal device, wherein the display 332 is connected to the processor 380.
[0083] In an embodiment of the present application, when the user needs to write, the writing operation can be performed through a terminal device with a touch function. In order to further simulate the writing effect, the user can perform the writing operation on the terminal device with a touch function by operating a preset device. After receiving the writing operation, the processor can obtain the first writing position corresponding to the touch point during the writing process and the target pressure value of the touch. The touch point in the writing process refers to the pixel point in the image displayed corresponding to the writing. How to obtain the target pressure value of the touch is a prior art and will not be repeated here.
[0084] After the processor obtains the first writing position corresponding to the touch point and the target pressure value of the touch, the processor obtains the target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point. Specifically, the processor can obtain the writing positions of other touch points during the writing process, the time of the corresponding touch, and the time of the corresponding touch of the touch point. The processor can determine the writing speed according to the first writing position and time corresponding to the touch point and the writing positions and time corresponding to the other touch points, and use the determined writing speed as the target writing speed corresponding to the touch point. Specifically, how to determine the writing speed according to the writing positions of multiple touch points and the time of the corresponding touch is a prior art and will not be elaborated here.
[0085] S502: Determine a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed.
[0086] After obtaining the target writing speed corresponding to the touch point, the processor determines the radius value and the target number according to the target writing speed and the target pressure value when the touch point is touched, wherein the radius value refers to the handwriting coverage range when writing, and the target number is used to reflect the depth of the handwriting texture when writing. In the actual writing process, the greater the force used by the user when writing, that is, the greater the target pressure value, the thicker the handwriting texture and the larger the handwriting coverage range; the faster the user writes, the shallower the handwriting texture and the smaller the handwriting coverage range. Therefore, in the embodiment of the present application, the radius value and the target number are positively correlated with the target pressure value, and negatively correlated with the target writing speed.
[0087] The processor determines the radius value according to the target writing speed and the target pressure value as follows:
[0088] R(v,p)=a(p) 1 / 2 -b(v) 1 / 2 +c
[0089] Among them, R(v,p) represents the radius value determined when the target writing speed is v and the target pressure value is p, a, b, c are preset constants, p is the target pressure value corresponding to the touch point, and v is the target writing speed corresponding to the touch point.
[0090] The processor determines the target number according to the target writing speed and the target pressure value as follows:
[0091] N(v,p)=d(p) 2 -e(v) 2 +f
[0092] Among them, N(v,p) represents the target number when the target writing speed is v and the target pressure value is p, d, e, and f are preset constants, p is the target pressure value corresponding to the touch point, and v is the target writing speed corresponding to the touch point.
[0093] S503: Determine a target circle with the first writing position as the center and the radius value as the radius, randomly obtain the target number of pixel points within the target circle, adjust the pixel values of the target number of pixel points to preset values and control the display to display.
[0094] After obtaining the radius value and the target number, the processor can determine the target circle with the first writing position corresponding to the touch point as the center and the determined radius value as the radius. After determining the target circle, the processor randomly obtains the target number of pixels in the target circle, adjusts the pixel values of the target number of pixels to the preset values, and after adjusting the pixel values of the target number of pixels to the preset values, the processor controls the display to display the adjusted image. The preset value can be any value, for example, it can be 0.
[0095] Figure 6 A schematic diagram of a target circle provided in an embodiment of the present application.
[0096] Depend on Figure 6 It can be seen that the center of the target circle is the writing position of the touch point A, and the radius of the target circle is r.
[0097] Figure 7 A schematic diagram of the effect of adjusting the pixel values of a target number of pixel points in a target circle to preset values provided in an embodiment of the present application.
[0098] in, Figure 7 The target circle is Figure 6 When the circle in the figure is drawn, the effect diagram after adjusting the pixel values of the target number of pixels to the preset value is shown in the figure. Figure 7 It can be seen that the target number of pixels is evenly distributed in the target circle. Figure 7 The shape of the middle circle will not be displayed when the control display is displayed.
[0099] In the actual writing process, the greater the force used by the user when writing, that is, the greater the target pressure value, the heavier the handwriting texture and the larger the handwriting coverage area. The faster the user writes, the lighter the handwriting texture and the smaller the handwriting coverage area. In the embodiment of the present application, the greater the target writing speed, the smaller the radius value and the smaller the target number, the smaller the target circle and the smaller the number of pixel points adjusting the pixel value within the target circle, which is equivalent to the corresponding lighter handwriting texture and the smaller the handwriting coverage area. The greater the target writing speed, the opposite is true. In addition, the greater the target pressure value, the greater the radius value and the greater the target number, the larger the target circle and the greater the number of pixel points adjusting the pixel value within the target circle, which is equivalent to the corresponding thicker handwriting texture and the larger the handwriting coverage area. The smaller the target pressure value, the opposite is true. Thus, the actual writing effect can be simulated to the greatest extent.
[0100] In the embodiment of the present application, the processor determines the corresponding radius value and target number according to the target writing speed and the target pressure value. The processor determines the target circle with the first writing position as the center and the radius value as the radius. Within the target circle, a target number of pixels are randomly obtained, and the pixel values of the target number of pixels are adjusted to preset values. Since the radius value and target number determined by the processor are not fixed, and the target number of pixels obtained are also random, the writing effect is more in line with the actual writing situation, and there will be no distortion even if it is zoomed in or out. Moreover, since the radius value and target number are positively correlated with the target pressure value and negatively correlated with the target writing speed, they are closer to the actual writing situation of a pencil or brush, thereby improving the writing effect.
[0101] In order to accurately determine the target writing speed corresponding to the touch point, on the basis of the above embodiments, in the embodiment of the present application, the processor 380 is specifically used to obtain a first time corresponding to writing on the touch point; according to the first time corresponding to writing on the touch point and the second time corresponding to writing on the previous touch point of the touch point, as well as the first writing position corresponding to the touch point and the second writing position corresponding to the previous touch point, the target writing speed corresponding to the touch point is determined.
[0102] In an embodiment of the present application, the processor can obtain a first time corresponding to when writing to a touch point during the writing process, obtain a second time corresponding to when writing to a touch point before the touch point, and obtain a second writing position corresponding to the touch point before the touch point. The processor can determine the target writing speed corresponding to the touch point based on the first writing position corresponding to the touch point, the second writing position corresponding to the previous touch point, the first time corresponding to when writing to the touch point, and the second time corresponding to when writing to the previous touch point.
[0103] Specifically, the processor can determine the distance between the touch point and the previous touch point based on the first writing position corresponding to the touch point and the second writing position corresponding to the previous touch point, and determine the time interval between the first time corresponding to writing to the touch point and the second time corresponding to writing to the previous touch point. The target writing speed corresponding to the touch point can be determined based on the ratio of the distance to the time interval.
[0104] The processor may determine the distance between the touch point and the previous touch point using the formula:
[0105]
[0106] Among them, d refers to the distance between the touch point and the previous touch point, x1 is the horizontal coordinate in the first writing position corresponding to the touch point, x2 is the horizontal coordinate in the second writing position corresponding to the previous touch point, y1 is the vertical coordinate in the first writing position corresponding to the touch point, and y2 is the vertical coordinate in the second writing position corresponding to the previous touch point.
[0107] The processor determines the target writing speed of the touch point by the following formula:
[0108]
[0109] Among them, v refers to the target writing speed corresponding to the touch point, d refers to the distance between the touch point and the previous touch point, t1 refers to the first time corresponding to writing to the touch point, t2 refers to the second time corresponding to writing to the previous touch point, and t1-t2 refers to the time interval between the first time corresponding to writing to the touch point and the second time corresponding to writing to the previous touch point.
[0110] Figure 8 A schematic diagram of a circle determined according to several consecutive touch points during writing provided in an embodiment of the present application.
[0111] Depend on Figure 8 It can be seen that Figure 8 The radius of the circle determined according to each touch point is different, and the determined circle is more continuous and closer to the actual handwriting range during writing.
[0112] Fig. 9 A partial schematic diagram of an image displayed by a display provided in an embodiment of the present application.
[0113] Depend on Fig. 9 It can be seen that the radius of the circle determined corresponding to each touch point is different, and the number of pixels adjusted to preset values in the circle is also different. The determined circle is more continuous and closer to the handwriting range and handwriting texture during actual writing.
[0114] In order to accurately determine the target writing speed corresponding to the touch point, on the basis of the above embodiments, in the embodiment of the present application, the processor 380 is specifically used to determine whether the touch point is an initial touch point. If not, the target writing speed corresponding to the touch point is obtained according to the first writing position corresponding to the touch point.
[0115] In an embodiment of the present application, if the touch point is the initial touch point when writing a certain character or a stroke in the character, then since there is no previous touch point of the touch point in the corresponding character or stroke, the target writing speed corresponding to the touch point cannot be determined. Therefore, in an embodiment of the present application, the processor can first determine whether the touch point is the initial touch point. If the touch point is not the initial touch point, the processor can determine the target writing speed corresponding to the touch point. Specifically, the processor obtains the target writing speed corresponding to the touch point based on the first writing position corresponding to the touch point.
[0116] Among them, the way in which the processor determines that the touch point is the initial touch point can be: if the time interval between the second time corresponding to the previous touch point when writing to the touch point and the first time corresponding to the writing to the touch point exceeds a preset threshold, then the touch point is determined to be the initial touch point when writing a certain text or a stroke in the text, and at this time the previous touch point is a touch point in other text or other strokes.
[0117] Fig.10 A schematic diagram of a display process when a touch point is not an initial touch point provided in an embodiment of the present application, the process includes the following steps:
[0118] S1001: The processor obtains the first writing position and target touch pressure value corresponding to the touch point during the writing process, the first time corresponding to writing to the touch point, the second time corresponding to writing to the previous touch point of the touch point and the second writing position corresponding to the previous touch point.
[0119] S1002: The processor determines a target writing speed according to the first time, the second time, the first writing speed, and the second writing speed.
[0120] S1003: The processor determines the radius value and the target number according to the target writing speed and the target pressure value.
[0121] S1004: The processor determines a target circle with the first writing position as the center and the radius as the radius.
[0122] S1005: The processor randomly obtains a target number of pixel points within the target circle, and adjusts the pixel values of the target number of pixel points to preset values.
[0123] S1006: The processor controls the display to display.
[0124] In order to improve the writing effect, on the basis of the above embodiments, in the embodiment of the present application, the processor 380 is also used to determine the radius value corresponding to the target pressure value according to the pre-saved correspondence between pressure and radius if the touch point is an initial touch point, and determine the preset number as the target number.
[0125] In an embodiment of the present application, if the touch point is the initial touch point for writing a certain word or a certain stroke in the word, the target writing speed corresponding to the touch point cannot be determined, and thus the radius value and the target number cannot be determined according to the target writing speed and the target pressure value. In order to display the handwriting of the touch point, in an embodiment of the present application, the processor pre-stores the corresponding relationship between pressure and radius. If the touch point is the initial touch point, the processor determines the radius value corresponding to the target pressure value according to the pre-stored corresponding relationship between pressure and radius, and determines the preset number as the target number, wherein the preset number can be any number, for example, 20. After determining the radius value and the target number, the processor executes the subsequent steps of determining the target circle with the first writing position corresponding to the touch point as the center and the radius value as the radius, randomly obtaining the target number of pixels within the target circle, adjusting the pixel values of the target number of pixels to the preset values, and controlling the display to display.
[0126] Fig.11 A schematic diagram of a display process in which a touch point is an initial touch point is provided in an embodiment of the present application, and the process includes the following steps:
[0127] S1101: The processor obtains a first writing position corresponding to a touch point and a target touch pressure value during a writing process.
[0128] S1102: The processor determines the radius value corresponding to the target pressure value according to the pre-saved correspondence between pressure and radius, and uses the preset number as the target number.
[0129] S1103: The processor determines a target circle with the first writing position as the center and the radius as the radius.
[0130] S1104: The processor randomly obtains a target number of pixel points within the target circle, and adjusts the pixel values of the target number of pixel points to preset values.
[0131] S1105: The processor controls the display to display.
[0132] Fig.12 A detailed schematic diagram of a display process provided in an embodiment of the present application, the process includes the following steps:
[0133] S1201: The processor obtains a first writing position corresponding to a touch point and a target touch pressure value during a writing process.
[0134] S1202: The processor determines whether the touch point is an initial touch point, and if so, executes S1203, otherwise, executes S1204.
[0135] S1203: According to the stored correspondence between pressure and radius, determine the radius value corresponding to the target pressure value, and determine the preset number as the target number. Then execute S1206.
[0136] S1204: The processor obtains a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point.
[0137] S1205: The processor determines the radius value and the target number according to the target writing speed and the target pressure value.
[0138] S1206: The processor determines a target circle with the first writing position as the center and the radius as the radius.
[0139] S1207: The processor randomly obtains a target number of pixel points within the target circle, and adjusts the pixel values of the target number of pixel points to preset values.
[0140] S1208: The processor controls the display to display.
[0141] In order to accurately determine the target number of pixel points, on the basis of the above embodiments, in the embodiment of the present application, the processor 380 is specifically used to adopt an adaptive random algorithm to sequentially obtain the target number of target angles, and adopt an adaptive random algorithm to sequentially obtain the target number of target distance values within the radius value; determine the target number of target positions based on the acquired target number of target angles, the target number of target distance values and the first writing position of the touch point, and obtain the pixel point at the target position.
[0142] In an embodiment of the present application, after the processor obtains the target number according to the target pressure value and the target writing speed, in order to ensure that the distribution of the obtained target number of pixel points is relatively even, the processor may use an adaptive random algorithm to sequentially obtain the target number of target angles, and use an adaptive random algorithm to sequentially obtain the target number of distance values within the radius value. After obtaining the target number of target angles and target distance values, the processor may combine the target number of target angles and target distance values to generate a target number of angle distance combinations, wherein the processor may combine the target number of target angles and target distance values in the order in which they are obtained, and combine the target angles and target distance values obtained in order, for example, combining the first target angle and target distance value obtained, and of course the processor may also randomly combine the target number of target angles and target distance values, and the combined target angles and target distance values no longer participate in the combination.
[0143] The processor determines the target position corresponding to each acquired angle-distance combination according to the target angle, target distance and the first writing position corresponding to the touch point in the angle-distance combination. The processor acquires a target number of target positions in this manner and acquires pixel points at the target number of target positions.
[0144] It is worth noting that in the embodiment of the present application, the first writing position and other positions can be the position information in the coordinate system determined by taking the upper left corner of the image currently displayed on the display as the origin, the direction to the right as the positive direction of the x-axis, and the vertical downward as the positive direction of the y-axis. The processor determines the formula for the target position corresponding to the angle-distance combination according to the target angle and target distance in the angle-distance combination and the first writing position of the touch point as follows:
[0145] x1=ρ*cos(theta)+x0
[0146] y1=ρ*sin(theta)+y0
[0147] Among them, x1 refers to the horizontal coordinate of the target position, y1 refers to the vertical coordinate of the target position, ρ refers to the target distance, theta refers to the target angle, x0 refers to the horizontal coordinate of the first writing position corresponding to the touch point, and y0 refers to the vertical coordinate of the first writing position corresponding to the touch point.
[0148] In an embodiment of the present application, an adaptive random algorithm may be used to obtain a target number of values within a preset value range, and a target number of target distances and a target angle may be determined according to the target number of values, the radius value, and the preset angle value. The preset value range may be [0, 1], and the preset angle value may be 2π. Specifically, the first product of the target number of values and the radius value is determined respectively, and the target number of first products is determined as the target number of target distances, and the second product of the target number of values and the preset angle value is determined respectively, and the target number of second products is determined as the target angle.
[0149] The formula for determining the target distance can be:
[0150] ρ=R*randomR()
[0151] Among them, ρ refers to the target distance, R refers to the radius value, and randomR() refers to the value obtained within the preset value range using the adaptive random algorithm.
[0152] The formula for determining the target angle can be:
[0153] theta=Math.randomTheta()*2π
[0154] Here, theta refers to the target angle, Math.randomTheta() refers to the value obtained within the preset range using an adaptive random algorithm, and 2π is the preset angle value.
[0155] Fig.13 A schematic diagram of a process for obtaining a target number of pixels provided in an embodiment of the present application, the process comprising the following steps:
[0156] S1301: The processor obtains a first writing position corresponding to a touch point and a target touch pressure value during a writing process.
[0157] S1302: The processor obtains a target writing speed corresponding to the touch point according to a first writing position corresponding to the touch point.
[0158] S1303: The processor determines the radius value and the target number according to the target writing speed and the target pressure value.
[0159] S1304: The processor uses an adaptive random algorithm to obtain a target number and target angles, and uses an adaptive random algorithm to obtain a target number and target distance values within the radius value.
[0160] S1305: The processor determines a target number of target positions according to the acquired target number of angles, the target number of distance values, and the first writing position of the touch point.
[0161] S1306: The processor obtains a target number of pixel points at target positions.
[0162] S1307: The processor adjusts the acquired pixel value of each pixel point to a preset value, and controls the display to display.
[0163] In order to make the target number of pixels distributed more evenly, the processor uses an adaptive random algorithm to determine the distance and angle: the processor can divide the angle of the circle 360° into 36 parts, each 10° is one part, and when initially determining the target angle, the weight of the probability that the target angle falls within each angle range is set to be equal, which is one thirty-sixth. That is, the weights of each angle range are: [1 / 36, 1 / 36, 1 / 36, 1 / 36, 1 / 36, 1 / 36, 1 / 36, 1 / 36, 1 / 36, 1 / 36, ……… 1 / 36, 1 / 36, 1 / 36], if a target angle is obtained within [0°, 10°), then the weight of the probability that the target angle falls within [0°, 10°) will change during the next random acquisition of the target angle. Specifically, the rate of change of each weight will be set to 0.01, then the weight of the probability that the target angle falls within [0°, 10°) next time is (1-0.35) / 36, and 0.35 is added to the other 35 angle ranges. At this time, the weights of the probability that the target angle falls within each angle range are: [0.65 / 36, 1.01 / 36, 1.01 / 36, 1.01 / 36, 1.01 / 36, 1.01 / 36, 1.01 / 36, 1.01 / 36, ... 1.01 / 36, 1.01 / 36, 1.01 / 36, 1.01 / 36, 1.01 / 36, 1.01 / 36]. At the same time, if the target angle obtained next time is within [10°, 20°), the weight of the random angle will change again, and the weight corresponding to [10°, 20°] will be reduced by 0.35 / 36, and the weights of other ranges will be increased by 0.01 / 36. At this time, the weights of the probabilities that the target angle falls within each angle range are: [0.66 / 36, 0.66 / 36, 1.02 / 36, 1.02 / 36, 1.02 / 36, 1.02 / 36, 1.02 / 36, 1.02 / 36, ... 1.02 / 36, 1.02 / 36, 1.02 / 36, 1.02 / 36, 1.02 / 36]. Although the weights are constantly changing, the sum is still 1. If the number of target angles determined in each angle range is the same, the weights of each angle range will return to the initial state.
[0164] Similarly, in the embodiment of the present application, the radius value can be divided into 10 parts, namely [0, 0.1R), [0.1R, 0.2R), [0.2R-0.3R)...[0.9RR), and the initial weights of [0, 0.1R), [0.1R, 0.2R), [0.2R-0.3R)...[0.9RR) are [1 / 10, 1 / 10...1 / 10] respectively. When the randomly determined distance appears in [0-0.1R], the weight change rate is 0.05. The probability that the next distance falls in [0-0.1R) is (1-0.05*9) / 10. The weights of other distance ranges are all (1+0.05) / 10. At this time, the weights of each distance range are [0.55 / 1, 1.05 / 10, 1.05 / 10…………1.05 / 10] respectively. When the next distance falls within [0.1R-0.2R), the corresponding weight of [0.1R-0.2R) is reduced by 0.05*9 / 10, and the weights of other ranges are increased by 0.05 / 10; at this time, the weights of each distance range are [0.6 / 1, 0.6 / 10, 1.1 / 10, 1.1 / 10…………1.1 / 10] respectively.
[0165] In order to improve the fluency of writing, on the basis of the above embodiments, in the embodiment of the present application, the processor 380 is also used to determine whether the corresponding relationship between the saved pressure value and writing speed and each calculation result includes the target pressure value and the target writing speed; wherein the calculation result includes a corresponding number of angles and distance values; if not, the subsequent steps of using an adaptive random algorithm to sequentially obtain the target number of target angles are performed.
[0166] In the embodiment of the present application, if a target number of pixel points are randomly obtained each time, it will cause a delay in the corresponding display, reduce the smoothness of writing, and affect the user's experience. In addition, when the user writes once, the strength and speed of controlling the pen are basically constant, that is, the pressure and speed are basically constant. Therefore, in the embodiment of the present application, the processor can save the correspondence between the pressure value and the writing speed and each calculation result. The calculation result refers to each angle and distance value. Each calculation result has a corresponding relationship with the pressure value and the writing speed. After obtaining the target pressure value and the target writing speed, the processor can determine whether the saved correspondence between the pressure value and the writing speed and the calculation result includes the target pressure value and the target writing speed. If the target pressure value and the target writing speed are not included, the processor executes the subsequent steps of using an adaptive random algorithm to sequentially obtain the target number of target angles.
[0167] In order to improve the fluency of writing, on the basis of the above embodiments, in the embodiment of the present application, the processor 380 is also used to obtain each calculation result corresponding to the target pressure value and the target writing speed if the correspondence between the saved pressure value and the writing speed and each calculation result includes the target pressure value and the target writing speed, and randomly determine the target calculation result in each calculation result; determine the target number of target positions according to the target number of target angles and target distance values contained in the target calculation result and the first writing position of the touch point, and obtain the pixel point at the target position.
[0168] In an embodiment of the present application, if the corresponding relationship between the pressure value and writing speed saved in the processor and each calculation result includes the target pressure value and target writing speed, wherein the calculation result refers to the corresponding multiple angles and distances, then the processor does not need to re-determine the target number of target angles and target distances, and can obtain each calculation result corresponding to the target pressure value and the target writing speed in the corresponding relationship between the pressure value and the writing speed and each calculation result. After obtaining each calculation result corresponding to the target pressure value and the target writing speed, in order to prevent the handwriting effect of the writing from being relatively single, resulting in a poor writing effect, the processor can randomly obtain a calculation result in each calculation result, and determine the calculation result as the target calculation result. The processor obtains the target number of target angles and target distances contained in the target calculation result, determines the target number of target positions according to the obtained target number of target angles and target distance values and the first writing position of the touch point, and obtains the pixel point at the target position. Specifically, how to obtain the target number of target positions has been described in the above embodiment and will not be repeated here.
[0169] In order to further improve the fluency of writing, on the basis of the above embodiments, in the embodiment of the present application, the processor 380 is also used to determine whether the corresponding relationship between the saved pressure value and writing speed and each image includes the target pressure value and the target writing speed; if not, the subsequent steps of determining the radius value and the target number according to the target writing speed and the target pressure value are performed.
[0170] Since in the embodiment of the present application, it is still relatively complicated to determine the target number of pixels each time based on the target number of target angles and target distances, the processor can pre-store the corresponding relationship between the pressure value and the writing speed and each image in the embodiment of the present application, wherein for each pressure value and writing speed, the image corresponding to the pressure value and the writing speed is an image in which the radius value and the number determined according to the pressure value and the writing speed are randomly obtained within a circle with the radius of the radius value, and the pixel value of the pixel point is adjusted to a preset value. After obtaining the target pressure value and the target writing speed, the processor can determine whether the saved corresponding relationship between the pressure value and the writing speed and each image contains the target pressure value and the target writing speed. If the target pressure value and the target writing speed are not included, the subsequent steps of determining the radius value and the target number according to the target writing speed and the target pressure value are performed.
[0171] In an embodiment of the present application, if the processor performs a subsequent step of determining the radius value and the target number based on the target writing speed and the target pressure value, the processor determines the target circle with the first writing position as the center and the radius value as the radius, and randomly obtains a target number of pixels within the target circle, adjusts the pixel values of the target number of pixels to preset values, and saves the image after the target number of pixels are adjusted to the preset value and the correspondence between the target pressure value and the target writing speed in the correspondence between the pressure value and the writing speed and each image.
[0172] In order to further improve the fluency of writing, on the basis of the above embodiments, in the embodiment of the present application, the processor 380 is also used to randomly obtain a target image in each image corresponding to the target pressure value and the target writing speed if the correspondence between the saved pressure value and the writing speed and each image includes the target pressure value and the target writing speed, overlay the target image at the first writing position and control the display to display it.
[0173] In an embodiment of the present application, if the correspondence between the pressure value and writing speed saved by the processor and each image includes a target pressure value and a target writing speed, the processor randomly obtains an image from each image corresponding to the target pressure value and the target writing speed, uses the image as the target image, overwrites the target image at the first writing position, and controls the display to display it.
[0174] In an embodiment of the present application, each image corresponding to the pressure value and writing speed can be an image with a transparent background. Therefore, covering the target image at the first writing position is only equivalent to adjusting the pixel value of the corresponding pixel point to a preset value, and will not cover the content currently displayed on the display.
[0175] In the embodiment of the present application, for each pressure value and writing speed, the number of images corresponding to the pressure value and the writing speed stored in the processor may be a preset number, and the processor randomly obtains the target image from the preset number of images corresponding to the target pressure value and the target writing speed. In the embodiment of the present application, for each pressure value and writing speed, a preset number of images may be generated, and the corresponding relationship between the pressure value and the writing speed and the preset number of images may be added to the corresponding relationship between the pressure value and the writing speed and each image.
[0176] In an embodiment of the present application, the writing speed and pressure can be used as a key, and the corresponding image can be used as a value and saved in a data structure. The data structure can be a hash table (HashMap). In order to save space and memory, it can also be uploaded to a cloud server.
[0177] Fig.14 This is a schematic diagram of the number of images saved for different pressure values and writing speeds in an embodiment of the present application.
[0178] Fig.14 The first row refers to the corresponding pressure value, the first column refers to the corresponding writing speed, the second row and the second column refer to the 10 corresponding images saved in the processor for the pressure value of 7 Newton (Newton, N) and the writing speed of 0.9 centimeters per second (cm / s), the second row and the third column refer to the 10 corresponding images saved for the pressure value of 8N and the writing speed of 0.9cm / s, the second row and the fourth column refer to the 10 corresponding images saved for the pressure value of 9N and the writing speed of 0.9cm / s, the third row and the second column refer to the 10 corresponding images saved for the pressure value of 7N and the writing speed of 1cm / s. The third row and the third column refers to 10 corresponding images for a pressure value of 8N and a writing speed of 1cm / s, the third row and the fourth column refers to 10 corresponding images for a pressure value of 10N and a writing speed of 1cm / s, the fourth row and the second column refers to 10 corresponding images for a pressure value of 7N and a writing speed of 1cm / s, the fourth row and the third column refers to 10 corresponding images for a pressure value of 8N and a writing speed of 1cm / s, and the fourth row and the fourth column refers to 10 corresponding images for a pressure value of 10N and a writing speed of 1cm / s.
[0179] In the embodiment of the present application, if the pressure value is 8N and the target writing speed is 1cm / s, the target image can be randomly acquired from the corresponding 10 images.
[0180] In addition, in an embodiment of the present application, if under normal circumstances the speed change is within 0.1 cm / s, the pressure change is within 1 N, the pressure value corresponding to the previous touch point is 8 N, and the writing speed is 1 cm / s, then in order to improve the writing fluency, the processor can randomly select an image from the 90 images saved between 0.9 cm / s-1.1 cm / s and between 7N-9N, thereby improving the writing fluency.
[0181] Fig.15 A schematic diagram of the structure of another handwriting generation device provided in an embodiment of the present application, such as the Fig.15 As shown, the device comprises:
[0182] The acquisition module 1501 is used to acquire a first writing position and a target touch pressure value corresponding to a touch point during writing; and acquire a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point;
[0183] A determination module 1502 is used to determine a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed;
[0184] Processing module 1503 is used to determine a target circle with the first writing position as the center and the radius value as the radius, randomly obtain the target number of pixel points within the target circle, adjust the pixel values of the target number of pixel points to preset values and display them.
[0185] In a possible implementation, the acquisition module 1501 is specifically used to acquire a first time corresponding to when writing to the touch point; determine the target writing speed corresponding to the touch point based on the first time corresponding to when writing to the touch point and the second time corresponding to when writing to the previous touch point of the touch point, as well as the first writing position corresponding to the touch point and the second writing position corresponding to the previous touch point.
[0186] In a possible implementation, the acquisition module 1501 is specifically configured to determine whether the touch point is an initial touch point, and if not, to acquire a target writing speed corresponding to the touch point according to a first writing position corresponding to the touch point.
[0187] In a possible implementation, the acquisition module 1501 is further used to determine the radius value corresponding to the target pressure value according to a pre-saved correspondence between pressure and radius if the touch point is an initial touch point, and determine the preset number as the target number.
[0188] In a possible implementation, the processing module 1503 is specifically used to adopt an adaptive random algorithm to sequentially obtain the target number of target angles, and adopt an adaptive random algorithm to sequentially obtain the target number of target distance values within the radius value; determine the target number of target positions based on the obtained target number of angles, the target number of distance values and the first writing position of the touch point, and obtain the pixel points at the target positions.
[0189] In a possible implementation, the processing module 1503 is also used to determine whether the corresponding relationship between the saved pressure value and writing speed and each calculation result includes the target pressure value and the target writing speed; wherein the calculation result includes a corresponding number of angles and distance values; if not, the subsequent step of using an adaptive random algorithm to sequentially obtain the target number of target angles is performed.
[0190] In a possible implementation, the processing module 1503 is also used to obtain each calculation result corresponding to the target pressure value and the target writing speed if the correspondence between the saved pressure value and the writing speed and each calculation result includes the target pressure value and the target writing speed, and randomly determine the target calculation result in each calculation result; determine the target number of target positions according to the target number of target angles and target distance values and the first writing position of the touch point contained in the target calculation result, and obtain the pixel point at the target position.
[0191] In a possible implementation, the determination module 1502 is specifically used to determine whether the correspondence between the saved pressure value and writing speed and each image includes the target pressure value and the target writing speed; if not, performing subsequent steps of determining the radius value and the target number based on the target writing speed and the target pressure value.
[0192] In a possible implementation, the processing module 1503 is also used to randomly obtain a target image from each image corresponding to the target pressure value and the target writing speed if the correspondence between the saved pressure value and the writing speed and each image includes the target pressure value and the target writing speed, overlay the target image at the first writing position and control the display to display it.
[0193] On the basis of the above embodiments, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program executable by a terminal device, and when the program is executed on the terminal device, the terminal device implements the following steps when executing:
[0194] The memory stores a computer program, and when the program is executed by the processor, the processor performs the following steps:
[0195] Acquire a first writing position and a target touch pressure value corresponding to the touch point during the writing process; acquire a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point;
[0196] Determining a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed;
[0197] A target circle is determined with the first writing position as the center and the radius as the radius. Within the target circle, the target number of pixel points are randomly acquired, and the pixel values of the target number of pixel points are adjusted to preset values and displayed.
[0198] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0199] The present application is described with reference to the flowchart and / or block diagram of the method, device (system), and computer program product according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0200] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0201] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0202] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A terminal device, characterized in that: The terminal device comprises: A display, the display being used for displaying; A processor configured to execute: Acquire a first writing position and a target touch pressure value corresponding to the touch point during the writing process; acquire a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point; Determine a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed; Determine a target circle with the first writing position as the center and the radius value as the radius, and within the target circle, sequentially obtain the target number of target angles using an adaptive random algorithm, and sequentially obtain the target number of target distance values within the radius value using an adaptive random algorithm; Combining the target number of target angles and target distance values in the order in which they are obtained, or randomly combining the target number of target angles and target distance values, and the combined target angles and target distance values do not participate in other combinations; obtaining a combined angle distance combination; For each acquired angle-distance combination, determining a target position corresponding to the angle-distance combination according to the target angle, the target distance and the first writing position corresponding to the touch point in the angle-distance combination; The pixel value of each pixel point at the target position is adjusted to a preset value and the display is controlled.
2. The terminal device according to claim 1, characterized in that: The processor is specifically used to obtain a first time corresponding to when writing to the touch point; determine a target writing speed corresponding to the touch point based on the first time corresponding to when writing to the touch point and the second time corresponding to when writing to the previous touch point of the touch point, as well as a first writing position corresponding to the touch point and a second writing position corresponding to the previous touch point.
3. The terminal device according to claim 1, characterized in that: The processor is specifically configured to determine whether the touch point is an initial touch point, and if not, to obtain a target writing speed corresponding to the touch point according to a first writing position corresponding to the touch point.
4. The terminal device according to claim 3, characterized in that: The processor is further configured to determine, if the touch point is an initial touch point, a radius value corresponding to the target pressure value according to a pre-stored correspondence between pressure and radius, and determine the preset number as the target number.
5. The terminal device according to claim 1, characterized in that: The processor is also used to determine whether the corresponding relationship between the saved pressure value and writing speed and each calculation result includes the target pressure value and the target writing speed; wherein the calculation result includes a corresponding number of angles and distance values; if not, then performing the subsequent step of using an adaptive random algorithm to sequentially obtain the target number of target angles.
6. The terminal device according to claim 5, characterized in that: The processor is further configured to obtain each calculation result corresponding to the target pressure value and the target writing speed if the stored correspondence between the pressure value and the writing speed and each calculation result includes the target pressure value and the target writing speed, and randomly determine the target calculation result in each calculation result; According to the target number of target angles and target distance values contained in the target calculation result and the first writing position of the touch point, the target number of target positions are determined, and the pixel points at the target positions are obtained.
7. The terminal device according to claim 1, characterized in that: The processor is also used to determine whether the corresponding relationship between the saved pressure value and writing speed and each image includes the target pressure value and the target writing speed; if not, performing subsequent steps to determine the radius value and the target number based on the target writing speed and the target pressure value.
8. The terminal device according to claim 7, characterized in that: The processor is also used to randomly obtain a target image from each image corresponding to the target pressure value and the target writing speed if the correspondence between the saved pressure value and the writing speed and each image includes the target pressure value and the target writing speed, overlay the target image at the first writing position and control the display to display it.
9. A handwriting generation method, characterized in that: The method comprises: Acquire a first writing position and a target touch pressure value corresponding to the touch point during the writing process; acquire a target writing speed corresponding to the touch point according to the first writing position corresponding to the touch point; Determine a radius value and a target number according to the target writing speed and the target pressure value, wherein the radius value and the target number are positively correlated with the target pressure value and negatively correlated with the target writing speed; Determine a target circle with the first writing position as the center and the radius value as the radius, and within the target circle, sequentially obtain the target number of target angles using an adaptive random algorithm, and sequentially obtain the target number of target distance values within the radius value using an adaptive random algorithm; Combining the target number of target angles and target distance values in the order in which they are obtained, or randomly combining the target number of target angles and target distance values, and the combined target angles and target distance values do not participate in other combinations; obtaining a combined angle distance combination; For each acquired angle-distance combination, determining a target position corresponding to the angle-distance combination according to the target angle, the target distance and the first writing position corresponding to the touch point in the angle-distance combination; The pixel value of each pixel point at the target position is adjusted to a preset value and displayed.
