WO2021218448A1 - 笔迹形成方法、笔迹形成装置及电子设备 - Google Patents

笔迹形成方法、笔迹形成装置及电子设备 Download PDF

Info

Publication number
WO2021218448A1
WO2021218448A1 PCT/CN2021/080511 CN2021080511W WO2021218448A1 WO 2021218448 A1 WO2021218448 A1 WO 2021218448A1 CN 2021080511 W CN2021080511 W CN 2021080511W WO 2021218448 A1 WO2021218448 A1 WO 2021218448A1
Authority
WO
WIPO (PCT)
Prior art keywords
trajectory
point
connection
points
coordinates
Prior art date
Application number
PCT/CN2021/080511
Other languages
English (en)
French (fr)
Inventor
郑瑞
胡风硕
贾红红
Original Assignee
京东方科技集团股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 京东方科技集团股份有限公司 filed Critical 京东方科技集团股份有限公司
Priority to US17/626,683 priority Critical patent/US11809701B2/en
Publication of WO2021218448A1 publication Critical patent/WO2021218448A1/zh
Priority to US18/474,773 priority patent/US20240020893A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves

Definitions

  • the embodiments of the present disclosure relate to a handwriting forming method, a handwriting forming device, and electronic equipment.
  • touch screens have been widely used in smart terminals.
  • the user can interact with the smart terminal through the touch screen, thereby conveniently completing the operation process of the smart terminal.
  • Various applications for smart terminals have also been widely developed, for example, applications for writing and drawing on terminal devices.
  • the user can use the corresponding application program to operate on the touch screen with a finger or a stylus, thereby writing or drawing various patterns.
  • At least one embodiment of the present disclosure provides a handwriting forming method, including: determining a set of track points according to multiple sampling points on a writing path on a working surface of a touch device and obtaining track information of each track point, wherein
  • the trajectory information includes coordinates, flags, and pressure values, the flags include data indicating whether the corresponding trajectory point is a pen point; based on the trajectory information, multiple raindrop shapes corresponding to the multiple trajectory points are established one-to-one
  • the trajectory unit based on the trajectory information, determine the connection mode between the trajectory units corresponding to the adjacent trajectory points; calculate the connection point of the trajectory unit according to the connection mode, and correspond to the adjacent trajectory points
  • the polygon formed by the connecting points of the trajectory unit is filled to form the displayed handwriting.
  • establishing multiple raindrop-shaped trajectory units corresponding to the multiple trajectory points one-to-one based on the trajectory information includes: determining the first center coordinates and the first center coordinates of the first circle A radius; determine the second center coordinates and the second radius of the second circle; fill the first circle and the second circle, and form a polygon formed by the common tangent point of the first circle and the second circle Fill it.
  • the first circle center coordinate is the coordinate of the corresponding track point
  • the first radius is the product of the pressure sensitivity and the preset values of a plurality of writing parameters
  • the pressure The sensing amount is obtained based on the pressure value of the corresponding track point
  • the first radius is greater than the second radius.
  • the pressure sensitivity is calculated according to the following pressure sensitivity function:
  • Pz represents the pressure sensitivity
  • P represents the pressure value
  • the second circle center coordinate is obtained according to the first circle center coordinate, the center distance, and the angle of the line connecting the center of the circle, and the center distance is the distance between the brush length and the corresponding track point.
  • Q times the product of the pressure value, 2 ⁇ Q ⁇ 7, the angle of the line connecting the center of the circle is the line between the center of the first circle and the center of the second circle and the coordinate system where the first center of the circle is located.
  • the included angle in the x-axis direction, the angle of the line connecting the center of the circle is 15-60 degrees.
  • 4.5 ⁇ Q ⁇ 5.5, and the angle of the line connecting the center of the circle is 25 to 35 degrees.
  • determining the connection mode between the trajectory units corresponding to adjacent trajectory points based on the trajectory information includes: for trajectory points other than the pen point, calculating the current trajectory The slope of the line connecting the point and the previous trajectory point; determining the connection mode used by the trajectory unit corresponding to the current trajectory point according to the slope, the coordinates of the current trajectory point, and the coordinates of the previous trajectory point; Wherein, the slope is calculated according to the following formula:
  • k represents the slope
  • (x2, y2) represents the coordinates of the current trajectory point
  • (x1, y1) represents the coordinates of the previous trajectory point.
  • the connection mode includes a first connection mode, a second connection mode, a third connection mode, and a fourth connection mode, and according to the slope, the The coordinates of the current trajectory point and the coordinates of the previous trajectory point are used to determine the connection method used by the trajectory unit corresponding to the current trajectory point, including: if
  • connection points of the trajectory units are calculated according to the connection mode, and the polygons formed by the connection points of the trajectory units corresponding to the adjacent trajectory points are filled to
  • the handwriting used to form the display includes: for track points other than the pen down point, according to the determined first connection mode, the second connection mode, the third connection mode, and the first connection mode.
  • One of the four connection modes is to calculate the connection points of the trajectory units; fill the polygon formed by the connection points of the trajectory units corresponding to adjacent trajectory points.
  • the connection points of the trajectory unit include a first connection point m1 and a second connection point n1.
  • the first connection mode the following formula is used to calculate the The first connection point m1 and the second connection point n1:
  • (mx, my) represents the coordinates of the first connection point m1
  • (nx, ny) represents the coordinates of the second connection point n1
  • (c1.x, c1.y) represents the coordinates of the first circle center
  • (C2.x, c2.y) represents the coordinates of the second circle center
  • R1 represents the first radius
  • R2 represents the second radius
  • represents the angle of the circle center connection
  • the coordinates of the second connection point n1, the first circle center coordinates, and the second circle center coordinates are located in the same coordinate system on the working surface of the touch device.
  • the connection points of the trajectory unit include a first connection point m2 and a second connection point n2.
  • the following formula is used to calculate the The first connection point m2 and the second connection point n2: Wherein (mx, my) represents the coordinates of the first connection point m2, (nx, ny) represents the coordinates of the second connection point n2, (c2.x, c2.y) represents the coordinates of the second circle center , R1 represents the first radius, R2 represents the second radius, the coordinates of the first connection point m2, the coordinates of the second connection point n2, and the coordinates of the second circle center are located in the working area of the touch device In the same coordinate system on the surface.
  • the connection points of the trajectory unit include a first connection point m3 and a second connection point n3.
  • the following formula is used to calculate the The first connection point m3 and the second connection point n3: Wherein (mx, my) represents the coordinates of the first connection point m3, (nx, ny) represents the coordinates of the second connection point n3, (c2.x, c2.y) represents the coordinates of the second circle center , R2 represents the second radius, the coordinates of the first connection point m3, the coordinates of the second connection point n3, and the second circle center coordinates are located in the same coordinate system on the working surface of the touch device.
  • the connection points of the trajectory unit include a first connection point m4 and a second connection point n4.
  • the following formula is used to calculate the The first connection point m4 and the second connection point n4: Wherein (mx, my) represents the coordinates of the first connection point m4, (nx, ny) represents the coordinates of the second connection point n4, and (c1.x, c1.y) represents the coordinates of the first circle center , (C2.x, c2.y) represents the coordinates of the second circle center, R1 represents the first radius, R2 represents the second radius, ⁇ represents the angle of the circle center connection, and the coordinates of the first connection point m4
  • the coordinates of the second connection point n4, the first circle center coordinates, and the second circle center coordinates are located in the same coordinate system on the working surface of the touch device.
  • connection points of the trajectory units are calculated according to the connection mode, and the polygons formed by the connection points of the trajectory units corresponding to the adjacent trajectory points are filled to
  • the handwriting used to form the display further includes: for the track point as the pen down point, determining the connection of the track unit corresponding to the pen down point according to the connection mode of the track unit corresponding to the track point adjacent to the pen down point point.
  • the trajectory corresponding to the pen down point is determined according to the connection mode of the trajectory unit corresponding to the trajectory point adjacent to the pen down point
  • the connection point of the unit includes: if the connection mode of the trajectory unit corresponding to the trajectory point adjacent to the pen down point is the first connection mode, the second connection mode or the third connection mode , The connection point of the track unit corresponding to the pen point is determined by the connection of the track unit corresponding to the track point adjacent to the pen point; if the track unit corresponding to the track point adjacent to the pen point is The connection mode is the fourth connection mode, and the first connection point m5 and the second connection point n5 of the trajectory unit corresponding to the pen point are calculated according to the following formula: Wherein, (mx, my) represents the coordinates of the first connection point m5, (nx, ny) represents the coordinates of the second connection point n5, and (c1.x, c1.y) represents the coordinates of
  • connection points of the trajectory units are calculated according to the connection mode, and the polygons formed by the connection points of the trajectory units corresponding to the adjacent trajectory points are filled to
  • the handwriting used to form the display further includes: before filling the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points, judging the connection mode of the trajectory unit corresponding to the current trajectory point and the Whether the connection mode of the trajectory unit corresponding to the previous trajectory point is different; if it is different, use the connection mode of the trajectory unit corresponding to the current trajectory point to calculate the connection point of the trajectory unit corresponding to the previous trajectory point as The repeated connection point of the trajectory unit corresponding to the previous trajectory point; wherein, when filling the polygon formed by the connection points of the trajectory unit corresponding to the adjacent trajectory point, the previous trajectory point and the The polygon between the trajectory units corresponding to the current trajectory point is formed based on the repeated connection points.
  • the method before establishing the multiple raindrop-shaped trajectory units, the method further includes: selecting consecutive Z trajectory points including the pen down point, The pressure value in the trajectory information of each of the Z trajectory points is respectively added with a compensation value to obtain an updated pressure value, and the updated pressure value is used to replace the pressure value in the trajectory information; where 5 ⁇ Z ⁇ 15 and Z is an integer.
  • the Z compensation values corresponding to the Z trajectory points are sequentially decreased.
  • the method provided by an embodiment of the present disclosure further includes: performing anti-aliasing processing on the edge lines of the filling pattern.
  • performing the anti-aliasing processing on the edge line of the filling pattern includes: dividing each display pixel passed by the edge line according to the diagonal of the display pixel Are two regions, where the sign of the slope of the diagonal line is the same as the sign of the slope of the edge line; it is determined that the edge line passes through the area where the line segment of the display pixel is located; if the If the line segment is located in one of the two areas, the display pixel where the line segment is located and the display pixels adjacent to the area where the line segment is located in the y direction are displayed; If they overlap, the display pixel where the line segment is located is displayed.
  • the transparency of the display pixels adjacent to the area where the line segment is located in the y direction is calculated according to the following formula: Wherein, Td represents the transparency, and d MN represents the distance between the vertex of the area where the line segment is located and the line segment.
  • determining a set of track points based on multiple sampling points on the writing path on the working surface of the touch device and obtaining the track information of each track point includes: Part of the sampling points among all the sampling points on the writing path; obtaining the plurality of trajectory points based on the part of the sampling points, and obtaining trajectory information of the plurality of trajectory points.
  • the ratio of the number of the part of the sampling points to the total number of the sampling points is 1% to 5%.
  • At least one embodiment of the present disclosure further provides a handwriting forming device, including: a sampling unit configured to determine a set of trajectory points according to multiple sampling points on the writing path on the working surface of the touch device and obtain the value of each trajectory point Trajectory information, wherein the trajectory information includes coordinates, flags, and pressure values, and the flags include data indicating whether the corresponding trajectory point is a pen point; the modeling unit is configured to establish a connection with the trajectory information Multiple raindrop-shaped trajectory units corresponding to multiple trajectory points one-to-one; a connection mode determining unit configured to determine a connection mode between trajectory units corresponding to adjacent trajectory points based on the trajectory information; a filling unit, configured In order to calculate the connection points of the trajectory unit according to the connection mode, and fill the polygon formed by the connection points of the trajectory unit corresponding to the adjacent trajectory points to form the displayed handwriting.
  • a sampling unit configured to determine a set of trajectory points according to multiple sampling points on the writing path on the working surface of the touch device and obtain the value of each trajectory
  • At least one embodiment of the present disclosure further provides an electronic device, including: a processor; a memory, including one or more computer program modules; wherein the one or more computer program modules are stored in the memory and configured To be executed by the processor, the one or more computer program modules include instructions for implementing the handwriting forming method described in any of the foregoing embodiments.
  • the electronic device provided by an embodiment of the present disclosure further includes the touch device, wherein the touch device is configured to obtain the initial handwriting on the working surface of the touch device.
  • the electronic device provided by an embodiment of the present disclosure further includes a display device, wherein the display device is configured to display the handwriting formed by the handwriting forming method.
  • FIG. 1 is a schematic flowchart of a handwriting forming method provided by at least one embodiment of the present disclosure
  • step S110 in the handwriting forming method shown in FIG. 1;
  • step S120 in the handwriting forming method shown in FIG. 1;
  • FIG. 4A is one of the schematic diagrams of the trajectory unit provided by at least one embodiment of the present disclosure.
  • 4B is the second schematic diagram of the trajectory unit provided by at least one embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of pressure value samples provided by at least one embodiment of the present disclosure.
  • FIG. 6 is a schematic flowchart of step S130 in the handwriting forming method shown in FIG. 1;
  • FIG. 7A is a schematic diagram of a first connection method provided by at least one embodiment of the present disclosure.
  • FIG. 7B is a schematic diagram of a second connection method provided by at least one embodiment of the present disclosure.
  • FIG. 7C is a schematic diagram of a third connection method provided by at least one embodiment of the present disclosure.
  • FIG. 7D is a schematic diagram of a fourth connection method provided by at least one embodiment of the present disclosure.
  • FIG. 8 is one of the schematic flowcharts of step S140 in the handwriting forming method shown in FIG. 1;
  • FIG. 9 is the second schematic diagram of the flow of step S140 in the handwriting forming method shown in FIG. 1;
  • FIG. 10 is a schematic diagram of model connection of different connection modes provided by at least one embodiment of the present disclosure.
  • FIG. 11 is a schematic flowchart of anti-aliasing processing provided by at least one embodiment of the present disclosure.
  • FIG. 12A is a schematic diagram showing the anti-aliasing processing provided by at least one embodiment of the present disclosure
  • Fig. 12B is an enlarged view of area F in Fig. 12A;
  • FIG. 13 is an effect comparison diagram of anti-aliasing processing provided by at least one embodiment of the present disclosure.
  • FIG. 14 is an application flowchart of a handwriting forming method provided by at least one embodiment of the present disclosure.
  • 15 is a schematic diagram of a system that can be used to implement the handwriting forming method provided by the embodiments of the present disclosure
  • 16 is a schematic block diagram of a handwriting forming device provided by at least one embodiment of the present disclosure.
  • FIG. 17 is a schematic block diagram of an electronic device provided by at least one embodiment of the present disclosure.
  • FIG. 18 is a schematic block diagram of another electronic device provided by at least one embodiment of the present disclosure.
  • FIG. 19 is a schematic block diagram of still another electronic device provided by at least one embodiment of the present disclosure.
  • the smart terminal can simulate and display the handwriting written by the user, and the handwriting can be displayed in various types, such as brush writing, pen writing, etc., as required.
  • the writing brush is a traditional Chinese writing tool and painting tool.
  • the brush tip is made of animal hair, for example, and grows into a cone shape after absorbing ink for writing.
  • Brush writing has strong Chinese characteristics, reflects the charm of Chinese calligraphy, and can provide users with attractive visual effects.
  • the usual methods of simulating calligraphy with brushes mainly establish handwriting models for different writing skills when writing with a brush, such as the Vietnamese front and the exposed front of the pen, the slanted front and the side front in the stroke, etc., while ignoring the connection between the models.
  • the formed brush strokes are not smooth enough, lack of aesthetics, and the processing method is complicated, and the practicability is not strong.
  • At least one embodiment of the present disclosure provides a handwriting forming method, handwriting forming device, and electronic equipment.
  • the handwriting forming method can obtain beautiful handwriting with a brush, smooth handwriting, can embody a variety of strokes, small calculation amount, high processing efficiency, strong real-time performance, and simple and practical.
  • the handwriting forming method includes: determining a set of trajectory points according to a plurality of sampling points on a writing path on a working surface of a touch device and obtaining trajectory information of each trajectory point ,
  • the trajectory information includes coordinates, flags, and pressure values, the flags include data indicating whether the corresponding trajectory point is a pen point; based on the trajectory information, multiple raindrop-shaped trajectory units corresponding to multiple trajectory points are established one-to-one; based on the trajectory
  • the information determines the connection mode between the trajectory units corresponding to the adjacent trajectory points; calculates the connection points of the trajectory units according to the connection mode, and fills the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points, Used to form the displayed handwriting.
  • FIG. 1 is a schematic flowchart of a handwriting forming method provided by at least one embodiment of the present disclosure.
  • the handwriting forming method is applied to a computing device, and the computing device includes any electronic device with computing functions, such as a mobile phone, a notebook computer, a tablet computer, a desktop computer, a server, etc., which is not limited by the embodiments of the present disclosure.
  • the computing device has a central processing unit (Central Processing Unit, CPU) or a graphics processing unit (Graphics Processing Unit, GPU), and also includes a memory.
  • the memory is, for example, a non-volatile memory (for example, Read Only Memory (ROM)), and the code of the operating system is stored thereon.
  • the memory also stores codes or instructions, and by running these codes or instructions, the handwriting forming method provided by the embodiments of the present disclosure can be realized.
  • the computing device may also include a touch device, such as a touch screen or a touch pad, to obtain the initial handwriting formed on the working surface of the touch device when the user writes.
  • the touch screen can not only receive the initial handwriting, but also display correspondingly at the same time.
  • it can be a capacitive touch screen, such as a self-capacitive touch screen or a mutual capacitive touch screen, or a resistive touch screen, a surface acoustic wave touch screen, an infrared touch screen, etc.
  • the embodiment of the present disclosure does not limit this.
  • the user can write directly on the working surface of the touch screen with a finger, or can write on the working surface of the touch screen with an active stylus or a passive stylus, which is not limited in the embodiments of the present disclosure.
  • the work surface refers to a surface used to detect a user's touch operation, such as the touch surface of a touch screen.
  • the type of the touch device is not limited, and it can be not only a touch screen, but also any device with touch function such as an interactive whiteboard, which can be determined according to actual needs.
  • the computing device may also include a display device, such as a liquid crystal display (LCD), an organic light emitting diode (OLED) display, and a quantum dot light emitting diode (Quantum Dot Light Emitting).
  • a display device such as a liquid crystal display (LCD), an organic light emitting diode (OLED) display, and a quantum dot light emitting diode (Quantum Dot Light Emitting).
  • Diode, QLED QLED
  • the display device can display the handwriting formed by the handwriting forming method provided by the embodiment of the present disclosure, for example, the handwriting of a brush.
  • the handwriting forming method includes the following operations.
  • Step S110 Determine a set of trajectory points according to multiple sampling points on the writing path on the working surface of the touch device and obtain trajectory information of each trajectory point.
  • the trajectory information includes coordinates, flags and pressure values, and the flags include Indicate whether the corresponding track point is the data of the pen point;
  • Step S120 Establish multiple raindrop-shaped trajectory units corresponding to multiple trajectory points one-to-one based on the trajectory information
  • Step S130 Determine the connection mode between the trajectory units corresponding to the adjacent trajectory points based on the trajectory information
  • Step S140 Calculate the connection points of the trajectory units according to the connection method, and fill the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points to form the displayed handwriting.
  • the touch device may be a touch screen, and accordingly, the work surface may be a touch surface of the touch screen to detect a user's touch operation.
  • the touch device can detect the amount of force distributed along the writing path.
  • Sampling points For example, when the touch device detects these sampling points, it can obtain the pressure values, coordinates, and flags of these sampling points.
  • the touch device can obtain a set of trajectory points and trajectory information of the trajectory points. For example, a group of trajectory points includes multiple trajectory points.
  • the trajectory information includes pressure values, coordinates, and flags.
  • the pressure value represents the force with which the user touches the corresponding track point (corresponding sampling point).
  • the pressure value may be the original pressure value or the pressure value after normalization, which is not limited in the embodiment of the present disclosure.
  • the pressure value may be detected by a pressure sensor provided in the touch device, and the pressure sensor may include a piezoelectric film to sense the pressure applied to the work surface when the user writes on the work surface of the touch device; or, when the user uses When the stylus pen writes on the work surface of the touch device, the stylus pen may be provided with a pressure sensor to detect the pressure applied by the user to the work surface.
  • the embodiment of the present disclosure does not limit the way of detecting the pressure value.
  • the coordinates indicate the position of the corresponding track point (corresponding sampling point) in the work surface.
  • the coordinates are coordinates in a rectangular coordinate system within the work surface, and the origin of the rectangular coordinate system is determined by the setting of the touch device itself.
  • the flag includes data indicating whether the corresponding track point is a pen-down point, and the pen-down point refers to, for example, the first sampling point detected in a continuous writing path.
  • the flag can be a preset number, character, character string, etc.
  • the flag bit can be set to "down".
  • the flag bit may also include data indicating whether the corresponding track point is a pen ending point or a pen moving point, for example, "up” and “move-on” respectively.
  • the setting mode and setting rule of the flag bit can be determined according to actual requirements, and the embodiment of the present disclosure does not limit this.
  • the pressure value, coordinates, and flags in the trajectory information are detected by the touch device, and the method of obtaining and displaying these information can be determined according to the settings of the touch device itself.
  • the embodiment does not limit this.
  • the trajectory information of the trajectory point that is, the pressure value, the coordinates, and the flag can be directly obtained from the touch device.
  • the foregoing step S110 may include the following operations.
  • Step S111 Select a part of all the sampling points on the writing path
  • Step S112 Obtain multiple trajectory points based on a part of the sampling points, and obtain trajectory information of the multiple trajectory points.
  • a part of the sampling points is selected, that is, all sampling points are sparsely sampled.
  • the ratio of the number of selected sampling points to all sampling points is 1% to 5%, such as 2%.
  • 1 to 5 sampling points are selected from every 100 sampling points, for example, 2 sampling points are selected.
  • the ratio of the number of selected sampling points to all sampling points is 1%-40%.
  • sampling points as pen down points are numbered 1, and all the sampling points located on the writing path are sequentially numbered to form a sequence, and the selected sampling points are more evenly distributed in the sequence composed of all the sampling points.
  • sparse sampling the number of sampling points that need to be processed can be greatly reduced, processing efficiency is improved, and real-time performance is improved.
  • trajectory points are obtained based on the selected sampling points.
  • the selected sampling point may be used as the trajectory point, and accordingly, the trajectory information of each trajectory point can be obtained from the touch device.
  • the selected sampling points can be smoothed, and after smoothing, the track points and the corresponding track information can be obtained.
  • the smoothing process may adopt a common smoothing process algorithm and a smoothing process method, which is not limited in the embodiment of the present disclosure.
  • a sampling point is a point obtained by touch detection by a touch collection component in a touch device, and the sampling point carries information such as speed, coordinates, and type (for example, whether it is a pen point).
  • the sampling points provided by the touch device sparse sampling and interpolation are performed, so that the track points can be obtained.
  • sparse sampling has been described above and will not be repeated this time.
  • the interpolation processing can make the obtained multiple track points smoother, that is, the interpolation processing can achieve the effect of the smoothing processing described above.
  • the required parameters include, for example, the information of the other two sampling points adjacent to the sampling point, such as the information of the sampling point before the sampling point and the sampling after the sampling point Point of information. Therefore, the information of the trajectory point corresponding to the sampling point, such as speed, coordinates, type, etc., can be obtained through interpolation calculation.
  • a set of trajectory points can be obtained.
  • the type of the trajectory point is the same as the type of the corresponding sampling point
  • the velocity of the trajectory point is obtained by simulation calculation, for example, by calculating the mean value or the numerical arithmetic difference of the velocities of the two sampling points before and after.
  • the interpolation processing please refer to the conventional design, which will not be repeated here.
  • step S120 multiple raindrop-shaped trajectory units corresponding to multiple trajectory points one-to-one are established based on trajectory information, that is, a trajectory unit is created for each trajectory point.
  • the trajectory unit includes two solid circles of different sizes and a common tangent of the two circles, and has a shape similar to a raindrop.
  • step S120 may include the following operations.
  • Step S121 Determine the first center coordinate and the first radius of the first circle
  • Step S122 Determine the second center coordinate and the second radius of the second circle
  • Step S123 Fill the first circle and the second circle, and fill the polygon formed by the common tangent point of the first circle and the second circle.
  • the trajectory unit includes a first circle 01 and a second circle 02.
  • the radius of the first circle 01 is called the first radius R1
  • the radius of the second circle 02 is called the second radius R2
  • the first radius R1 is greater than the second radius R2, that is, the first circle 01 is a larger circle
  • the second circle 02 is a smaller circle.
  • the common tangent points of the first circle 01 and the second circle 02 are A1, A2, A3, A4, and the common tangent line is with
  • the trajectory unit is composed of a polygon formed by the first circle 01, the second circle 02, and the common tangent points A1, A2, A3, and A4.
  • step S121 the coordinates of the center c1 of the first circle 01 are called the first center coordinates, and the first center coordinates are the coordinates of the corresponding track points.
  • the coordinates in the track information may be directly used as the first center coordinates.
  • the first radius R1 is the product of the pressure sensitivity and the preset values of a plurality of writing parameters.
  • multiple preset values of writing parameters include brush diameter and line width.
  • the first radius R1 is the product of pressure sensitivity, brush diameter and line width.
  • Different brush diameters and different line widths can make the formed handwriting have different visual effects.
  • the brush diameter and the line width of the drawing line can adopt preset default values, or can be set by the user before executing the handwriting forming method, which can be determined according to actual needs, and the embodiment of the present disclosure does not limit this.
  • the pressure sensitivity is obtained based on the pressure value of the corresponding track point. Since the strength of the user when writing on the touch device is variable, the strength can be light or heavy. Only when the size of the track unit corresponding to the adjacent track point does not change significantly, a more beautiful writing handwriting can be formed. Moreover, the handwriting is usually thinner when the brush is lighter when writing. Based on the above considerations, the pressure sensitivity is used to establish the trajectory unit, so that the formed handwriting is relatively smooth, and it can also reflect the characteristics of the speed of the pen. As shown in Figure 5, the pressure values of a large number of sampling points when different users are writing can be collected through experiments to obtain a large number of pressure value samples, and then the pressure sensitivity function can be obtained according to the pressure value samples.
  • the pressure value is the data after normalization processing.
  • the pressure sensitivity function can be obtained by using statistical methods and combining with simulation optimization processing.
  • the pressure sensitivity function is as follows:
  • Pz represents the pressure sensitivity
  • P represents the pressure value
  • the pressure value provided by the touch device after the touch detection is completed is the normalized data, and the pressure value can be directly substituted into the above formula to obtain the pressure sensitivity.
  • the pressure value provided by the touch device after the touch detection has not been normalized. Therefore, before the pressure sensitivity is calculated, the pressure value provided by the touch device needs to be normalized. The normalized pressure value is substituted into the above formula to obtain the pressure sensitivity.
  • the value range of the pressure sensitivity Pz is between 0 and 1.
  • the pressure value P is less than 0.4
  • the pressure sensitivity is set to a fixed value of 0.25, thereby ensuring a relatively stable pen down effect when the user writes.
  • the pressure value is 0.4 ⁇ P ⁇ 0.8
  • the pressure sensitivity is set to a fixed value of 1, thereby preventing the handwriting from suddenly becoming larger and affecting the appearance.
  • the above-mentioned pressure-sensitive function is only exemplary and not restrictive.
  • the pressure-sensitive function can be adjusted according to actual needs, and the embodiment of the present disclosure does not limit this.
  • the coefficients in the pressure sensitivity function can be adjusted, such as appropriately increasing or decreasing, the division area of the pressure value P in the pressure sensitivity function can also be adjusted, and the induction pressure sensitivity function can be redesigned, which can be based on It depends on actual needs.
  • the coordinates of the center c2 of the second circle 02 are called the second center coordinates, and the second center coordinates are obtained from the first center coordinates, the center distance, and the angle of the line connecting the center of the center.
  • the center distance is the distance between the center c1 of the first circle 01 and the center c2 of the second circle 02.
  • the center distance is Q times the product of the brush length and the pressure value of the corresponding track point, 2 ⁇ Q ⁇ 7.
  • the brush length may adopt a preset default value, or it may be set by the user before executing the handwriting forming method, which may be determined according to actual needs, which is not limited in the embodiment of the present disclosure.
  • the connecting angle of the center of the circle is the angle ⁇ between the connecting line L1 of the center c1 of the first circle 01 and the center c2 of the second circle 02 and the x-axis direction of the coordinate system of the first circle center.
  • the included angle ⁇ is an acute angle, and is the included angle between the line L1 and the negative direction of the x-axis.
  • the first circle center coordinates are the coordinates of the corresponding track points, which are provided by the touch device
  • the coordinate system where the first circle center coordinates are located is the coordinate system located on the work surface defined by the touch device.
  • the angle of the line connecting the center of the circle is 15-60 degrees, such as 20-45 degrees, or 30 degrees.
  • the second circle center coordinate can be obtained by using the knowledge of plane geometry.
  • 4.5 ⁇ Q ⁇ 5.5, and the angle of the line connecting the center of the circle is 25 to 35 degrees.
  • t represents the ink density
  • t max (0.8*T/n, 0.6).
  • T is a constant and can be set to 0.8.
  • n is the number of the track point.
  • the serial number of the trajectory point as the pen-down point is 1, and the subsequent trajectory points are sequentially numbered 2, 3, 4, and so on.
  • the above formula for calculating the ink concentration t is exemplary and not restrictive, and can be adjusted according to actual needs, which is not limited in the embodiments of the present disclosure.
  • step S123 on the premise that the first circle center coordinates, the first radius R1, the second circle center coordinates, and the second radius R2 are known, the common tangent point A1 of the first circle 01 and the second circle 02 can be calculated. , A2, A3, and A4, and then fill the polygon formed by the first circle 01, the second circle 02, and the common tangent points A1, A2, A3, and A4 to obtain the trajectory unit corresponding to the trajectory point.
  • step S130 the connection mode between the trajectory units corresponding to adjacent trajectory points is determined based on the trajectory information.
  • “adjacent” does not mean that the two track points are adjacent to each other on the working surface of the touch device, but refers to the one obtained by the two track points based on multiple sampling points located on the writing path.
  • the group of track points are adjacent in a sequence composed of serial numbers, that is, the sequence numbers of the two track points are adjacent.
  • the track point with serial number 1 is adjacent to the track point with serial number 2.
  • the track point with sequence number 4 is not only adjacent to the track point with sequence number 5, but also with the track point with sequence number 3.
  • step S130 may include the following operations.
  • Step S131 Calculate the slope of the line connecting the current trajectory point and the previous trajectory point for the trajectory points other than the pen-down point;
  • Step S132 According to the slope, the coordinates of the current trajectory point and the coordinates of the previous trajectory point, determine the connection mode adopted by the trajectory unit corresponding to the current trajectory point.
  • step S131 the slope can be calculated according to the following formula:
  • k represents the slope
  • (x2, y2) represents the coordinates of the current trajectory point
  • (x1, y1) represents the coordinates of the previous trajectory point.
  • the above-mentioned connection modes include a first connection mode, a second connection mode, a third connection mode, and a fourth connection mode.
  • the first connection method corresponds to the stroke "horizontal”
  • the second connection method corresponds to the stroke " ⁇ ”
  • the third connection method corresponds to the stroke "lift”
  • the fourth connection method corresponds to Strokes other than the above three strokes.
  • the following rules can be used to determine the connection method of the trajectory unit corresponding to the current trajectory point.
  • the first connection mode is, for example, the connection mode shown in FIG. 7A, that is, The connection method corresponding to the stroke "horizontal". If -0.9 ⁇ k ⁇ -0.6 and x2>x1, it is determined that the trajectory unit corresponding to the current trajectory point adopts the second connection method.
  • the second connection method is, for example, the connection method shown in FIG. 7B, that is, the stroke " ⁇ " corresponds to the connection method. If 0.6 ⁇ k ⁇ 1 and y2 ⁇ y1, it is determined that the trajectory unit corresponding to the current trajectory point adopts the third connection method.
  • the third connection method is, for example, the connection method shown in FIG. Corresponding connection method. Otherwise, determine that the trajectory unit corresponding to the current trajectory point adopts the fourth connection method.
  • the fourth connection method is, for example, the connection method shown in FIG. .
  • connection method when determining the connection method, it can be determined in order according to the foregoing content. That is, first determine whether the conditions for using the first connection method are met; if not, then determine whether the conditions for using the second connection method are met; if it is still not met, then determine whether the conditions for using the third connection method are met. Conditions; if not satisfied, the fourth connection method is used.
  • trajectory point as the pen point (the trajectory point with serial number 1, that is, the first trajectory point on a continuous writing path)
  • the connection method of the trajectory unit corresponding to the trajectory point Determining the connection point of the trajectory unit corresponding to the trajectory point will be described later, and will not be repeated here.
  • connection points of the trajectory units are calculated according to the connection mode, and the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points Fill in to form the displayed handwriting.
  • step S140 may include the following operations.
  • Step S141 Calculate the connection points of the trajectory unit according to the determined one of the first connection mode, the second connection mode, the third connection mode and the fourth connection mode for the trajectory points other than the pen-down point;
  • Step S142 Fill the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points;
  • Step S143 For the trajectory point as the pen down point, the connection point of the trajectory unit corresponding to the pen down point is determined according to the connection mode of the trajectory unit corresponding to the trajectory point adjacent to the pen down point.
  • step S141 according to different connection methods, different formulas are used to calculate the connection points of the trajectory units, and the calculated connection points are used to subsequently fill the area between adjacent trajectory units.
  • the method of calculating the connection point will be described in detail below in conjunction with the connection method shown in FIGS. 7A-7D.
  • connection points of the track unit E2 include a first connection point m1 and a second connection point n1.
  • (mx, my) represents the coordinates of the first connection point m1
  • (nx, ny) represents the coordinates of the second connection point n1
  • (c1.x, c1.y) represents the coordinates of the first circle center in the trajectory unit E2
  • (C2.x, c2.y) represents the second circle center coordinates in the trajectory unit E2
  • R1 represents the first radius in the trajectory unit E2
  • R2 represents the second radius in the trajectory unit E2
  • represents the trajectory The angle of the line connecting the center of the circle in unit E2.
  • the coordinates of the first connection point m1, the coordinates of the second connection point n1, the first circle center coordinates, and the second circle center coordinates are located in the same coordinate system on the working surface of the touch device.
  • "floor" means round-down operation.
  • the first connection mode corresponds to the stroke "horizontal”
  • the part between the trajectory unit E2 corresponding to the current trajectory point and the trajectory unit E1 corresponding to the previous trajectory point is a line in the stroke "horizontal”.
  • the first connection point m1 and the second connection point n1 calculated in the above manner are used for subsequent filling, which can make the formed handwriting more consistent with the "horizontal" writing characteristics of the stroke.
  • connection points of the trajectory unit E2 include a first connection point m2 and a second connection point n2.
  • (mx, my) represents the coordinates of the first connection point m2
  • (nx, ny) represents the coordinates of the second connection point n2
  • (c2.x, c2.y) represents the coordinates of the second circle center in the trajectory unit E2
  • R1 represents the first radius in the track unit E2
  • R2 represents the second radius in the track unit E2.
  • the coordinates of the first connection point m2, the coordinates of the second connection point n2, and the coordinates of the second circle center are located in the same coordinate system on the working surface of the touch device.
  • "floor” means round-down operation
  • "ceil” means round-up operation.
  • the second connection method corresponds to the stroke " ⁇ "
  • the part between the trajectory unit E2 corresponding to the current track point and the trajectory unit E1 corresponding to the previous trajectory point is a line in the stroke " ⁇ ”.
  • the first connection point m2 and the second connection point n2 calculated in the above manner are used for subsequent filling, which can make the formed handwriting more consistent with the writing characteristics of the stroke " ⁇ ".
  • connection points of the track unit E2 include the first connection point m3 and the second connection point n3.
  • (mx, my) represents the coordinates of the first connection point m3
  • (nx, ny) represents the coordinates of the second connection point n3
  • (c2.x, c2.y) represents the coordinates of the second circle center in the trajectory unit E2
  • R2 represents the second radius in the track unit E2.
  • the coordinates of the first connection point m3, the coordinates of the second connection point n3, and the coordinates of the second circle center are located in the same coordinate system on the working surface of the touch device.
  • “floor” means round-down operation
  • "ceil” means round-up operation.
  • the third connection mode corresponds to the stroke "lift"
  • the part between the trajectory unit E2 corresponding to the current trajectory point and the trajectory unit E1 corresponding to the previous trajectory point is a line in the stroke "lift”.
  • the first connection point m3 and the second connection point n3 calculated in the above manner are used for subsequent filling, which can make the formed handwriting more consistent with the writing characteristics of the stroke "lifting".
  • connection points of the track unit E2 include the first connection point m4 and the second connection point n4.
  • (mx, my) represents the coordinates of the first connection point m4
  • (nx, ny) represents the coordinates of the second connection point n4
  • (c1.x, c1.y) represents the coordinates of the first circle center in the trajectory unit E2
  • (C2.x, c2.y) represents the second circle center coordinates in the trajectory unit E2
  • R1 represents the first radius in the trajectory unit E2
  • R2 represents the second radius in the trajectory unit E2
  • represents the trajectory The angle of the line connecting the center of the circle in unit E2.
  • the coordinates of the first connection point m4, the coordinates of the second connection point n4, the first circle center coordinates, and the second circle center coordinates are located in the same coordinate system on the working surface of the touch device.
  • "floor” means round-down operation
  • "ceil” means round-up operation.
  • the fourth connection method corresponds to strokes other than the above three strokes, and the part between the track unit E2 corresponding to the current track point and the track unit E1 corresponding to the previous track point is a line in the stroke.
  • the first connection point m4 and the second connection point n4 calculated in the above manner are used for subsequent filling, which can make the formed handwriting have better continuity, and is suitable for forming a variety of strokes.
  • the formulas for calculating the connection points respectively adopted by the first connection mode, the second connection mode, the third connection mode, and the fourth connection mode are only exemplary. In a non-limiting manner, the above formulas can be adjusted according to actual needs, and the embodiments of the present disclosure do not limit this.
  • connection points of the trajectory units corresponding to each trajectory point are calculated, the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points is filled, thereby making the multiple trajectory units corresponding to the multiple trajectory points Form continuous handwriting between each other.
  • the first connection point m1 and the second connection point n1 are two adjacent vertices of a polygon (such as a quadrilateral) between the track unit E2 and the track unit E1,
  • the other two vertices of the polygon are the two connection points on the track unit E1.
  • Filling the polygon can make a continuous handwriting formed between the track unit E2 and the track unit E1.
  • the second connection method shown in FIG. 7A the second connection method shown in FIG.
  • the first connection point m2 and the second connection point n2 are two adjacent vertices of a polygon (for example, a quadrilateral) between the track unit E2 and the track unit E1,
  • the other two vertices of the polygon are the two connection points on the track unit E1.
  • Filling the polygon can make a continuous handwriting formed between the track unit E2 and the track unit E1.
  • the filling of the polygon adopts a similar method, which will not be repeated here.
  • the connection point of the trajectory unit corresponding to the pen entry point is determined according to the connection mode of the trajectory unit corresponding to the trajectory point adjacent to the pen entry point. For example, if the serial number of the trajectory point as the pen point is 1, then the connection point of the trajectory unit corresponding to the pen point is determined according to the connection mode of the trajectory unit corresponding to the trajectory point with serial number 2, so that the trajectory unit corresponding to the pen point can be
  • the trajectory units corresponding to the trajectory points with the sequence number 2 form polygons and fill them.
  • connection mode of the trajectory unit corresponding to the trajectory point adjacent to the pen down point (that is, the trajectory point with sequence number 2) is the first connection mode, the second connection mode or the third connection mode, then the same as the pen down
  • the connection mode of the trajectory unit corresponding to the adjacent trajectory point determines the connection point of the trajectory unit corresponding to the pen point. For example, in some examples, when the connection mode of the trajectory unit corresponding to the trajectory point with sequence number 2 is the first connection mode, the first connection mode is used to calculate the connection point of the trajectory unit corresponding to the pen point, that is, Calculate the first connection point and the second connection point of the trajectory unit corresponding to the pen point by using the formula corresponding to the aforementioned first connection mode.
  • connection mode of the trajectory unit corresponding to the trajectory point with sequence number 2 is the second connection mode or the third connection mode
  • the second connection mode or the third connection mode is used to calculate the trajectory unit corresponding to the pen point
  • the connection point, that is, the first connection point and the second connection point of the trajectory unit corresponding to the pen point are calculated using the formula corresponding to the aforementioned second connection mode or the third connection mode, which will not be repeated here.
  • connection mode of the trajectory unit corresponding to the trajectory point adjacent to the pen point is the fourth connection mode
  • the first connection point of the trajectory unit corresponding to the pen point is calculated according to the following formula m5 and the second connection point n5:
  • (mx, my) represents the coordinates of the first connection point m5
  • (nx, ny) represents the coordinates of the second connection point n5
  • (c1.x, c1.y) represents the first center of the trajectory unit corresponding to the pen point Coordinates
  • (c2.x, c2.y) represent the second circle center coordinates of the trajectory unit corresponding to the pen point
  • R1 represents the first radius of the trajectory unit corresponding to the pen point
  • R2 represents the second radius of the trajectory unit corresponding to the pen point
  • represents the connecting angle of the center of the trajectory unit corresponding to the pen down point.
  • the coordinates of the first connection point m5, the coordinates of the second connection point n5, the first circle center coordinates, and the second circle center coordinates are located in the same coordinate system on the working surface of the touch device.
  • the first connection point m5 and the second connection point n5 are used for subsequent filling, it can have a better pen-down shape and make the handwriting more beautiful.
  • connection points of the trajectory units corresponding to any two adjacent trajectory points can form a polygon (for example, using these connection points as vertices can form a quadrilateral), Fill these polygons, so that a coherent handwriting can be formed between multiple trajectory units.
  • step S140 in FIG. 1 may further include the following operations.
  • Step S144 Before filling the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points, determine the connection mode of the trajectory unit corresponding to the current trajectory point and the connection mode of the trajectory unit corresponding to the previous trajectory point Whether it's different
  • Step S145 if they are different, the connection point of the trajectory unit corresponding to the previous trajectory point is calculated using the connection method of the trajectory unit corresponding to the current trajectory point as the repeated connection point of the trajectory unit corresponding to the previous trajectory point.
  • the polygon between the previous trajectory point and the trajectory unit corresponding to the current trajectory point is formed based on the repeated connection points.
  • FIG. 10 is a schematic diagram of model connection of different connection modes provided by at least one embodiment of the present disclosure. The above steps S144 and S145 will be described below with reference to FIG. 10.
  • the three trajectory units E3, E4, and E5 are respectively the trajectory units corresponding to three adjacent trajectory points. These three adjacent trajectory points are, for example, serial numbers 3, 4, and 5 respectively. Three track points. In the following description, these three trajectory points are called No. 3 trajectory point, No. 4 trajectory point, and No. 5 trajectory point, respectively. Correspondingly, these 3 trajectory units are called No. 3 trajectory unit E3 and No. 4 trajectory respectively. Unit E4 and No. 5 track unit E5.
  • the track unit No. 4 corresponding to track point No. 4 uses the first connection method.
  • the two connection points m and n of the track unit E4 No. 4 are calculated.
  • the track unit No. 5 corresponding to track point No. 5 adopts the second connection method, thus
  • the two connection points B1 and B2 of the No. 5 trajectory unit E5 are calculated.
  • the two connection points B3 and B4 of the No. 3 trajectory unit E3 can be calculated based on the No. 3 trajectory point and the No. 2 trajectory point (not shown in the figure), For example, the track unit E3 No. 3 adopts the first connection method.
  • connection method of track unit E4 No. 4 is the same as the connection method of track unit E3 No. 3, which is the first connection method, so the polygon formed by connecting points m, n, B3, and B4 is filled That's it.
  • connection method of track unit E5 No. 5 is different from the connection method of track unit E4 No. 5
  • the connection method of track unit E5 No. 5 is the second connection method
  • the connection method of track unit E4 No. 4 The line mode is the first connection mode. Therefore, it is necessary to use the connection method of No. 5 trajectory unit E5 (that is, the second connection method) to calculate the connection point of No. 4 trajectory unit E4 again to obtain connection points m'and n', and call the connection points m'and n' It is the repeated connection point of track unit E4.
  • the track unit No. 4 E4 has not only connection points m and n, but also repeated connection points m'and n'.
  • the polygon between the 4th track unit E4 and the 5th track unit E5 is formed based on the repeated connection points m'and n', while the polygon between the 4th track unit E4 and the 3rd track unit E3 is formed based on the connection points m and n, Therefore, the handwriting formed after filling can have no gap at the joint (that is, the position where the track unit E4 No. 4 is located), so that different strokes can be continuously connected and smoothly transitioned, thereby improving the aesthetics of the handwriting.
  • the handwriting forming method may further include an operation for realizing a stroke effect, and the operation is as follows:
  • Step S160 Select consecutive Z trajectory points including pen down points, add the compensation value to the pressure value in the trajectory information of each of the Z trajectory points to obtain the updated pressure value, and replace it with the updated pressure value The pressure value in the trajectory information.
  • 5 ⁇ Z ⁇ 15 and Z is an integer.
  • Z 9.
  • step S160 the pressure values corresponding to the consecutive Z trajectory points including the pen down point are compensated, and then the compensated pressure value is used to establish a trajectory unit and perform subsequent processing. Thereby, a stable and full pen-down can be formed to form a pen-point effect.
  • the Z compensation values corresponding to the above Z trajectory points are sequentially decreased.
  • the pressure sensitivity is equal to the constant 0.25, which also helps to obtain the pen sharp effect.
  • the pressure values corresponding to the 9 consecutive track points including the pen down point are respectively added to the compensation value 0.3, 0.23, 0.2, 0.17, 0.15, 0.1, 0.08, 0.04, 0.01.
  • the updated pressure value replace the pressure value in the trajectory information with the updated pressure value, and then perform subsequent operations such as establishing a trajectory unit based on the trajectory information.
  • the trajectory units corresponding to the 9 trajectory points are sequentially reduced, and by filling the polygons between the trajectory units, a full pen down can be formed, which has a beautiful stroke effect.
  • the specific value of the compensation value used for pen tip processing is not limited, and the compensation value in the above example is only exemplary and not restrictive, which can be based on actual needs. However, it is only necessary to sequentially reduce the multiple compensation values, which is not limited in the embodiments of the present disclosure.
  • the number of trajectory points used for pen tip processing is also not limited, which can be determined according to actual needs, for example, depending on the pen tip effect that needs to be achieved.
  • the handwriting forming method may further include the following operations:
  • Step S170 Perform anti-aliasing processing on the edge lines of the filling pattern.
  • a jagged or stepped appearance may appear on non-horizontal and non-vertical straight or polygonal boundaries, forming edge burrs.
  • the post-reconstruction information distortion caused by insufficient sampling caused by such discrete sampling is called aliasing.
  • anti-aliasing can be performed on the edge lines of the filling pattern to reduce or eliminate the edge burrs of the lines.
  • the above step S170 may be performed simultaneously with the step S120 shown in FIG. 1 or after the step S120 to eliminate the burr at the boundary of the trajectory unit.
  • the above-mentioned step S170 may be performed at the same time as the step S140 shown in FIG. 1 or after the step S140, so as to eliminate the burr at the boundary of the polygon between the trajectory units.
  • the above step S170 may be executed before the handwriting is displayed by the display device, so as to completely eliminate edge burrs in the handwriting.
  • the embodiment of the present disclosure does not limit this.
  • step S170 may include the following operations:
  • Step S171 Divide each display pixel passed by the edge line into two regions according to the diagonal line of the display pixel, and the sign of the slope of the diagonal line is the same as the sign of the slope of the edge line;
  • Step S172 Determine the area where the edge line passes through the line segment of the display pixel
  • Step S173 if the line segment is located in one of the two areas, display the display pixel where the line segment is located and the display pixels adjacent to the area where the line segment is located in the y direction;
  • Step S174 If the line segment coincides with the diagonal line, display the display pixel where the line segment is located.
  • FIG. 12A is a schematic display diagram of anti-aliasing processing provided by at least one embodiment of the present disclosure
  • FIG. 12B is an enlarged view of area F in FIG. 12A. The above steps S171-S174 will be described below with reference to FIG. 12A and FIG. 12B.
  • the line where the two coordinate points are located is the central axis and w is the line
  • the line Lz with a slope of k shown in the figure needs to be subjected to anti-aliasing processing, and a plurality of squares arranged in an array in the figure represent display pixels arranged in an array.
  • each display pixel passed by the edge line is divided into two regions according to the diagonal line of the display pixel, and the sign of the slope of the diagonal line is the same as the sign of the slope of the edge line.
  • the display pixel D1 through which the line Lz passes is divided into two areas according to the diagonal line L1 of the display pixel D1, namely a first area Z1 and a second area Z2.
  • the sign of the slope of the diagonal line L1 is the same as the sign of the slope k of the line Lz.
  • the slope k of the line Lz is a negative number, so the slope of the diagonal line L1 is also a negative number.
  • the display pixel D1 is a square with two diagonal lines perpendicular to each other, the slope of one diagonal line is a positive number, and the slope of the other diagonal line is a negative number.
  • the sign of the slope of the diagonal line used is the same as the sign of the slope k of the line Lz.
  • step S172 it is determined that the edge line passes through the area where the line segment of the display pixel is located.
  • the line Lz passing through the line segment of the display pixel D1 is located in the second area Z2.
  • step S173 if the line segment is located in one of the two areas, the display pixel where the line segment is located and the display pixels adjacent to the area where the line segment is located in the y direction are displayed.
  • the line segment of the line Lz passing through the display pixel D1 is located in the second area Z2, so that the display pixel D1 and the display adjacent to the second area Z2 in the y direction are displayed
  • the pixel D2 performs display.
  • the line Lz passes through the display pixel D1 and does not pass through the display pixel D2
  • both the display pixel D1 and the display pixel D2 are displayed.
  • the display pixel D1 and the display pixels adjacent to the first area Z1 in the y direction need to be displayed.
  • step S174 if the line segment coincides with the diagonal line, the display pixel where the line segment is located is displayed. At this time, only the display pixels passing by the line segment are displayed, and other display pixels adjacent to the display pixel in the y direction are not displayed. This situation is not shown in Figure 12B.
  • the above steps S172-S174 may also be implemented in the following manner.
  • the coordinate value of the center of the display pixel (that is, the center of the grid) is a floating-point value
  • xi represents the x-axis coordinate of the center of the display pixel
  • any point on the line segment where the line Lz passes through the display pixel D1 can be expressed as M( xi,kx+b)
  • k represents the slope
  • b represents the offset of the line Lz.
  • the line Lz passing through the vertex of the area where the line segment of the display pixel D1 is located (in FIG. 12B, the point at the upper right corner of the display pixel D1) can be expressed as N(int(xi)+1,int(kx+b)+1).
  • the distance d MN from N to the line Lz is equal to It is determined that the line segment Lz passing through the display pixel D1 coincides with the diagonal of the display pixel D1, so that the display pixel D1 is displayed, and other display pixels adjacent to the display pixel D1 in the y direction are not displayed. If the distance d MN from N to the line Lz is less than It is determined that the line segment where the line Lz passes through the display pixel D1 is located in the second area Z2, so that the display pixel D1 and the display pixel D2 adjacent to the second area Z2 in the y direction are displayed.
  • the display pixel D2 is the display pixel where the coordinate point (xi, kx+b+1) is located.
  • the display pixel is the display pixel where the coordinate point (xi, kx+b-1) is located.
  • the side length of the display pixel is normalized to 1, the distance from the vertex of the display pixel to its diagonal is equal to From this, it is determined that the distance d MN from vertex N to line Lz and The relationship of is essentially consistent with the area where the line segment where the line Lz passes through the display pixel is judged.
  • the slope k of the line Lz is a negative value, the point at the upper right corner of the display pixel is selected as the aforementioned vertex.
  • the slope of the line is a positive value, the point at the upper left corner of the display pixel needs to be selected as the aforementioned vertex.
  • FIG. 13 is a comparison diagram of the effects of anti-aliasing processing provided by at least one embodiment of the present disclosure. It can be seen from FIG. 13 that after anti-aliasing processing, the smoothness of the edge lines of the display pattern is greatly improved, the edge burr is significantly improved, and the aesthetics of the display pattern is improved.
  • the transparency of the adjacent display pixel can be set to Achieve better treatment effect.
  • the transparency of the adjacent display pixels can be calculated according to the following formula:
  • Td represents transparency
  • d MN represents the distance between the vertex of the region where the corresponding line segment is located and the line segment.
  • 0 ⁇ Td ⁇ 1 means transparent to a certain extent and the degree of transparency decreases as the value increases.
  • the closer the line segment is to the vertex the more opaque the adjacent display pixel is; the closer the line segment is to the diagonal of the display pixel, the more transparent the adjacent display pixel is.
  • the product of the color value (or grayscale value) and the transparency is the final displayed color value (or grayscale value).
  • the method of performing anti-aliasing processing is not limited to the method described above, and can also be any applicable anti-aliasing processing method, which can be determined according to actual needs. There is no restriction on this.
  • a general anti-aliasing processing method can be used, or the anti-aliasing processing method described above can also be modified and adjusted, which is not limited in the embodiments of the present disclosure.
  • the execution order of the steps of the handwriting forming method is not limited. Although the execution process of each step is described in a specific order above, this does not constitute a limitation to the embodiment of the present disclosure. .
  • the steps in the handwriting forming method can be executed serially or in parallel, which can be determined according to actual requirements.
  • the handwriting forming method may also include more or fewer steps, which is not limited in the embodiment of the present disclosure.
  • FIG. 14 is an application flowchart of a handwriting forming method provided by at least one embodiment of the present disclosure.
  • the application process of the handwriting forming method provided by the embodiment of the present disclosure will be exemplarily described below with reference to FIG. 14.
  • the user writes on the working surface of a touch device (such as a touch screen) with a finger or a stylus.
  • a touch device such as a touch screen
  • the writing path is the Chinese character " ⁇ ”
  • the touch device detects and obtains all sampling points and corresponding coordinates and pressures on the writing path. Value and flag bits.
  • all sampling points are sparsely sampled, and smoothing (or interpolation processing) is performed to obtain multiple trajectory points and trajectory information.
  • the trajectory information includes, for example, coordinates, pressure values, and flags.
  • trajectory point-level processing is performed. Based on the trajectory information, a trajectory unit is established for each trajectory point, and the edge lines of the trajectory unit are processed for anti-aliasing.
  • the connection mode between the trajectory units corresponding to the adjacent trajectory points is determined based on the trajectory information. After the connection mode is determined, the connection points of the trajectory units are calculated according to the connection mode, and the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points is filled. In addition, anti-aliasing processing is performed on the edge lines of the filled polygons.
  • the displayed handwriting can be formed, for example, it can be displayed as a brush character "Jia".
  • the corresponding brush writing can be formed by using the above methods, thereby providing the user with a new sensory experience and improving the user experience.
  • the handwriting forming method can obtain beautiful handwriting with a brush, smooth handwriting, can embody a variety of strokes, small calculation amount, high processing efficiency, strong real-time performance, and simple and practical.
  • FIG. 15 is a schematic diagram of a system that can be used to implement the handwriting forming method provided by the embodiments of the present disclosure.
  • the system 10 may include a user terminal 11, a network 12, a server 13 and a database 14.
  • the system 10 can be used to implement the handwriting forming method provided by any embodiment of the present disclosure.
  • the user terminal 11 is, for example, a computer 11-1 or a mobile phone 11-2. It is understandable that the user terminal 11 may be any other type of electronic device capable of performing data processing and having a touch detection function, which may include, but is not limited to, a desktop computer, a notebook computer, a tablet computer, a smart phone, a smart home device, and Wearable equipment, vehicle electronic equipment, monitoring equipment, outdoor billboards, conference whiteboards, etc. The user terminal 11 may also be any equipment provided with electronic equipment, such as a vehicle, a robot, and the like.
  • the user can operate the application program installed on the user terminal 11.
  • the application program transmits user behavior data to the server 13 through the network 12, and the user terminal 11 can also receive data transmitted by the server 13 through the network 12.
  • the user terminal 11 may implement the handwriting forming method provided by the embodiment of the present disclosure by running a program or thread.
  • the user terminal 11 may use its built-in application to execute the handwriting forming method. In other examples, the user terminal 11 may execute the handwriting forming method by calling an application program stored externally of the user terminal 11. For example, the user can write on the work surface of the touch device of the user terminal 11 with a finger or a stylus, and the user terminal 11 executes the handwriting forming method provided by the embodiment of the present disclosure, thereby displaying the user's handwriting as a brush handwriting.
  • the network 12 may be a single network, or a combination of at least two different networks.
  • the network 12 may include, but is not limited to, one or a combination of several of a local area network, a wide area network, a public network, a private network, etc., for example, a wired network, a wireless network, or any combination thereof.
  • the server 13 may be a single server or a server group, and each server in the group is connected through a wired or wireless network; the server 13 may also be a cloud server.
  • a server group can be centralized, such as a data center, or distributed.
  • the server 13 may be local or remote.
  • the database 14 can generally refer to a device with a storage function.
  • the database 14 is mainly used to store various data used, generated, and output by the user terminal 11 and the server 13 in their work.
  • the database 14 may be local or remote.
  • the database 14 may include various memories, such as random access memory (Random Access Memory, RAM), read-only memory (Read Only Memory, ROM), and so on.
  • RAM Random Access Memory
  • ROM Read Only Memory
  • the storage devices mentioned above are just a few examples, and the storage devices that can be used by the system 10 are not limited thereto.
  • the database 14 may be connected or communicated with the server 13 or a part thereof via the network 12, or directly connected or communicated with the server 13 or a combination of the above two methods.
  • the database 14 may be a stand-alone device. In other examples, the database 14 may also be integrated in at least one of the user terminal 11 and the server 13. For example, the database 14 may be set on the user terminal 11 or on the server 13. For another example, the database 14 may also be distributed, a part of which is set on the user terminal 11 and the other part is set on the server 13.
  • At least one embodiment of the present disclosure also provides a handwriting forming device, which can obtain beautiful brush writing handwriting, smooth handwriting, can embody a variety of strokes, small calculation amount, high processing efficiency, strong real-time performance, and simple and practical.
  • FIG. 16 is a schematic block diagram of a handwriting forming apparatus provided by at least one embodiment of the present disclosure.
  • the handwriting forming device 20 includes a sampling unit 21, a modeling unit 22, a connection mode determining unit 23 and a filling unit 24.
  • the handwriting forming device 20 can be applied to application programs such as writing software, painting software, etc., and can also be applied to any equipment or system that needs to form handwriting with a brush, which is not limited in the embodiments of the present disclosure.
  • the sampling unit 21 is configured to determine a set of trajectory points according to multiple sampling points on the writing path on the working surface of the touch device and obtain trajectory information of each trajectory point.
  • the trajectory information includes coordinates, flags, and pressure values, and the flags include data indicating whether the corresponding trajectory point is a pen point.
  • the sampling unit 21 may perform step S110 of the handwriting forming method shown in FIG. 1.
  • the modeling unit 22 is configured to establish multiple raindrop-shaped trajectory units corresponding to multiple trajectory points one-to-one based on trajectory information.
  • the modeling unit 22 may execute step S120 of the handwriting forming method shown in FIG. 1.
  • the connection mode determining unit 23 is configured to determine the connection mode between the trajectory units corresponding to adjacent trajectory points based on the trajectory information.
  • connection mode determining unit 23 may execute step S130 of the handwriting forming method shown in FIG. 1.
  • the filling unit 24 is configured to calculate the connection points of the trajectory units according to the connection method, and fill the polygon formed by the connection points of the trajectory units corresponding to the adjacent trajectory points to form the displayed handwriting.
  • the filling unit 24 may execute step S140 of the handwriting forming method shown in FIG. 1.
  • the sampling unit 21, the modeling unit 22, the connection mode determining unit 23, and the filling unit 24 may be hardware, software, firmware, and any feasible combination thereof.
  • the sampling unit 21, the modeling unit 22, the connection mode determining unit 23, and the filling unit 24 may be dedicated or general-purpose circuits, chips or devices, etc., or may be a combination of a processor and a memory.
  • the embodiments of the present disclosure do not limit this.
  • the units of the handwriting forming device 20 correspond to the steps of the aforementioned handwriting forming method.
  • the specific functions of the handwriting forming device 20 please refer to the relevant description about the handwriting forming method. No longer.
  • the components and structures of the handwriting forming device 20 shown in FIG. 16 are only exemplary, and not restrictive.
  • the handwriting forming device 20 may further include other components and structures as required.
  • At least one embodiment of the present disclosure further provides an electronic device including a processor and a memory, one or more computer program modules are stored in the memory and configured to be executed by the processor, and one or more computers
  • the program module includes instructions for implementing the handwriting forming method provided by any embodiment of the present disclosure.
  • the electronic device can obtain beautiful handwriting with a brush, smooth handwriting, can embody a variety of strokes, small calculation amount, high processing efficiency, strong real-time performance, and simple and practical.
  • FIG. 17 is a schematic block diagram of an electronic device provided by at least one embodiment of the present disclosure.
  • the electronic device 30 includes a processor 31 and a memory 32.
  • the memory 32 is used to store non-transitory computer readable instructions (for example, one or more computer program modules).
  • the processor 31 is configured to run non-transitory computer-readable instructions, and when the non-transitory computer-readable instructions are executed by the processor 31, one or more steps in the handwriting forming method described above can be executed.
  • the memory 32 and the processor 31 may be interconnected by a bus system and/or other forms of connection mechanisms (not shown).
  • the electronic device 30 may use operating systems such as Windows and Android, and the handwriting forming method according to the embodiments of the present disclosure is implemented by an application program running in the operating system.
  • the processor 31 may be a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), or other forms of processing units with data processing capabilities and/or program execution capabilities, such as field programmable Gate array (FPGA), etc.; for example, the central processing unit (CPU) can be an X86 or ARM architecture.
  • the processor 31 may be a general-purpose processor or a special-purpose processor, and may control other components in the electronic device 30 to perform desired functions.
  • the memory 32 may include any combination of one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory.
  • Volatile memory may include random access memory (RAM) and/or cache memory (cache), for example.
  • Non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, etc.
  • One or more computer program modules may be stored on the computer-readable storage medium, and the processor 31 may run one or more computer program modules to implement various functions of the electronic device 30.
  • the computer-readable storage medium may also store various application programs and various data, various data used and/or generated by the application programs, and the like.
  • FIG. 18 is a schematic block diagram of another electronic device provided by at least one embodiment of the present disclosure.
  • the electronic device 30 may further include a touch device 33 and a display device 34.
  • the touch device 33 is configured to acquire the initial handwriting on the work surface of the touch device 33.
  • the touch device 33 may be a touch screen or a touch pad.
  • the touch screen may be a capacitive touch screen, such as a self-capacitive touch screen or a mutual-capacitive touch screen, or a resistive touch screen, a surface acoustic wave touch screen, an infrared touch screen, etc.; for example, the touch device 33 may include a touch sensor and a controller (for example, Driver IC).
  • the controller receives the electrical signal collected by the touch sensor, processes the electrical signal to obtain the touch signal, and provides the touch signal to the processor 31 for further processing, so as to implement the handwriting forming method provided by the embodiment of the present disclosure.
  • the embodiment of the present disclosure does not limit the type, structure, and communication mode of the touch device 33.
  • the touch device 33 includes a working surface with a certain area. The user can write directly on the working surface of the touch device 33 with fingers, or write on the working surface of the touch device 33 with an active stylus or a passive stylus.
  • the embodiment of the present disclosure does not limit this.
  • the work surface refers to a surface for detecting a user's touch operation, such as the touch surface of the touch device 33.
  • the type of the touch device 33 is not limited, and it can be not only a touch screen, but also any device with touch function such as an interactive whiteboard, which can be determined according to actual needs.
  • the display device 34 is configured to display handwriting formed by a handwriting forming method.
  • the handwriting forming method is the handwriting forming method provided by any embodiment of the present disclosure.
  • the display device 34 is, for example, an LCD display screen, an OLED display screen, a QLED display screen, a projection component, a VR head-mounted display device (such as a VR helmet, VR glasses), an AR display device, etc., which are not limited in the embodiments of the present disclosure .
  • the display device 34 can display the handwriting formed by the handwriting forming method provided by the embodiment of the present disclosure, for example, a brush handwriting.
  • the touch device 33 and the display device 34 are two independent devices, the touch device 33 has a touch function but not a display function, and the display device 34 has a display function but not a touch function.
  • the touch device 33 and the display device 34 are the same device, and the device has both a touch function and a display function.
  • FIG. 19 is a schematic block diagram of still another electronic device provided by at least one embodiment of the present disclosure.
  • the electronic device 40 is, for example, suitable for implementing the handwriting forming method provided by the embodiment of the present disclosure.
  • the electronic device 40 may be a terminal device or the like. It should be noted that the electronic device 40 shown in FIG. 19 is only an example, which does not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
  • the electronic device 40 may include a processing device (such as a central processing unit, a graphics processor, etc.) 41, which may be loaded into a random access device according to a program stored in a read-only memory (ROM) 42 or from a storage device 48.
  • the program in the memory (RAM) 43 executes various appropriate actions and processing.
  • various programs and data required for the operation of the electronic device 40 are also stored.
  • the processing device 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44.
  • An input/output (I/O) interface 45 is also connected to the bus 44.
  • the following devices can be connected to the I/O interface 45: including input devices 46 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD), speakers, vibration An output device 47 such as a device; a storage device 48 such as a magnetic tape, a hard disk, etc.; and a communication device 49.
  • the communication device 49 may allow the electronic device 40 to perform wireless or wired communication with other electronic devices to exchange data.
  • FIG. 19 shows an electronic device 40 having various devices, it should be understood that it is not required to implement or have all the illustrated devices, and the electronic device 40 may alternatively implement or have more or fewer devices.
  • the above-mentioned handwriting forming method may be implemented as a computer software program.
  • an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program code for executing the above-mentioned handwriting forming method.
  • the computer program may be downloaded and installed from the network through the communication device 49, or installed from the storage device 48, or installed from the ROM 42.
  • the computer program is executed by the processing device 41, it can execute the functions defined in the handwriting forming method provided by the embodiment of the present disclosure.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

一种笔迹形成方法、笔迹形成装置及电子设备,该笔迹形成方法包括:根据在触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息,轨迹信息包括坐标、标志位和压力值,标志位包括指示对应的轨迹点是否为落笔点的数据;基于轨迹信息建立与多个轨迹点一一对应的多个雨滴状的轨迹单元;基于轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式;根据连线方式计算轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。该笔迹形成方法可以得到美观的毛笔书写笔迹,笔迹平滑,可以体现多种笔画,计算量小,处理效率高,实时性强,简单实用。

Description

笔迹形成方法、笔迹形成装置及电子设备
本申请要求于2020年4月30日递交的中国专利申请第202010367901.X号的优先权,该中国专利申请的全文以引入的方式并入以作为本申请的一部分。
技术领域
本公开的实施例涉及一种笔迹形成方法、笔迹形成装置及电子设备。
背景技术
随着触摸屏技术的不断发展,触摸屏已广泛应用于智能终端中。用户可以通过触摸屏与智能终端进行交互,从而便捷地完成智能终端的操作过程。针对智能终端的各种应用程序也被广泛开发,例如,在终端设备上进行书写、绘画的应用程序。用户可以利用相应的应用程序,通过手指或触控笔在触摸屏上操作,从而可以写字或者画出各种图案。
发明内容
本公开至少一个实施例提供一种笔迹形成方法,包括:根据在触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息,其中,所述轨迹信息包括坐标、标志位和压力值,所述标志位包括指示对应的轨迹点是否为落笔点的数据;基于所述轨迹信息建立与所述多个轨迹点一一对应的多个雨滴状的轨迹单元;基于所述轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式;根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。
例如,在本公开一实施例提供的方法中,基于所述轨迹信息建立与所述多个轨迹点一一对应的多个雨滴状的轨迹单元包括:确定第一圆的第一圆心坐标和第一半径;确定第二圆的第二圆心坐标和第二半径;填充所述第一圆和所述第二圆,并对所述第一圆和所述第二圆的公切点形成的多边形进行填充。
例如,在本公开一实施例提供的方法中,所述第一圆心坐标为对应的轨迹点的坐标,所述第一半径为压感量与多个书写参数预设值的乘积,所述压感量基于对应的轨迹点的压力值得到,所述第一半径大于所述第二半径。
例如,在本公开一实施例提供的方法中,所述压感量根据如下压感函数计算得到:
Figure PCTCN2021080511-appb-000001
其中,Pz表示所述压感量,P表示所述压力值。
例如,在本公开一实施例提供的方法中,所述第二圆心坐标根据所述第一圆心坐标、圆心距离和圆心连线角度得到,所述圆心距离为笔刷长度与对应的轨迹点的压力值的乘积 的Q倍,2≤Q≤7,所述圆心连线角度为所述第一圆的圆心与所述第二圆的圆心的连线与所述第一圆心坐标所在坐标系的x轴方向的夹角,所述圆心连线角度为15~60度。
例如,在本公开一实施例提供的方法中,4.5≤Q≤5.5,所述圆心连线角度为25~35度。
例如,在本公开一实施例提供的方法中,所述第二半径根据如下公式计算得到:R2=0.5*R1*t,其中,R1表示所述第一半径,R2表示所述第二半径,t表示墨水浓度,t=max(0.8*T/n,0.6),T为常量,n为所述轨迹点的序号。
例如,在本公开一实施例提供的方法中,基于所述轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式包括:对于除了所述落笔点以外的轨迹点,计算当前轨迹点与前一个轨迹点的连线的斜率;根据所述斜率、所述当前轨迹点的坐标和所述前一个轨迹点的坐标,确定所述当前轨迹点对应的轨迹单元采用的连线方式;其中,所述斜率根据如下公式计算得到:
Figure PCTCN2021080511-appb-000002
k表示所述斜率,(x2,y2)表示所述当前轨迹点的坐标,(x1,y1)表示所述前一个轨迹点的坐标。
例如,在本公开一实施例提供的方法中,所述连线方式包括第一连线方式、第二连线方式、第三连线方式和第四连线方式,根据所述斜率、所述当前轨迹点的坐标和所述前一个轨迹点的坐标,确定所述当前轨迹点对应的轨迹单元采用的连线方式,包括:若|k|≤0.6或者|x2-x1|<1,则确定所述当前轨迹点对应的轨迹单元采用所述第一连线方式;若-0.9<k<-0.6且x2>x1,则确定所述当前轨迹点对应的轨迹单元采用所述第二连线方式;若0.6<k<1且y2<y1,则确定所述当前轨迹点对应的轨迹单元采用所述第三连线方式;否则,确定所述当前轨迹点对应的轨迹单元采用所述第四连线方式。
例如,在本公开一实施例提供的方法中,根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹,包括:对于除了所述落笔点以外的轨迹点,根据确定的所述第一连线方式、所述第二连线方式、所述第三连线方式和所述第四连线方式其中之一,计算所述轨迹单元的连接点;对相邻的轨迹点对应的轨迹单元的连接点所形成的所述多边形进行填充。
例如,在本公开一实施例提供的方法中,所述轨迹单元的连接点包括第一连接点m1和第二连接点n1,当采用所述第一连线方式时,根据如下公式计算所述第一连接点m1和所述第二连接点n1:
Figure PCTCN2021080511-appb-000003
其中,(m.x,m.y)表示所述第一连接点m1的坐标,(n.x,n.y)表示所述第二连接点n1的坐标,(c1.x,c1.y)表示所述第一圆心坐标,(c2.x,c2.y)表示所述第二圆心坐标,R1表示所述第一半径,R2表示所述第二半径,θ表示圆心连线角度,所述第一连接点m1的坐标、所述第二连接点n1的坐标、所述第一圆心坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
例如,在本公开一实施例提供的方法中,所述轨迹单元的连接点包括第一连接点m2 和第二连接点n2,当采用所述第二连线方式时,根据如下公式计算所述第一连接点m2和所述第二连接点n2:
Figure PCTCN2021080511-appb-000004
其中,(m.x,m.y)表示所述第一连接点m2的坐标,(n.x,n.y)表示所述第二连接点n2的坐标,(c2.x,c2.y)表示所述第二圆心坐标,R1表示所述第一半径,R2表示所述第二半径,所述第一连接点m2的坐标、所述第二连接点n2的坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
例如,在本公开一实施例提供的方法中,所述轨迹单元的连接点包括第一连接点m3和第二连接点n3,当采用所述第三连线方式时,根据如下公式计算所述第一连接点m3和所述第二连接点n3:
Figure PCTCN2021080511-appb-000005
其中,(m.x,m.y)表示所述第一连接点m3的坐标,(n.x,n.y)表示所述第二连接点n3的坐标,(c2.x,c2.y)表示所述第二圆心坐标,R2表示所述第二半径,所述第一连接点m3的坐标、所述第二连接点n3的坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
例如,在本公开一实施例提供的方法中,所述轨迹单元的连接点包括第一连接点m4和第二连接点n4,当采用所述第四连线方式时,根据如下公式计算所述第一连接点m4和所述第二连接点n4:
Figure PCTCN2021080511-appb-000006
其中,(m.x,m.y)表示所述第一连接点m4的坐标,(n.x,n.y)表示所述第二连接点n4的坐标,(c1.x,c1.y)表示所述第一圆心坐标,(c2.x,c2.y)表示所述第二圆心坐标,R1表示所述第一半径,R2表示所述第二半径,θ表示圆心连线角度,所述第一连接点m4的坐标、所述第二连接点n4的坐标、所述第一圆心坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
例如,在本公开一实施例提供的方法中,根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹,还包括:对于作为所述落笔点的轨迹点,根据与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式确定所述落笔点对应的轨迹单元的连接点。
例如,在本公开一实施例提供的方法中,对于作为所述落笔点的轨迹点,根据与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式确定所述落笔点对应的轨迹单元的连接点,包括:若与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式为所述第一连线方式、所述第二连线方式或所述第三连线方式,则采用与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式确定所述落笔点对应的轨迹单元的连接点;若与所述落笔点相邻的轨迹点对 应的轨迹单元的连线方式为所述第四连线方式,则根据如下公式计算所述落笔点对应的轨迹单元的第一连接点m5和第二连接点n5:
Figure PCTCN2021080511-appb-000007
其中,(m.x,m.y)表示所述第一连接点m5的坐标,(n.x,n.y)表示所述第二连接点n5的坐标,(c1.x,c1.y)表示所述第一圆心坐标,(c2.x,c2.y)表示所述第二圆心坐标,R1表示所述第一半径,R2表示所述第二半径,θ表示圆心连线角度,所述第一连接点m5的坐标、所述第二连接点n5的坐标、所述第一圆心坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
例如,在本公开一实施例提供的方法中,根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹,还包括:在对相邻的轨迹点对应的轨迹单元的连接点所形成的所述多边形进行填充之前,判断所述当前轨迹点对应的轨迹单元的连线方式与所述前一个轨迹点对应的轨迹单元的连线方式是否不同;若不同,则采用所述当前轨迹点对应的轨迹单元的连线方式计算所述前一个轨迹点对应的轨迹单元的连接点以作为所述前一个轨迹点对应的轨迹单元的重复连接点;其中,在对相邻的轨迹点对应的轨迹单元的连接点所形成的所述多边形进行填充时,所述前一个轨迹点与所述当前轨迹点对应的轨迹单元之间的多边形基于所述重复连接点形成。
例如,在本公开一实施例提供的方法中,在建立所述多个雨滴状的轨迹单元之前,所述方法还包括:选取包含所述落笔点在内的连续的Z个轨迹点,将所述Z个轨迹点中每个的轨迹信息中的压力值分别加上补偿值以得到更新的压力值,并用所述更新的压力值替换所述轨迹信息中的压力值;其中,5≤Z≤15且Z为整数。
例如,在本公开一实施例提供的方法中,与所述Z个轨迹点对应的Z个补偿值依次减小。
例如,本公开一实施例提供的方法还包括:对填充图案的边缘线条进行反走样处理。
例如,在本公开一实施例提供的方法中,对所述填充图案的边缘线条进行所述反走样处理包括:将所述边缘线条经过的每个显示像素按照所述显示像素的对角线划分为两个区域,其中,所述对角线的斜率的正负符号与所述边缘线条的斜率的正负符号相同;判断所述边缘线条经过所述显示像素的线段所在的区域;若所述线段位于所述两个区域其中之一,则使所述线段所在的显示像素以及在y方向上与所述线段所在的区域相邻的显示像素进行显示;若所述线段与所述对角线重合,则使所述线段所在的显示像素进行显示。
例如,在本公开一实施例提供的方法中,在y方向上与所述线段所在的区域相邻的显示像素的透明度根据如下公式计算:
Figure PCTCN2021080511-appb-000008
其中,Td表示所述透明度,d MN表示所述线段所在的区域的顶点与所述线段之间的距离。
例如,在本公开一实施例提供的方法中,根据在所述触摸装置的工作表面上的书写路 径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息包括:选择所述书写路径上全部采样点中的一部分采样点;基于所述一部分采样点得到所述多个轨迹点,并得到所述多个轨迹点的轨迹信息。
例如,在本公开一实施例提供的方法中,所述一部分采样点与所述全部采样点的数量之比为1%~5%。
本公开至少一个实施例还提供一种笔迹形成装置,包括:采样单元,配置为根据在触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息,其中,所述轨迹信息包括坐标、标志位和压力值,所述标志位包括指示对应的轨迹点是否为落笔点的数据;建模单元,配置为基于所述轨迹信息建立与所述多个轨迹点一一对应的多个雨滴状的轨迹单元;连线方式确定单元,配置为基于所述轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式;填充单元,配置为根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。
本公开至少一个实施例还提供一种电子设备,包括:处理器;存储器,包括一个或多个计算机程序模块;其中,所述一个或多个计算机程序模块被存储在所述存储器中并被配置为由所述处理器执行,所述一个或多个计算机程序模块包括用于实现上述任一实施例所述的笔迹形成方法的指令。
例如,本公开一实施例提供的电子设备还包括所述触摸装置,其中,所述触摸装置配置为获取所述触摸装置的工作表面上的初始笔迹。
例如,本公开一实施例提供的电子设备还包括显示装置,其中,所述显示装置配置为显示经所述笔迹形成方法形成的笔迹。
附图说明
为了更清楚地说明本公开实施例的技术方案,下面将对实施例的附图作简单地介绍,显而易见地,下面描述中的附图仅仅涉及本公开的一些实施例,而非对本公开的限制。
图1为本公开至少一个实施例提供的一种笔迹形成方法的流程示意图;
图2为图1所示的笔迹形成方法中步骤S110的流程示意图;
图3为图1所示的笔迹形成方法中步骤S120的流程示意图;
图4A为本公开至少一个实施例提供的轨迹单元的示意图之一;
图4B为本公开至少一个实施例提供的轨迹单元的示意图之二;
图5为本公开至少一个实施例提供的压力值样本示意图;
图6为图1所示的笔迹形成方法中步骤S130的流程示意图;
图7A为本公开至少一个实施例提供的第一连线方式的示意图;
图7B为本公开至少一个实施例提供的第二连线方式的示意图;
图7C为本公开至少一个实施例提供的第三连线方式的示意图;
图7D为本公开至少一个实施例提供的第四连线方式的示意图;
图8为图1所示的笔迹形成方法中步骤S140的流程示意图之一;
图9为图1所示的笔迹形成方法中步骤S140的流程示意图之二;
图10为本公开至少一个实施例提供的不同连线方式的模型衔接示意图;
图11为本公开至少一个实施例提供的反走样处理的流程示意图;
图12A为本公开至少一个实施例提供的反走样处理的显示示意图;
图12B为图12A中区域F的放大图;
图13为本公开至少一个实施例提供的反走样处理的效果对比图;
图14为本公开至少一个实施例提供的一种笔迹形成方法的应用流程图;
图15为一种可用于实施本公开实施例提供的笔迹形成方法的系统示意图;
图16为本公开至少一个实施例提供的一种笔迹形成装置的示意框图;
图17为本公开至少一个实施例提供的一种电子设备的示意框图;
图18为本公开至少一个实施例提供的另一种电子设备的示意框图;以及
图19为本公开至少一个实施例提供的再一种电子设备的示意框图。
具体实施方式
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例的附图,对本公开实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。
除非另外定义,本公开使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。同样,“一个”、“一”或者“该”等类似词语也不表示数量限制,而是表示存在至少一个。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。
在用户使用智能终端进行书写的过程中,智能终端可以模拟并显示出用户书写的笔迹,根据需要,该笔迹可以显示为各种类型,例如毛笔字、钢笔字等。毛笔是中国的传统书写工具和绘画工具,其笔头例如采用动物的毛制成,例如在吸收了用于书写的油墨之后成长圆锥状。毛笔字具有极强的中国特色,体现了中国书法的韵味,可以为用户提供具有吸引力的视觉效果。
然而,在通常的模拟毛笔字的方法中,需要大量的采样点来进行计算和处理,使得计算量大,占用资源多,处理效率低。此外,通常的模拟毛笔字的方法主要针对毛笔书写时不同书写技巧而建立笔迹模型,例如落笔的藏锋与露锋、运笔中的偏锋与侧锋等,而忽略 了模型之间的连接,使得所形成的毛笔笔迹不够平滑,美观性不足,并且处理方式复杂,实用性不强。
本公开至少一个实施例提供一种笔迹形成方法、笔迹形成装置及电子设备。该笔迹形成方法可以得到美观的毛笔书写笔迹,笔迹平滑,可以体现多种笔画,计算量小,处理效率高,实时性强,简单实用。
下面,将参考附图详细地说明本公开的实施例。应当注意的是,不同的附图中相同的附图标记将用于指代已描述的相同的元件。
本公开至少一个实施例提供一种笔迹形成方法,该笔迹形成方法包括:根据在触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息,轨迹信息包括坐标、标志位和压力值,标志位包括指示对应的轨迹点是否为落笔点的数据;基于轨迹信息建立与多个轨迹点一一对应的多个雨滴状的轨迹单元;基于轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式;根据连线方式计算轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。
图1为本公开至少一个实施例提供的一种笔迹形成方法的流程示意图。
例如,该笔迹形成方法应用于一计算设备,该计算设备包括具有计算功能的任何电子设备,例如可以为手机、笔记本电脑、平板电脑、台式计算机、服务器等,本公开的实施例对此不作限制。例如,该计算设备具有中央处理单元(Central Processing Unit,CPU)或图形处理单元(Graphics Processing Unit,GPU),以及还包括存储器。该存储器例如为非易失性存储器(例如只读存储器(Read Only Memory,ROM)),其上存储有操作系统的代码。例如,存储器上还存储有代码或指令,通过运行这些代码或指令,可以实现本公开实施例提供的笔迹形成方法。
例如,该计算设备还可以包括触摸装置,例如触摸屏或触摸板,以获取用户书写时在触摸装置的工作表面上形成的初始笔迹。该触摸屏不但可以接收初始笔迹并且还可以同时进行相应的显示,例如可以为电容式触摸屏,例如自容式触摸屏或互容式触摸屏,还可以为电阻式触摸屏、表面声波式触摸屏、红外式触摸屏等,本公开的实施例对此不作限制。用户可以用手指直接在触摸屏的工作表面上进行书写,也可以利用主动式触控笔或被动式触控笔在触摸屏的工作表面上进行书写,本公开的实施例对此不作限制。这里,工作表面是指用于检测用户的触摸操作的表面,例如触摸屏的触摸表面。需要说明的是,本公开的实施例中,触摸装置的类型不受限制,不仅可以为触摸屏,还可以为交互白板等任意的具有触控功能的装置,这可以根据实际需求而定。
例如,该计算设备还可以包括显示装置,该显示装置例如为液晶显示屏(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light Emitting Diode,OLED)显示屏、量子点发光二极管(Quantum Dot Light Emitting Diode,QLED)显示屏、投影部件、VR头戴式显示设备(例如VR头盔、VR眼镜)、AR显示设备等,本公开的实施例对此不作限制。该显示装置可以显示由本公开实施例提供的笔迹形成方法所形成的笔迹,例如毛笔笔迹。
如图1所示,在至少一个实施例中,该笔迹形成方法包括如下操作。
步骤S110:根据在触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息,该轨迹信息包括坐标、标志位和压力值,标志位包括指示对应的轨迹点是否为落笔点的数据;
步骤S120:基于轨迹信息建立与多个轨迹点一一对应的多个雨滴状轨迹单元;
步骤S130:基于轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式;
步骤S140:根据连线方式计算轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。
例如,在步骤S110中,触摸装置可以为触摸屏,相应地,工作表面可以为触摸屏的触摸表面,以检测用户的触摸操作。当用户在触摸装置的工作表面上进行书写时,可以在落笔、运笔、收笔(或抬笔)等过程中施加不同的力度,以形成书写路径,触摸装置可以检测到沿书写路径分布的多个采样点。例如,触摸装置在检测到这些采样点时,可以得到这些采样点的压力值、坐标和标志位。根据检测到的采样点,触摸装置可以得到一组轨迹点以及轨迹点的轨迹信息。例如,一组轨迹点包括多个轨迹点。
例如,轨迹信息包括压力值、坐标和标志位。压力值表示用户触摸对应的轨迹点(对应的采样点)的力度。例如,压力值可以为原始的压力值,也可以为归一化处理之后的压力值,本公开的实施例对此不作限制。例如,压力值可以通过设置在触摸装置中的压力传感器检测,该压力传感器可以包括压电薄膜以感测用户在触摸装置的工作表面上进行书写时对工作表面施加的压力;或者,当用户使用触控笔在触摸装置的工作表面上进行书写时,该触控笔可以设置有压力传感器,以检测用户对工作表面施加的压力。本公开的实施例对压力值的检测的方式不作限制。坐标表示对应的轨迹点(对应的采样点)在工作表面内的位置。例如,坐标为工作表面内的直角坐标系中的坐标,该直角坐标系的原点由触摸装置自身的设置而定。标志位包括指示对应的轨迹点是否为落笔点的数据,落笔点例如是指在一段连续的书写路径中所检测到的第一个采样点。例如,标志位可以为预设的数字、字符、字符串等。例如,在一些示例中,当对应的轨迹点为落笔点时,可以将标志位设置为“down”。例如,标志位还可以包括指示对应的轨迹点是否为收笔点、运笔点的数据,例如,分别为“up”、“move-on”。关于标志位的设置方式和设置规则可以根据实际需求而定,本公开的实施例对此不作限制。
需要说明的是,本公开的实施例中,轨迹信息中的压力值、坐标和标志位由触摸装置检测得到,这些信息的获取方式和表示方式可以根据触摸装置自身的设置而定,本公开的实施例对此不作限制。在执行本公开实施例提供的笔迹形成方法时,可以直接从触摸装置获取轨迹点的轨迹信息,也即压力值、坐标和标志位。
例如,如图2所示,上述步骤S110可以包括如下操作。
步骤S111:选择书写路径上全部采样点中的一部分采样点;
步骤S112:基于一部分采样点得到多个轨迹点,并得到多个轨迹点的轨迹信息。
例如,在步骤S111中,在触摸装置检测到的位于书写路径上的全部采样点中,选择 一部分采样点,也即,对全部采样点进行稀疏采样。例如,在一些示例中,所选择的一部分采样点与全部采样点的数量之比为1%~5%,例如2%。例如,对于触摸装置检测到的全部采样点,在每100个采样点中选择1~5个采样点,例如选择2个采样点。例如,在另一些示例中,所选择的一部分采样点与全部采样点的数量之比为1%~40%。关于所选择的一部分采样点与全部采样点的数量的比例,这可以根据实际需求而定,本公开的实施例对此不作限制。
例如,将作为落笔点的采样点编号为1,对位于书写路径上的全部采样点依序编号以组成序列,被选择的采样点较为均匀地分布在全部采样点所组成的序列中。由此,通过稀疏采样,可以极大地减少需要处理的采样点的数量,提高处理效率,提高实时性。
例如,在步骤S112中,基于被选择的采样点得到轨迹点。例如,在一些示例中,可以将被选择的采样点作为轨迹点,相应地,可以从触摸装置获取各个轨迹点的轨迹信息。例如,在另一些示例中,可以对被选择的采样点进行平滑处理,经过平滑处理之后,得到轨迹点及相应的轨迹信息。例如,平滑处理可以采用通常的平滑处理算法和平滑处理方式,本公开的实施例对此不作限制。
例如,采样点是触摸装置中的触摸采集部件通过触摸检测得到的点,采样点带有速度、坐标和类型(例如是否为落笔点)等信息。根据触摸装置提供的采样点,进行稀疏采样和插值处理,从而可以得到轨迹点。例如,稀疏采样在上文已进行描述,此次不再赘述。例如,插值处理可以使得到的多个轨迹点更平滑,也即,插值处理可以起到上文描述的平滑处理的效果。对于某一个采样点进行插值处理时,所需要的参数例如包括与该采样点相邻的另外两个采样点的信息,例如该位于采样点之前的采样点的信息和位于该采样点之后的采样点的信息。由此通过插值计算可以得到该采样点对应的轨迹点的信息,例如速度、坐标、类型等。在完成插值处理后,可以得到一组轨迹点。例如,轨迹点的类型与相应的采样点的类型相同,轨迹点的速度是模拟计算得到的,例如通过计算前后两个采样点的速度的均值或数值等差得到。关于插值处理的详细说明可参考常规设计,此处不再赘述。
例如,如图1所示,在步骤S120中,基于轨迹信息建立与多个轨迹点一一对应的多个雨滴状的轨迹单元,也即是,针对每个轨迹点分别建立轨迹单元。该轨迹单元包括两个大小不同的实心圆以及两个圆的公切线,具有类似于雨滴的形状。
例如,如图3所示,上述步骤S120可以包括如下操作。
步骤S121:确定第一圆的第一圆心坐标和第一半径;
步骤S122:确定第二圆的第二圆心坐标和第二半径;
步骤S123:填充第一圆和第二圆,并对第一圆和第二圆的公切点形成的多边形进行填充。
下面结合图4A和图4B所示的轨迹单元对上述步骤S121-S123进行说明。
例如,如图4A和图4B所示,该轨迹单元包括第一圆01和第二圆02。第一圆01的半径称为第一半径R1,第二圆02的半径称为第二半径R2,第一半径R1大于第二半径R2,也即是,第一圆01为较大的圆,第二圆02为较小的圆。第一圆01和第二圆02的公切点 为A1、A2、A3、A4,公切线为
Figure PCTCN2021080511-appb-000009
Figure PCTCN2021080511-appb-000010
该轨迹单元由第一圆01、第二圆02以及公切点A1、A2、A3、A4形成的多边形共同组成。
例如,在步骤S121中,第一圆01的圆心c1的坐标称为第一圆心坐标,第一圆心坐标为对应的轨迹点的坐标,例如可以直接将轨迹信息中的坐标作为第一圆心坐标。
第一半径R1为压感量与多个书写参数预设值的乘积。例如,多个书写参数预设值包括毛笔刷直径和画线线宽,相应地,第一半径R1为压感量、毛笔刷直径和画线线宽这三者的乘积。不同的毛笔刷直径和不同的画线线宽可以使形成的笔迹具有不同的视觉效果。例如,毛笔刷直径和画线线宽可以采用预设默认值,也可以在执行该笔迹形成方法之前由用户自行设置,这可以根据实际需求而定,本公开的实施例对此不作限制。
例如,压感量基于对应的轨迹点的压力值得到。由于用户在触摸装置上写字时的力度是不定大小的,该力度可轻可重,只有当相邻的轨迹点对应的轨迹单元的大小没有较大变化时,才能形成较为美观的书写笔迹。而且,毛笔书写时走笔较轻时的笔迹通常也较细。基于上述考虑,采用压感量来建立轨迹单元,使得形成的笔迹较为平滑,还能够体现运笔快慢的特点。如图5所示,可以通过实验采集不同用户书写时的大量采样点的压力值,得到大量压力值样本,然后根据压力值样本得到压感函数。这里,压力值为归一化处理之后的数据。
例如,压感函数可以采用统计学方法并结合仿真优化处理得出。例如,压感函数如下:
Figure PCTCN2021080511-appb-000011
其中,Pz表示压感量,P表示压力值。得到压感函数后,在执行本公开实施例提供的笔迹形成方法时,对于任意的轨迹点,可以基于该轨迹点的压力值计算得到压感量,使得压感量的变化较为平缓。
例如,在一些示例中,触摸装置完成触摸检测后所提供的压力值即为归一化处理之后的数据,可直接将该压力值代入上述公式以得到压感量。例如,在另一些示例中,触摸装置完成触摸检测后所提供的压力值未进行归一化处理,因此在计算压感量之前,还需要对触摸装置提供的压力值进行归一化处理,将归一化处理之后的压力值代入上述公式以得到压感量。
例如,压感量Pz的取值范围在0~1之间。当压力值P小于0.4时,压感量设置为固定值0.25,由此保证在用户书写时能够有较为稳定的落笔效果。当压力值0.4≤P<0.8时,通过对压力值P进行平方计算并除以常量0.64,可以使书写有较为明显的运笔粗细变化。当压力值P≥0.8时,压感量设置为固定值1,由此防止笔迹突然变大而影响美观。
需要说明的是,本公开的实施例中,上述压感函数仅为示例性的,而非限制性的,根据实际需求,压感函数可以进行调整,本公开的实施例对此不作限制。例如,可以对压感函数中的各个系数进行调整,例如适当增大或减小,也可以对压感函数中压力值P的划分区域进行调整,还可以重新设计归纳压感函数,这可以根据实际需求而定。
例如,在步骤S122中,第二圆02的圆心c2的坐标称为第二圆心坐标,第二圆心坐标根据第一圆心坐标、圆心距离和圆心连线角度得到。例如,圆心距离为第一圆01的圆心c1与第二圆02的圆心c2之间的距离。圆心距离为笔刷长度与对应的轨迹点的压力值的乘积的Q倍,2≤Q≤7。例如,笔刷长度可以采用预设默认值,也可以在执行该笔迹形成方法之前由用户自行设置,这可以根据实际需求而定,本公开的实施例对此不作限制。例如,圆心连线角度为第一圆01的圆心c1与第二圆02的圆心c2的连线L1与第一圆心坐标所在坐标系的x轴方向的夹角θ。这里,该夹角θ为锐角,且为连线L1与x轴的负方向之间的夹角。由于第一圆心坐标为对应的轨迹点的坐标,该坐标由触摸装置提供,因此第一圆心坐标所在的坐标系为触摸装置所定义的位于工作表面内的坐标系。例如,圆心连线角度为15~60度,例如20~45度,又例如30度。在已知第一圆心坐标、圆心距离和圆心连线角度的前提下,利用平面几何知识即可得到第二圆心坐标。
例如,在一些示例中,4.5≤Q≤5.5,圆心连线角度为25~35度。例如,在另一些示例中,Q=5,圆心连线角度为30度,由此得到的轨迹单元所形成的笔迹更加美观。
例如,第二半径R2根据如下公式计算得到:R2=0.5*R1*t。这里,t表示墨水浓度,t=max(0.8*T/n,0.6)。例如,T为常量,可以设置为0.8。n为轨迹点的序号。例如,作为落笔点的轨迹点的序号为1,后续的轨迹点依次编号为2、3、4……。需要说明的是,本公开的实施例中,上述计算墨水浓度t的公式是示例性的,而非限制性的,可以根据实际需求调整,本公开的实施例对此不作限制。
例如,在步骤S123中,在已知第一圆心坐标、第一半径R1、第二圆心坐标和第二半径R2的前提下,可以计算得到第一圆01和第二圆02的公切点A1、A2、A3和A4,然后对第一圆01、第二圆02以及公切点A1、A2、A3和A4形成的多边形进行填充,从而得到该轨迹点对应的轨迹单元。
例如,如图1所示,在步骤S130中,基于轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式。为了体现不同的笔画,使笔迹更美观,需要根据笔画特点,对不同笔画中的轨迹点对应的轨迹单元采用不同的连线方式。需要注意的是,“相邻”并非指两个轨迹点在触摸装置的工作表面上的位置相邻,而是指这两个轨迹点在基于位于书写路径上的多个采样点所得到的一组轨迹点依序编号所组成的序列中相邻,也即,这两个轨迹点的序号相邻。例如,序号为1的轨迹点与序号为2的轨迹点相邻。例如,序号为4的轨迹点不仅与序号为5的轨迹点相邻,还与序号为3的轨迹点相邻。
例如,如图6所示,上述步骤S130可以包括如下操作。
步骤S131:对于除了落笔点以外的轨迹点,计算当前轨迹点与前一个轨迹点的连线的斜率;
步骤S132:根据斜率、当前轨迹点的坐标和前一个轨迹点的坐标,确定当前轨迹点对应的轨迹单元采用的连线方式。
例如,在步骤S131中,斜率可以根据如下公式计算得到:
Figure PCTCN2021080511-appb-000012
其中,k表示斜率,(x2,y2)表示当前轨迹点的坐标,(x1,y1)表示前一个轨迹点的坐标。
例如,在步骤S132中,上述连线方式包括第一连线方式、第二连线方式、第三连线方式和第四连线方式。例如,在一些示例中,第一连线方式对应于笔画“横”,第二连线方式对应于笔画“捺”,第三连线方式对应于笔画“提”,第四连线方式对应于除上述三种笔画以外的其他笔画。通过划分不同的连线方式,可以使利用该笔迹形成方法形成的笔迹更加符合不同笔画的书写特点,更加美观。
根据斜率k、当前轨迹点的坐标(x2,y2)和前一个轨迹点的坐标(x1,y1),可采用如下规则确定当前轨迹点对应的轨迹单元采用的连线方式。
若|k|≤0.6或者|x2-x1|<1,则确定当前轨迹点对应的轨迹单元采用第一连线方式,该第一连线方式例如为图7A所示的连线方式,也即笔画“横”对应的连线方式。若-0.9<k<-0.6且x2>x1,则确定当前轨迹点对应的轨迹单元采用第二连线方式,该第二连线方式例如为图7B所示的连线方式,也即笔画“捺”对应的连线方式。若0.6<k<1且y2<y1,则确定当前轨迹点对应的轨迹单元采用第三连线方式,该第三连线方式例如为图7C所示的连线方式,也即笔画“提”对应的连线方式。否则,确定当前轨迹点对应的轨迹单元采用第四连线方式,该第四连线方式例如为图7D所示的连线方式,也即除上述三种笔画以外的其他笔画对应的连线方式。
例如,在确定连线方式时,可按照前述内容依序判断。也即是,首先判断是否满足采用第一连线方式的条件;若不满足,再判断是否满足采用第二连线方式的条件;若仍不满足,再判断是否满足采用第三连线方式的条件;若还不满足,则采用第四连线方式。
需要说明的是,上述确定连线方式的规则是示例性的,而非限制性的,上述确定连线方式的规则可以根据实际需求调整,本公开的实施例对此不作限制。
需要说明的是,对于作为落笔点的轨迹点(序号为1的轨迹点,也即一段连续书写路径上的第一个轨迹点),无需判断该轨迹点对应的轨迹单元的连线方式,如何确定该轨迹点对应的轨迹单元的连接点将在后文描述,此处不再赘述。
例如,如图1所示,在步骤S140中,在确定了连线方式之后,根据连线方式计算轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。
例如,如图8所示,上述步骤S140可以包括如下操作。
步骤S141:对于除了落笔点以外的轨迹点,根据确定的第一连线方式、第二连线方式、第三连线方式和第四连线方式其中之一,计算轨迹单元的连接点;
步骤S142:对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充;
步骤S143:对于作为落笔点的轨迹点,根据与落笔点相邻的轨迹点对应的轨迹单元的连线方式确定落笔点对应的轨迹单元的连接点。
例如,在步骤S141中,根据不同的连线方式,采用不同的公式计算轨迹单元的连接点,计算得到的连接点用于后续对相邻的轨迹单元之间的区域进行填充。下面结合图7A-7D所示的连线方式对计算连接点的方法进行详细说明。
例如,如图7A所示,在当前的轨迹点对应的轨迹单元E2采用第一连线方式时,该轨迹单元E2的连接点包括第一连接点m1和第二连接点n1。根据如下公式计算第一连接点m1和第二连接点n1:
Figure PCTCN2021080511-appb-000013
其中,(m.x,m.y)表示第一连接点m1的坐标,(n.x,n.y)表示第二连接点n1的坐标,(c1.x,c1.y)表示该轨迹单元E2中的第一圆心坐标,(c2.x,c2.y)表示该轨迹单元E2中的第二圆心坐标,R1表示该轨迹单元E2中的第一半径,R2表示该轨迹单元E2中的第二半径,θ表示该轨迹单元E2中的圆心连线角度。例如,第一连接点m1的坐标、第二连接点n1的坐标、第一圆心坐标和第二圆心坐标位于触摸装置的工作表面上的同一坐标系中。在上述公式中,“floor”表示向下取整运算。
例如,第一连线方式对应于笔画“横”,当前的轨迹点对应的轨迹单元E2与前一个轨迹点对应的轨迹单元E1之间的部分为笔画“横”中的一段线条。采用上述方式计算的第一连接点m1和第二连接点n1用来进行后续的填充,可以使形成的笔迹更加符合笔画“横”的书写特点。
例如,如图7B所示,在当前的轨迹点对应的轨迹单元E2采用第二连线方式时,该轨迹单元E2的连接点包括第一连接点m2和第二连接点n2。根据如下公式计算第一连接点m2和第二连接点n2:
Figure PCTCN2021080511-appb-000014
其中,(m.x,m.y)表示第一连接点m2的坐标,(n.x,n.y)表示第二连接点n2的坐标,(c2.x,c2.y)表示该轨迹单元E2中的第二圆心坐标,R1表示该轨迹单元E2中的第一半径,R2表示该轨迹单元E2中的第二半径。例如,第一连接点m2的坐标、第二连接点n2的坐标和第二圆心坐标位于触摸装置的工作表面上的同一坐标系中。在上述公式中,“floor”表示向下取整运算,“ceil”表示向上取整运算。
例如,第二连线方式对应于笔画“捺”,当前的轨迹点对应的轨迹单元E2与前一个轨迹点对应的轨迹单元E1之间的部分为笔画“捺”中的一段线条。采用上述方式计算的第一连接点m2和第二连接点n2用来进行后续的填充,可以使形成的笔迹更加符合笔画“捺”的书写特点。
例如,如图7C所示,在当前的轨迹点对应的轨迹单元E2采用第三连线方式时,该轨迹单元E2的连接点包括第一连接点m3和第二连接点n3。根据如下公式计算第一连接点m3和第二连接点n3:
Figure PCTCN2021080511-appb-000015
其中,(m.x,m.y)表示第一连接点m3的坐标,(n.x,n.y)表示第二连接点n3的坐标,(c2.x,c2.y)表示该轨迹单元E2中的第二圆心坐标,R2表示该轨迹单元E2中的第二半径。例如,第一连接点m3的坐标、第二连接点n3的坐标和第二圆心坐标位于触摸装置的工作表面上的同一坐标系中。同样地,在上述公式中,“floor”表示向下取整运算,“ceil”表示向上取整运算。
例如,第三连线方式对应于笔画“提”,当前的轨迹点对应的轨迹单元E2与前一个轨迹点对应的轨迹单元E1之间的部分为笔画“提”中的一段线条。采用上述方式计算的第一连接点m3和第二连接点n3用来进行后续的填充,可以使形成的笔迹更加符合笔画“提”的书写特点。
例如,如图7D所示,在当前的轨迹点对应的轨迹单元E2采用第四连线方式时,该轨迹单元E2的连接点包括第一连接点m4和第二连接点n4。根据如下公式计算第一连接点m4和第二连接点n4:
Figure PCTCN2021080511-appb-000016
其中,(m.x,m.y)表示第一连接点m4的坐标,(n.x,n.y)表示第二连接点n4的坐标,(c1.x,c1.y)表示该轨迹单元E2中的第一圆心坐标,(c2.x,c2.y)表示该轨迹单元E2中的第二圆心坐标,R1表示该轨迹单元E2中的第一半径,R2表示该轨迹单元E2中的第二半径,θ表示该轨迹单元E2中的圆心连线角度。例如,第一连接点m4的坐标、第二连接点n4的坐标、第一圆心坐标和第二圆心坐标位于触摸装置的工作表面上的同一坐标系中。同样地,在上述公式中,“floor”表示向下取整运算,“ceil”表示向上取整运算。
例如,第四连线方式对应于除上述三种笔画以外的其他笔画,当前的轨迹点对应的轨迹单元E2与前一个轨迹点对应的轨迹单元E1之间的部分为该笔画中的一段线条。采用上述方式计算的第一连接点m4和第二连接点n4用来进行后续的填充,可以使形成的笔迹具有更好的连贯性,适于形成多种笔画。
需要说明的是,本公开的实施例中,上述第一连线方式、第二连线方式、第三连线方式和第四连线方式分别采用的计算连接点的公式仅为示例性的,而非限制性的,根据实际需求,上述各个公式可以进行调整,本公开的实施例对此不作限制。
例如,在计算得到各个轨迹点对应的轨迹单元的连接点之后,对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,由此使多个轨迹点对应的多个轨迹单元彼此之间形成连续的笔迹。
例如,在图7A所示的第一连线方式中,第一连接点m1和第二连接点n1为轨迹单元 E2和轨迹单元E1之间的多边形(例如四边形)的两个相邻的顶点,该多边形的另外两个顶点为轨迹单元E1上的两个连接点。对该多边形进行填充,可以使轨迹单元E2和轨迹单元E1之间形成连续的笔迹。例如,在图7B所示的第二连线方式中,第一连接点m2和第二连接点n2为轨迹单元E2和轨迹单元E1之间的多边形(例如四边形)的两个相邻的顶点,该多边形的另外两个顶点为轨迹单元E1上的两个连接点。对该多边形进行填充,可以使轨迹单元E2和轨迹单元E1之间形成连续的笔迹。在图7C所示的第三连线方式和图7D所示的第四连线方式中,多边形的填充采用类似的方式,此处不再赘述。
例如,如图8所示,在步骤S143中,对于作为落笔点的轨迹点,根据与落笔点相邻的轨迹点对应的轨迹单元的连线方式确定落笔点对应的轨迹单元的连接点。例如,作为落笔点的轨迹点的序号为1,则根据序号为2的轨迹点对应的轨迹单元的连线方式确定落笔点对应的轨迹单元的连接点,由此可以在落笔点对应的轨迹单元与序号为2的轨迹点对应的轨迹单元之间形成多边形并进行填充。
若与落笔点相邻的轨迹点(也即序号为2的轨迹点)对应的轨迹单元的连线方式为第一连线方式、第二连线方式或第三连线方式,则采用与落笔点相邻的轨迹点(也即序号为2的轨迹点)对应的轨迹单元的连线方式确定落笔点对应的轨迹单元的连接点。例如,在一些示例中,当序号为2的轨迹点对应的轨迹单元的连线方式为第一连线方式时,则采用第一连线方式计算落笔点对应的轨迹单元的连接点,也即,采用前述的第一连线方式对应的公式计算落笔点对应的轨迹单元的第一连接点和第二连接点。当序号为2的轨迹点对应的轨迹单元的连线方式为第二连线方式或第三连线方式时,则采用第二连线方式或第三连线方式计算落笔点对应的轨迹单元的连接点,也即,采用前述的第二连线方式或第三连线方式对应的公式计算落笔点对应的轨迹单元的第一连接点和第二连接点,此处不再赘述。
若与落笔点相邻的轨迹点(也即序号为2的轨迹点)对应的轨迹单元的连线方式为第四连线方式,则根据如下公式计算落笔点对应的轨迹单元的第一连接点m5和第二连接点n5:
Figure PCTCN2021080511-appb-000017
其中,(m.x,m.y)表示第一连接点m5的坐标,(n.x,n.y)表示第二连接点n5的坐标,(c1.x,c1.y)表示落笔点对应的轨迹单元的第一圆心坐标,(c2.x,c2.y)表示落笔点对应的轨迹单元的第二圆心坐标,R1表示落笔点对应的轨迹单元的第一半径,R2表示落笔点对应的轨迹单元的第二半径,θ表示落笔点对应的轨迹单元的圆心连线角度。例如,第一连接点m5的坐标、第二连接点n5的坐标、第一圆心坐标和第二圆心坐标位于触摸装置的工作表面上的同一坐标系中。利用上述第一连接点m5和第二连接点n5进行后续的填充时,可以具有较好的落笔形状,使笔迹更美观。
通过上述方式,计算得到每个轨迹点对应的轨迹单元的连接点之后,任意两个相邻的轨迹点对应的轨迹单元的连接点可以形成多边形(例如将这些连接点作为顶点可以形成四 边形),对这些多边形进行填充,从而可以使多个轨迹单元之间形成连贯的笔迹。
当两个不同的笔画衔接时,由于不同笔画对应的连线方式不同,因此可能会在衔接处出现缝隙,影响笔迹的美观性。为了消除不同笔画之间的缝隙,如图9所示,在至少一个实施例中,除了包括上述步骤S141-S143之外,图1中的步骤S140还可以进一步包括如下操作。
步骤S144:在对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充之前,判断当前轨迹点对应的轨迹单元的连线方式与前一个轨迹点对应的轨迹单元的连线方式是否不同;
步骤S145:若不同,则采用当前轨迹点对应的轨迹单元的连线方式计算前一个轨迹点对应的轨迹单元的连接点以作为前一个轨迹点对应的轨迹单元的重复连接点。
例如,在对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充时,前一个轨迹点与当前轨迹点对应的轨迹单元之间的多边形基于重复连接点形成。
图10为本公开至少一个实施例提供的不同连线方式的模型衔接示意图。下面结合图10对上述步骤S144和S145进行说明。
例如,如图10所示,3个轨迹单元E3、E4和E5分别为三个相邻的轨迹点对应的轨迹单元,这三个相邻的轨迹点例如分别为序号为3、4、5的三个轨迹点。在下文的描述中,将这三个轨迹点分别称为3号轨迹点、4号轨迹点和5号轨迹点,相应地,这3个轨迹单元分别称为3号轨迹单元E3、4号轨迹单元E4和5号轨迹单元E5。
例如,根据4号轨迹点和3号轨迹点的连线的斜率、4号轨迹点的坐标以及3号轨迹点的坐标,确定4号轨迹点对应的4号轨迹单元E4采用第一连线方式,从而计算得到4号轨迹单元E4的两个连接点m和n。根据5号轨迹点和4号轨迹点的连线的斜率、5号轨迹点的坐标以及4号轨迹点的坐标,确定5号轨迹点对应的5号轨迹单元E5采用第二连线方式,从而计算得到5号轨迹单元E5的两个连接点B1和B2。3号轨迹单元E3的两个连接点B3和B4可以根据3号轨迹点和2号轨迹点(图中未示出)计算得到,3号轨迹单元E3例如采用第一连线方式。
在对4号轨迹单元E4的连接点m和n与3号轨迹单元E3的连接点B3和B4所形成的多边形进行填充之前,判断4号轨迹单元E4的连线方式与3号轨迹单元E3的连线方式是否不同。在该示例中,4号轨迹单元E4的连线方式与3号轨迹单元E3的连线方式相同,均为第一连线方式,因此对连接点m、n、B3、B4形成的多边形进行填充即可。
在对5号轨迹单元E5的连接点B1和B2与4号轨迹单元E4的连接点m和n所形成的多边形进行填充之前,判断5号轨迹单元E5的连线方式与4号轨迹单元E4的连线方式是否不同。在该示例中,5号轨迹单元E5的连线方式与4号轨迹单元E4的连线方式不同,5号轨迹单元E5的连线方式为第二连线方式,而4号轨迹单元E4的连线方式为第一连线方式。因此,需要采用5号轨迹单元E5的连线方式(即第二连线方式)再次计算4号轨迹单元E4的连接点,得到连接点m’和n’,将连接点m’和n’称为4号轨迹单元E4的重复连接点。
由此,4号轨迹单元E4不仅具有连接点m和n,还具有重复连接点m’和n’。4号轨迹单元E4与5号轨迹单元E5之间的多边形基于重复连接点m’和n’形成,而4号轨迹单元E4与3号轨迹单元E3之间的多边形基于连接点m和n形成,因此可以使填充后形成的笔迹在衔接处(也即4号轨迹单元E4所在位置)没有缝隙,使不同笔画可以连续地衔接并平滑过渡,从而提升笔迹的美观性。
例如,在至少一个实施例中,在建立多个雨滴状的轨迹单元之前,该笔迹形成方法还可以包括用于实现笔锋效果的操作,该操作如下:
步骤S160:选取包含落笔点在内的连续的Z个轨迹点,将Z个轨迹点中每个的轨迹信息中的压力值分别加上补偿值以得到更新的压力值,并用更新的压力值替换轨迹信息中的压力值。
例如,5≤Z≤15且Z为整数。例如,在一些示例中,Z=9。
当用户在书写过程中落笔时,笔锋效果有助于提升字迹的美观性,单个轨迹点对应的轨迹单元不足以表现出饱满的落笔。由于落笔时压力值通常较小,因此在步骤S160中,对包含落笔点在内的连续的Z个轨迹点对应的压力值进行补偿,然后利用补偿后的压力值建立轨迹单元并进行后续处理,从而可以构成稳定、饱满的落笔,以形成笔锋效果。例如,与上述Z个轨迹点对应的Z个补偿值依次减小。此外,在前述的压感公式中,当压力值小于0.4时,压感量等于常量0.25,这也有助于得到笔锋效果。
例如,在一些示例中,当Z=9时,将包含落笔点在内的连续的9个轨迹点(也即包含落笔点在内的前9个轨迹点)对应的压力值分别加上补偿值0.3、0.23、0.2、0.17、0.15、0.1、0.08、0.04、0.01。得到更新的压力值后,用更新的压力值替换轨迹信息中的压力值,然后基于轨迹信息进行后续建立轨迹单元等操作。通过这种方式,该9个轨迹点对应的轨迹单元依次减小,通过对轨迹单元之间的多边形进行填充,可以形成饱满的落笔,具有美观的笔锋效果。
需要说明的是,本公开的实施例中,用于进行笔锋处理的补偿值的具体数值不受限制,上述示例中的补偿值仅为示例性的,而非限制性的,这可以根据实际需求而定,只需使多个补偿值依次减小即可,本公开的实施例对此不作限制。用于笔锋处理的轨迹点的数量也不受限制,这可以根据实际需求而定,例如根据需要达到的笔锋效果而定。
例如,在至少一个实施例中,该笔迹形成方法还可以包括如下操作:
步骤S170:对填充图案的边缘线条进行反走样处理。
在一些显示装置中,由于光栅图形显示的特点,对于非水平且非垂直的直线或多边形边界会出现锯齿状或台阶状外观,形成边缘毛刺。这种离散采样造成的采样不充分所导致的重建后信息失真称为走样。为了提升美观性,可以对填充图案的边缘线条进行反走样处理,从而减轻或消除线条的边缘毛刺。
例如,上述步骤S170可以与图1所示的步骤S120同时执行或在步骤S120之后执行,以消除轨迹单元的边界处的毛刺。又例如,上述步骤S170可以与图1所示的步骤S140同时执行或在步骤S140之后执行,以消除轨迹单元之间的多边形的边界处的毛刺。再例如, 上述步骤S170可以在利用显示装置显示笔迹之前执行,以全面消除笔迹中的边缘毛刺。关于上述步骤S170的执行方式和执行时间,本公开的实施例对此不作限制。
例如,在一些示例中,如图11所示,上述步骤S170可以包括如下操作:
步骤S171:将边缘线条经过的每个显示像素按照显示像素的对角线划分为两个区域,对角线的斜率的正负符号与边缘线条的斜率的正负符号相同;
步骤S172:判断边缘线条经过显示像素的线段所在的区域;
步骤S173:若线段位于两个区域其中之一,则使线段所在的显示像素以及在y方向上与线段所在的区域相邻的显示像素进行显示;
步骤S174:若线段与对角线重合,则使线段所在的显示像素进行显示。
图12A为本公开至少一个实施例提供的反走样处理的显示示意图,图12B为图12A中区域F的放大图。下面结合图12A和图12B,对上述步骤S171-S174进行说明。
当需要显示两个坐标点以及位于这两个坐标点之间的线条时,在得到两个坐标点和线宽w之后,可以确定出以这两个坐标点所在直线为中轴线、w为线宽的矩形的四个顶点和斜率k,然后对斜率为k的线条进行反走样处理。例如,在一些示例中,如图12A所示,图中所示的斜率为k的线条Lz需要进行反走样处理,图中多个阵列排布的方格表示阵列排布的显示像素。
首先,在步骤S171中,将边缘线条经过的每个显示像素按照显示像素的对角线划分为两个区域,对角线的斜率的正负符号与边缘线条的斜率的正负符号相同。例如,如图12A和图12B所示,将线条Lz经过的显示像素D1按照显示像素D1的对角线L1划分为两个区域,分别为第一区域Z1和第二区域Z2。例如,对角线L1的斜率的正负符号与线条Lz的斜率k的正负符号相同。在该示例中,线条Lz的斜率k为负数,因此对角线L1的斜率也为负数。需要说明的是,显示像素D1为正方形,其具有彼此垂直的两条对角线,一条对角线的斜率为正数,另一条对角线的斜率为负数。对显示像素D1进行区域划分时,所采用的对角线的斜率的正负符号与线条Lz的斜率k的正负符号相同。
然后,在步骤S172中,判断边缘线条经过显示像素的线段所在的区域。例如,如图12A和图12B所示,在该示例中,线条Lz经过显示像素D1的线段位于第二区域Z2。
在步骤S173中,若线段位于两个区域其中之一,则使线段所在的显示像素以及在y方向上与线段所在的区域相邻的显示像素进行显示。例如,如图12A和图12B所示,在该示例中,线条Lz经过显示像素D1的线段位于第二区域Z2中,因此使显示像素D1以及在y方向上与第二区域Z2相邻的显示像素D2进行显示。此时,虽然线条Lz经过显示像素D1而不经过显示像素D2,但是显示像素D1和显示像素D2均进行显示。在其他示例中,若线条Lz经过显示像素D1的线段位于第一区域Z1中,则需要使显示像素D1以及在y方向上与第一区域Z1相邻的显示像素进行显示。
在步骤S174中,若线段与对角线重合,则使线段所在的显示像素进行显示。此时,仅使线段经过的显示像素显示,而在y方向上与该显示像素相邻的其他显示像素不进行显示。该情形未在图12B中示出。
例如,在一些示例中,上述步骤S172-S174也可以采用如下方式实现。显示像素的中心(也即方格的中心)的坐标值是浮点型数值,xi表示显示像素的中心的x轴坐标,位于线条Lz经过显示像素D1的线段上的任意一点可以表示为M(xi,kx+b),k表示斜率,b表示线条Lz的偏置。线条Lz经过显示像素D1的线段所在区域的顶点(在图12B中为显示像素D1右上角的点)可以表示为N(int(xi)+1,int(kx+b)+1)。
若N到线条Lz的距离d MN等于
Figure PCTCN2021080511-appb-000018
则确定线条Lz经过显示像素D1的线段与显示像素D1的对角线重合,因此使显示像素D1显示,而在y方向上与该显示像素D1相邻的其他显示像素不进行显示。若N到线条Lz的距离d MN小于
Figure PCTCN2021080511-appb-000019
则确定线条Lz经过显示像素D1的线段位于第二区域Z2,因此使显示像素D1以及在y方向上与第二区域Z2相邻的显示像素D2进行显示。例如,显示像素D2为坐标点(xi,kx+b+1)所在的显示像素。若N到线条Lz的距离d MN大于
Figure PCTCN2021080511-appb-000020
确定线条Lz经过显示像素D1的线段位于第一区域Z1,因此使显示像素D1以及在y方向上与第一区域Z1相邻的显示像素(图12B中未示出)进行显示。例如,该显示像素为坐标点(xi,kx+b-1)所在的显示像素。
需要说明的是,由于显示像素的边长被归一化设置为1,因此显示像素的顶点到其对角线的距离等于
Figure PCTCN2021080511-appb-000021
由此,判断顶点N到线条Lz的距离d MN
Figure PCTCN2021080511-appb-000022
的关系本质上与判断线条Lz经过显示像素的线段所在的区域是一致的。在该示例中,由于线条Lz的斜率k为负值,因此选择显示像素右上角的点作为前述的顶点。在其他示例中,当线条的斜率为正值时,需要选择显示像素左上角的点作为前述的顶点。
图13为本公开至少一个实施例提供的反走样处理的效果对比图。根据图13可知,经过反走样处理后,显示图案的边缘线条的平滑程度有较大提升,边缘毛刺得到明显改善,显示图案的美观性得到提升。
例如,在一些示例中,在进行反走样处理时,若需要使在y方向上与边缘线条的线段所在的区域相邻的显示像素进行显示时,可以设置该相邻的显示像素的透明度,以达到更好的处理效果。
例如,该相邻的显示像素的透明度可以根据如下公式计算:
Figure PCTCN2021080511-appb-000023
其中,Td表示透明度,d MN表示相应线段所在的区域的顶点与该线段之间的距离。关于d MN、顶点等相关说明可参考前述内容,此处不再赘述。
例如,Td=1表示不透明,Td=0表示全透明,0<Td<1表示在一定程度上透明且透明程度随着数值增大而减弱。根据上述公式可知,线段越靠近顶点,则相邻的显示像素越不透明;线段越靠近显示像素的对角线,则相邻的显示像素越透明。在实际显示时,颜色值(或灰阶值)与透明度的乘积即为最终显示的颜色值(或灰阶值)。通过设置透明度,可以使反走样处理具有更好的处理效果,使形成的笔迹更美观。
需要说明的是,本公开的实施例中,进行反走样处理的方式不限于上文描述的方法,也可以为任意适用的反走样处理方法,这可以根据实际需求而定,本公开的实施例对此不 作限制。例如,可以采用通常的反走样处理方法,或者,也可以对上文描述的反走样处理方法进行修改和调整,本公开的实施例对此不作限制。
需要说明的是,本公开的实施例中,笔迹形成方法的各个步骤的执行顺序不受限制,虽然上文以特定顺序描述了各个步骤的执行过程,但这并不构成对本公开实施例的限制。该笔迹形成方法中的各个步骤可以串行执行或并行执行,这可以根据实际需求而定。该笔迹形成方法还可以包括更多或更少的步骤,本公开的实施例对此不作限制。
图14为本公开至少一个实施例提供的一种笔迹形成方法的应用流程图。下面结合图14对本公开实施例提供的笔迹形成方法的应用流程进行示例性说明。
首先,用户用手指或触控笔在触摸装置(例如触摸屏)的工作表面上写字,例如,书写路径为汉字“贾”,触摸装置检测并得到书写路径上的所有采样点及相应的坐标、压力值和标志位。接着,对所有采样点进行稀疏采样,并进行平滑处理(或插值处理),得到多个轨迹点和轨迹信息。轨迹信息例如包括坐标、压力值和标志位。
然后,进行坐标点级处理。基于轨迹信息,针对每个轨迹点建立轨迹单元,并且对轨迹单元的边缘线条进行反走样处理。基于轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式。确定了连线方式之后,根据连线方式计算轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充。并且,对填充的多边形的边缘线条进行反走样处理。
通过上述处理,即可形成显示的笔迹,例如,显示为毛笔字“贾”。当用户在触摸装置的工作表面上书写任意的汉字或笔画时,利用上述方式,均可以形成对应的毛笔字迹,从而为用户提供新的感官体验,提高了用户体验。该笔迹形成方法可以得到美观的毛笔书写笔迹,笔迹平滑,可以体现多种笔画,计算量小,处理效率高,实时性强,简单实用。
图15为一种可用于实施本公开实施例提供的笔迹形成方法的系统示意图。如图15所示,该系统10可以包括用户终端11、网络12、服务器13以及数据库14。例如,该系统10可以用于实施本公开任一实施例提供的笔迹形成方法。
用户终端11例如为电脑11-1或手机11-2。可以理解的是,用户终端11可以是能够执行数据处理且具有触摸检测功能的任何其他类型的电子设备,其可以包括但不限于台式电脑、笔记本电脑、平板电脑、智能手机、智能家居设备、可穿戴设备、车载电子设备、监控设备、户外广告牌、会议白板等。用户终端11也可以是设置有电子设备的任何装备,例如车辆、机器人等。
用户可以对安装在用户终端11上的应用程序进行操作,应用程序通过网络12将用户行为数据传输给服务器13,用户终端11还可以通过网络12接收服务器13传输的数据。用户终端11可以通过运行程序或线程的方式实施本公开实施例提供的笔迹形成方法。
在一些示例中,用户终端11可以利用其内置的应用程序执行笔迹形成方法。在另一些示例中,用户终端11可以通过调用用户终端11外部存储的应用程序执行笔迹形成方法。例如,用户可以用手指或触控笔在用户终端11的触摸装置的工作表面上进行书写,用户终端11执行本公开实施例提供的笔迹形成方法,从而将用户的书写笔迹显示为毛笔笔迹。
网络12可以是单个网络,或至少两个不同网络的组合。例如,网络12可以包括但不限于局域网、广域网、公用网络、专用网络等中的一种或几种的组合,例如,可以为有线网络、无线网络或它们的任意组合。
服务器13可以是一个单独的服务器,或一个服务器群组,群组内的各个服务器通过有线的或无线的网络进行连接;服务器13也可以是云服务器。一个服务器群组可以是集中式的,例如数据中心,也可以是分布式的。服务器13可以是本地的或远程的。
数据库14可以泛指具有存储功能的设备。数据库14主要用于存储用户终端11和服务器13在工作中所利用、产生和输出的各种数据。数据库14可以是本地的或远程的。数据库14可以包括各种存储器、例如随机存取存储器(Random Access Memory,RAM)、只读存储器(Read Only Memory,ROM)等。以上提及的存储设备只是列举了一些例子,该系统10可以使用的存储设备并不局限于此。
数据库14可以经由网络12与服务器13或其一部分相互连接或通信,或直接与服务器13相互连接或通信,或是上述两种方式的结合。
在一些示例中,数据库14可以是独立的设备。在另一些示例中,数据库14也可以集成在用户终端11和服务器13中的至少一个中。例如,数据库14可以设置在用户终端11上,也可以设置在服务器13上。又例如,数据库14也可以是分布式的,其一部分设置在用户终端11上,另一部分设置在服务器13上。
本公开至少一个实施例还提供一种笔迹形成装置,该笔迹形成装置可以得到美观的毛笔书写笔迹,笔迹平滑,可以体现多种笔画,计算量小,处理效率高,实时性强,简单实用。
图16为本公开至少一个实施例提供的一种笔迹形成装置的示意框图。如图16所示,该笔迹形成装置20包括采样单元21、建模单元22、连线方式确定单元23和填充单元24。例如,该笔迹形成装置20可以应用于书写软件、绘画软件等应用程序中,也可以应用于任意的需要形成毛笔书写笔迹的设备或系统中,本公开的实施例对此不作限制。
采样单元21配置为根据在触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息。例如,轨迹信息包括坐标、标志位和压力值,标志位包括指示对应的轨迹点是否为落笔点的数据。例如,采样单元21可以执行如图1所示的笔迹形成方法的步骤S110。建模单元22配置为基于轨迹信息建立与多个轨迹点一一对应的多个雨滴状的轨迹单元。例如,建模单元22可以执行如图1所示的笔迹形成方法的步骤S120。连线方式确定单元23配置为基于轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式。例如,连线方式确定单元23可以执行如图1所示的笔迹形成方法的步骤S130。填充单元24配置为根据连线方式计算轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。例如,填充单元24可以执行如图1所示的笔迹形成方法的步骤S140。
例如,采样单元21、建模单元22、连线方式确定单元23和填充单元24可以为硬件、软件、固件以及它们的任意可行的组合。例如,采样单元21、建模单元22、连线方式确定 单元23和填充单元24可以为专用或通用的电路、芯片或装置等,也可以为处理器和存储器的结合。关于上述各个单元的具体实现形式,本公开的实施例对此不作限制。
需要说明的是,本公开的实施例中,笔迹形成装置20的各个单元与前述的笔迹形成方法的各个步骤对应,关于笔迹形成装置20的具体功能可以参考关于笔迹形成方法的相关描述,此处不再赘述。图16所示的笔迹形成装置20的组件和结构只是示例性的,而非限制性的,根据需要,该笔迹形成装置20还可以包括其他组件和结构。
本公开至少一个实施例还提供一种电子设备,该电子设备包括处理器和存储器,一个或多个计算机程序模块被存储在该存储器中并被配置为由该处理器执行,一个或多个计算机程序模块包括用于实现本公开任一实施例提供的笔迹形成方法的指令。该电子设备可以得到美观的毛笔书写笔迹,笔迹平滑,可以体现多种笔画,计算量小,处理效率高,实时性强,简单实用。
图17为本公开至少一个实施例提供的一种电子设备的示意框图。如图17所示,该电子设备30包括处理器31和存储器32。存储器32用于存储非暂时性计算机可读指令(例如一个或多个计算机程序模块)。处理器31用于运行非暂时性计算机可读指令,非暂时性计算机可读指令被处理器31运行时可以执行上文所述的笔迹形成方法中的一个或多个步骤。存储器32和处理器31可以通过总线系统和/或其它形式的连接机构(未示出)互连。例如,该电子设备30可以采用Windows、Android等操作系统,根据本公开实施例的笔迹形成方法通过运行于该操作系统中的应用程序实现。
例如,处理器31可以是中央处理单元(CPU)、图形处理单元(GPU)、数字信号处理器(DSP)或者具有数据处理能力和/或程序执行能力的其它形式的处理单元,例如现场可编程门阵列(FPGA)等;例如,中央处理单元(CPU)可以为X86或ARM架构等。处理器31可以为通用处理器或专用处理器,可以控制电子设备30中的其它组件以执行期望的功能。
例如,存储器32可以包括一个或多个计算机程序产品的任意组合,计算机程序产品可以包括各种形式的计算机可读存储介质,例如易失性存储器和/或非易失性存储器。易失性存储器例如可以包括随机存取存储器(RAM)和/或高速缓冲存储器(cache)等。非易失性存储器例如可以包括只读存储器(ROM)、硬盘、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器、闪存等。在计算机可读存储介质上可以存储一个或多个计算机程序模块,处理器31可以运行一个或多个计算机程序模块,以实现电子设备30的各种功能。在计算机可读存储介质中还可以存储各种应用程序和各种数据以及应用程序使用和/或产生的各种数据等。
需要说明的是,本公开的实施例中,电子设备30的具体功能和技术效果可以参考上文中关于笔迹形成方法的描述,此处不再赘述。
图18为本公开至少一个实施例提供的另一种电子设备的示意框图。例如,如图18所示,除了包括处理器31和存储器32之外,该电子设备30还可以进一步包括触摸装置33和显示装置34。
例如,触摸装置33配置为获取触摸装置33的工作表面上的初始笔迹。例如,该触摸装置33可以为触摸屏或触摸板。该触摸屏可以为电容式触摸屏,例如自容式触摸屏或互容式触摸屏,还可以为电阻式触摸屏、表面声波式触摸屏、红外式触摸屏等;例如,触摸装置33可以包括触摸传感器以及控制器(例如驱动IC),该控制器接收触摸传感器采集的电信号,将该电信号处理后得到触摸信号并提供给处理器31等以用于进一步处理,以实现本公开实施例提供的笔迹形成方法。本公开的实施例对触摸装置33的类型、结构以及通信方式等不作限制。触摸装置33包括具有一定面积的工作表面,用户可以用手指直接在触摸装置33的工作表面上进行书写,也可以利用主动式触控笔或被动式触控笔在触摸装置33的工作表面上进行书写,本公开的实施例对此不作限制。这里,工作表面是指用于检测用户的触摸操作的表面,例如触摸装置33的触摸表面。需要说明的是,本公开的实施例中,触摸装置33的类型不受限制,不仅可以为触摸屏,还可以为交互白板等任意的具有触控功能的装置,这可以根据实际需求而定。
例如,显示装置34配置为显示经笔迹形成方法形成的笔迹。例如,该笔迹形成方法为本公开任一实施例提供的笔迹形成方法。该显示装置34例如为LCD显示屏、OLED显示屏、QLED显示屏、投影部件、VR头戴式显示设备(例如VR头盔、VR眼镜)、AR显示设备等,本公开的实施例对此不作限制。该显示装置34可以显示由本公开实施例提供的笔迹形成方法所形成的笔迹,例如毛笔笔迹。
例如,在一些示例中,触摸装置33和显示装置34为两个彼此独立的装置,触摸装置33具有触控功能但不具有显示功能,显示装置34具有显示功能但不具有触控功能。例如,在另一些示例中,触摸装置33和显示装置34为同一装置,该装置既具有触控功能又具有显示功能。关于触摸装置33和显示装置34的结构形式可以参考常规设计,此处不再详述。
图19为本公开至少一个实施例提供的再一种电子设备的示意框图。该电子设备40例如适于用来实施本公开实施例提供的笔迹形成方法。电子设备40可以是终端设备等。需要注意的是,图19示出的电子设备40仅仅是一个示例,其不会对本公开实施例的功能和使用范围带来任何限制。
如图19所示,电子设备40可以包括处理装置(例如中央处理器、图形处理器等)41,其可以根据存储在只读存储器(ROM)42中的程序或者从存储装置48加载到随机访问存储器(RAM)43中的程序而执行各种适当的动作和处理。在RAM 43中,还存储有电子设备40操作所需的各种程序和数据。处理装置41、ROM 42以及RAM 43通过总线44彼此相连。输入/输出(I/O)接口45也连接至总线44。
通常,以下装置可以连接至I/O接口45:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置46;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置47;包括例如磁带、硬盘等的存储装置48;以及通信装置49。通信装置49可以允许电子设备40与其他电子设备进行无线或有线通信以交换数据。虽然图19示出了具有各种装置的电子设备40,但应理解的是,并不要求实施或具备所有示出的装置,电子设备40可以替代地实施或具备更多或更少的装置。
例如,根据本公开的实施例,上述笔迹形成方法可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包括用于执行上述笔迹形成方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置49从网络上被下载和安装,或者从存储装置48安装,或者从ROM 42安装。在该计算机程序被处理装置41执行时,可以执行本公开实施例提供的笔迹形成方法中限定的功能。
有以下几点需要说明:
(1)本公开实施例附图只涉及到本公开实施例涉及到的结构,其他结构可参考通常设计。
(2)在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合以得到新的实施例。
以上所述,仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,本公开的保护范围应以所述权利要求的保护范围为准。

Claims (28)

  1. 一种笔迹形成方法,包括:
    根据在触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息,其中,所述轨迹信息包括坐标、标志位和压力值,所述标志位包括指示对应的轨迹点是否为落笔点的数据;
    基于所述轨迹信息建立与所述多个轨迹点一一对应的多个雨滴状的轨迹单元;
    基于所述轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式;
    根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。
  2. 根据权利要求1所述的方法,其中,基于所述轨迹信息建立与所述多个轨迹点一一对应的多个雨滴状的轨迹单元包括:
    确定第一圆的第一圆心坐标和第一半径;
    确定第二圆的第二圆心坐标和第二半径;
    填充所述第一圆和所述第二圆,并对所述第一圆和所述第二圆的公切点形成的多边形进行填充。
  3. 根据权利要求2所述的方法,其中,所述第一圆心坐标为对应的轨迹点的坐标,所述第一半径为压感量与多个书写参数预设值的乘积,所述压感量基于对应的轨迹点的压力值得到,所述第一半径大于所述第二半径。
  4. 根据权利要求3所述的方法,其中,所述压感量根据如下压感函数计算得到:
    Figure PCTCN2021080511-appb-100001
    其中,Pz表示所述压感量,P表示所述压力值。
  5. 根据权利要求2-4任一所述的方法,其中,所述第二圆心坐标根据所述第一圆心坐标、圆心距离和圆心连线角度得到,
    所述圆心距离为笔刷长度与对应的轨迹点的压力值的乘积的Q倍,2≤Q≤7,
    所述圆心连线角度为所述第一圆的圆心与所述第二圆的圆心的连线与所述第一圆心坐标所在坐标系的x轴方向的夹角,所述圆心连线角度为15~60度。
  6. 根据权利要求5所述的方法,其中,4.5≤Q≤5.5,所述圆心连线角度为25~35度。
  7. 根据权利要求2-6任一所述的方法,其中,所述第二半径根据如下公式计算得到:
    R2=0.5*R1*t,
    其中,R1表示所述第一半径,R2表示所述第二半径,t表示墨水浓度,t=max(0.8*T/n,0.6),T为常量,n为所述轨迹点的序号。
  8. 根据权利要求2-7任一所述的方法,其中,基于所述轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式包括:
    对于除了所述落笔点以外的轨迹点,计算当前轨迹点与前一个轨迹点的连线的斜率;
    根据所述斜率、所述当前轨迹点的坐标和所述前一个轨迹点的坐标,确定所述当前轨迹点对应的轨迹单元采用的连线方式;
    其中,所述斜率根据如下公式计算得到:
    Figure PCTCN2021080511-appb-100002
    k表示所述斜率,(x2,y2)表示所述当前轨迹点的坐标,(x1,y1)表示所述前一个轨迹点的坐标。
  9. 根据权利要求8所述的方法,其中,所述连线方式包括第一连线方式、第二连线方式、第三连线方式和第四连线方式,
    根据所述斜率、所述当前轨迹点的坐标和所述前一个轨迹点的坐标,确定所述当前轨迹点对应的轨迹单元采用的连线方式,包括:
    若|k|≤0.6或者|x2-x1|<1,则确定所述当前轨迹点对应的轨迹单元采用所述第一连线方式;
    若-0.9<k<-0.6且x2>x1,则确定所述当前轨迹点对应的轨迹单元采用所述第二连线方式;
    若0.6<k<1且y2<y1,则确定所述当前轨迹点对应的轨迹单元采用所述第三连线方式;
    否则,确定所述当前轨迹点对应的轨迹单元采用所述第四连线方式。
  10. 根据权利要求9所述的方法,其中,根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹,包括:
    对于除了所述落笔点以外的轨迹点,根据确定的所述第一连线方式、所述第二连线方式、所述第三连线方式和所述第四连线方式其中之一,计算所述轨迹单元的连接点;
    对相邻的轨迹点对应的轨迹单元的连接点所形成的所述多边形进行填充。
  11. 根据权利要求10所述的方法,其中,所述轨迹单元的连接点包括第一连接点m1和第二连接点n1,当采用所述第一连线方式时,根据如下公式计算所述第一连接点m1和所述第二连接点n1:
    Figure PCTCN2021080511-appb-100003
    其中,(m.x,m.y)表示所述第一连接点m1的坐标,(n.x,n.y)表示所述第二连接点n1的坐标,(c1.x,c1.y)表示所述第一圆心坐标,(c2.x,c2.y)表示所述第二圆心坐标,R1表示所述第一半径,R2表示所述第二半径,θ表示圆心连线角度,所述第一连接点m1的坐标、所述第二连接点n1的坐标、所述第一圆心坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
  12. 根据权利要求10所述的方法,其中,所述轨迹单元的连接点包括第一连接点m2和第二连接点n2,当采用所述第二连线方式时,根据如下公式计算所述第一连接点m2和所述第二连接点n2:
    Figure PCTCN2021080511-appb-100004
    其中,(m.x,m.y)表示所述第一连接点m2的坐标,(n.x,n.y)表示所述第二连接点n2的坐标,(c2.x,c2.y)表示所述第二圆心坐标,R1表示所述第一半径,R2表示所述第二半径,所述第一连接点m2的坐标、所述第二连接点n2的坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
  13. 根据权利要求10所述的方法,其中,所述轨迹单元的连接点包括第一连接点m3和第二连接点n3,当采用所述第三连线方式时,根据如下公式计算所述第一连接点m3和所述第二连接点n3:
    Figure PCTCN2021080511-appb-100005
    其中,(m.x,m.y)表示所述第一连接点m3的坐标,(n.x,n.y)表示所述第二连接点n3的坐标,(c2.x,c2.y)表示所述第二圆心坐标,R2表示所述第二半径,所述第一连接点m3的坐标、所述第二连接点n3的坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
  14. 根据权利要求10所述的方法,其中,所述轨迹单元的连接点包括第一连接点m4和第二连接点n4,当采用所述第四连线方式时,根据如下公式计算所述第一连接点m4和所述第二连接点n4:
    Figure PCTCN2021080511-appb-100006
    其中,(m.x,m.y)表示所述第一连接点m4的坐标,(n.x,n.y)表示所述第二连接点n4的坐标,(c1.x,c1.y)表示所述第一圆心坐标,(c2.x,c2.y)表示所述第二圆心坐标,R1表示所述第一半径,R2表示所述第二半径,θ表示圆心连线角度,所述第一连接点m4的坐标、所述第二连接点n4的坐标、所述第一圆心坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
  15. 根据权利要求10所述的方法,其中,根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹,还包括:
    对于作为所述落笔点的轨迹点,根据与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式确定所述落笔点对应的轨迹单元的连接点。
  16. 根据权利要求15所述的方法,其中,对于作为所述落笔点的轨迹点,根据与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式确定所述落笔点对应的轨迹单元的连接点,包括:
    若与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式为所述第一连线方式、所述第二连线方式或所述第三连线方式,则采用与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式确定所述落笔点对应的轨迹单元的连接点;
    若与所述落笔点相邻的轨迹点对应的轨迹单元的连线方式为所述第四连线方式,则根据如下公式计算所述落笔点对应的轨迹单元的第一连接点m5和第二连接点n5:
    Figure PCTCN2021080511-appb-100007
    其中,(m.x,m.y)表示所述第一连接点m5的坐标,(n.x,n.y)表示所述第二连接点n5的坐标,(c1.x,c1.y)表示所述第一圆心坐标,(c2.x,c2.y)表示所述第二圆心坐标,R1表示所述第一半径,R2表示所述第二半径,θ表示圆心连线角度,所述第一连接点m5的坐标、所述第二连接点n5的坐标、所述第一圆心坐标和所述第二圆心坐标位于所述触摸装置的工作表面上的同一坐标系中。
  17. 根据权利要求10-16任一所述的方法,其中,根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹,还包括:
    在对相邻的轨迹点对应的轨迹单元的连接点所形成的所述多边形进行填充之前,判断所述当前轨迹点对应的轨迹单元的连线方式与所述前一个轨迹点对应的轨迹单元的连线方式是否不同;
    若不同,则采用所述当前轨迹点对应的轨迹单元的连线方式计算所述前一个轨迹点对应的轨迹单元的连接点以作为所述前一个轨迹点对应的轨迹单元的重复连接点;
    其中,在对相邻的轨迹点对应的轨迹单元的连接点所形成的所述多边形进行填充时,所述前一个轨迹点与所述当前轨迹点对应的轨迹单元之间的多边形基于所述重复连接点形成。
  18. 根据权利要求1-17任一所述的方法,其中,在建立所述多个雨滴状的轨迹单元之前,所述方法还包括:
    选取包含所述落笔点在内的连续的Z个轨迹点,将所述Z个轨迹点中每个的轨迹信息中的压力值分别加上补偿值以得到更新的压力值,并用所述更新的压力值替换所述轨迹信息中的压力值;
    其中,5≤Z≤15且Z为整数。
  19. 根据权利要求18所述的方法,其中,与所述Z个轨迹点对应的Z个补偿值依次 减小。
  20. 根据权利要求1-19任一所述的方法,还包括:
    对填充图案的边缘线条进行反走样处理。
  21. 根据权利要求20所述的方法,其中,对所述填充图案的边缘线条进行所述反走样处理包括:
    将所述边缘线条经过的每个显示像素按照所述显示像素的对角线划分为两个区域,其中,所述对角线的斜率的正负符号与所述边缘线条的斜率的正负符号相同;
    判断所述边缘线条经过所述显示像素的线段所在的区域;
    若所述线段位于所述两个区域其中之一,则使所述线段所在的显示像素以及在y方向上与所述线段所在的区域相邻的显示像素进行显示;
    若所述线段与所述对角线重合,则使所述线段所在的显示像素进行显示。
  22. 根据权利要求21所述的方法,其中,在y方向上与所述线段所在的区域相邻的显示像素的透明度根据如下公式计算:
    Figure PCTCN2021080511-appb-100008
    其中,Td表示所述透明度,d MN表示所述线段所在的区域的顶点与所述线段之间的距离。
  23. 根据权利要求1-22任一所述的方法,其中,根据在所述触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息包括:
    选择所述书写路径上全部采样点中的一部分采样点;
    基于所述一部分采样点得到所述多个轨迹点,并得到所述多个轨迹点的轨迹信息。
  24. 根据权利要求23所述的方法,其中,所述一部分采样点与所述全部采样点的数量之比为1%~5%。
  25. 一种笔迹形成装置,包括:
    采样单元,配置为根据在触摸装置的工作表面上的书写路径上的多个采样点确定一组轨迹点并得到每个轨迹点的轨迹信息,其中,所述轨迹信息包括坐标、标志位和压力值,所述标志位包括指示对应的轨迹点是否为落笔点的数据;
    建模单元,配置为基于所述轨迹信息建立与所述多个轨迹点一一对应的多个雨滴状的轨迹单元;
    连线方式确定单元,配置为基于所述轨迹信息确定相邻的轨迹点对应的轨迹单元之间的连线方式;
    填充单元,配置为根据所述连线方式计算所述轨迹单元的连接点,并对相邻的轨迹点对应的轨迹单元的连接点所形成的多边形进行填充,以用于形成显示的笔迹。
  26. 一种电子设备,包括:
    处理器;
    存储器,包括一个或多个计算机程序模块;
    其中,所述一个或多个计算机程序模块被存储在所述存储器中并被配置为由所述处理器执行,所述一个或多个计算机程序模块包括用于实现权利要求1-24任一所述的笔迹形成方法的指令。
  27. 根据权利要求26所述的电子设备,还包括所述触摸装置,其中,所述触摸装置配置为获取所述触摸装置的工作表面上的初始笔迹。
  28. 根据权利要求26或27所述的电子设备,还包括显示装置,其中,所述显示装置配置为显示经所述笔迹形成方法形成的笔迹。
PCT/CN2021/080511 2020-04-30 2021-03-12 笔迹形成方法、笔迹形成装置及电子设备 WO2021218448A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US17/626,683 US11809701B2 (en) 2020-04-30 2021-03-12 Handwriting forming method and apparatus, and electronic device
US18/474,773 US20240020893A1 (en) 2020-04-30 2023-09-26 Handwriting Forming Method and Apparatus, and Electronic Device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010367901.X 2020-04-30
CN202010367901.XA CN113590002B (zh) 2020-04-30 2020-04-30 笔迹形成方法、笔迹形成装置及电子设备

Related Child Applications (2)

Application Number Title Priority Date Filing Date
US17/626,683 A-371-Of-International US11809701B2 (en) 2020-04-30 2021-03-12 Handwriting forming method and apparatus, and electronic device
US18/474,773 Continuation-In-Part US20240020893A1 (en) 2020-04-30 2023-09-26 Handwriting Forming Method and Apparatus, and Electronic Device

Publications (1)

Publication Number Publication Date
WO2021218448A1 true WO2021218448A1 (zh) 2021-11-04

Family

ID=78237716

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/080511 WO2021218448A1 (zh) 2020-04-30 2021-03-12 笔迹形成方法、笔迹形成装置及电子设备

Country Status (3)

Country Link
US (1) US11809701B2 (zh)
CN (1) CN113590002B (zh)
WO (1) WO2021218448A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115098014B (zh) * 2021-12-29 2024-05-14 山东蓝贝思特教装集团股份有限公司 书写笔迹显示方法、控制器及tft液晶书写装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101373539A (zh) * 2008-10-07 2009-02-25 广东威创视讯科技股份有限公司 毛笔笔迹的书写方法及书写装置
US20130308863A1 (en) * 2011-01-31 2013-11-21 Xueping Zou Method and device for implementing original handwriting, and electronic device
CN103823628A (zh) * 2013-12-15 2014-05-28 北京工业大学 结合笔压的毛笔字笔锋模拟方法
CN107219941A (zh) * 2017-05-23 2017-09-29 中国科学院自动化研究所 软笔实时轨迹生成方法、存储介质、处理设备
CN109671133A (zh) * 2018-12-12 2019-04-23 成都四方伟业软件股份有限公司 轨迹的生成方法、装置、电子设备及存储介质
CN110515527A (zh) * 2019-07-12 2019-11-29 沈阳美行科技有限公司 一种书写笔迹显示方法、装置及相关系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7227993B2 (en) * 2003-01-27 2007-06-05 Microsoft Corporation Learning-based system and process for synthesizing cursive handwriting
CA2717609C (en) * 2008-03-20 2016-11-29 Basf Se Polymer dispersions containing phosphorous polymers and emulsifiers
CN102937850B (zh) * 2012-12-04 2015-07-22 上海合合信息科技发展有限公司 实时手写笔迹的美化方法及美化装置
CN110531875B (zh) * 2019-08-21 2023-12-12 华诺科技武汉有限公司 书写笔锋的生成方法、终端设备及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101373539A (zh) * 2008-10-07 2009-02-25 广东威创视讯科技股份有限公司 毛笔笔迹的书写方法及书写装置
US20130308863A1 (en) * 2011-01-31 2013-11-21 Xueping Zou Method and device for implementing original handwriting, and electronic device
CN103823628A (zh) * 2013-12-15 2014-05-28 北京工业大学 结合笔压的毛笔字笔锋模拟方法
CN107219941A (zh) * 2017-05-23 2017-09-29 中国科学院自动化研究所 软笔实时轨迹生成方法、存储介质、处理设备
CN109671133A (zh) * 2018-12-12 2019-04-23 成都四方伟业软件股份有限公司 轨迹的生成方法、装置、电子设备及存储介质
CN110515527A (zh) * 2019-07-12 2019-11-29 沈阳美行科技有限公司 一种书写笔迹显示方法、装置及相关系统

Also Published As

Publication number Publication date
US20220261146A1 (en) 2022-08-18
CN113590002B (zh) 2024-04-16
US11809701B2 (en) 2023-11-07
CN113590002A (zh) 2021-11-02

Similar Documents

Publication Publication Date Title
US11687233B2 (en) Handwriting processing method, touch display device, computer device and storage medium
US9020266B2 (en) Methods and devices for processing handwriting input
US8860675B2 (en) Drawing aid system for multi-touch devices
US8854342B2 (en) Systems and methods for particle-based digital airbrushing
JP2017529623A (ja) ウェットインク予測器
CN102939575A (zh) 墨水呈现
US10438385B2 (en) Generating ink effects for a digital ink stroke
CN104345948A (zh) 一种手写原笔迹的实现方法、实现装置及电子设备
KR102188543B1 (ko) 그래픽 처리 장치
WO2021218445A1 (zh) 笔迹处理方法、笔迹处理装置、存储介质
CN106155540B (zh) 电子毛笔笔形处理方法和装置
WO2018103227A1 (zh) 对称图形的绘制方法和装置
WO2022242379A1 (zh) 笔画渲染方法、装置、存储介质以及终端
US9955065B2 (en) Dynamic motion path blur user interface
US11789604B2 (en) Handwriting processing method, handwriting processing device and non-transitory storage medium
KR20160046574A (ko) 그래픽 프로세싱 유닛, 이를 포함하는 그래픽 프로세싱 시스템, 및 이를 이용한 안티 에일리어싱 방법
WO2021218448A1 (zh) 笔迹形成方法、笔迹形成装置及电子设备
CN103310409A (zh) 一种Tile-based渲染架构GPU的三角形快速分块方法
CN115237320A (zh) 笔迹显示方法、触控显示设备、计算机设备及介质
US20240020893A1 (en) Handwriting Forming Method and Apparatus, and Electronic Device
US11551391B2 (en) Digital image dynamic shadow generation
US11232608B1 (en) Polybezier-based digital ink strokes
CN113487704B (zh) 一种燕尾箭头标的绘制方法、装置、存储介质及终端设备
CN114585992B (zh) 书写轨迹处理方法、触控设备、书写系统及存储介质
WO2022242013A1 (zh) 笔迹擦除方法、装置、交互平板及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21795422

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21795422

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 23.06.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21795422

Country of ref document: EP

Kind code of ref document: A1