CN109101171A - A method of generating sliding trace in touch panel device - Google Patents
A method of generating sliding trace in touch panel device Download PDFInfo
- Publication number
- CN109101171A CN109101171A CN201710478895.3A CN201710478895A CN109101171A CN 109101171 A CN109101171 A CN 109101171A CN 201710478895 A CN201710478895 A CN 201710478895A CN 109101171 A CN109101171 A CN 109101171A
- Authority
- CN
- China
- Prior art keywords
- touch
- points
- point
- sliding trace
- adjacent
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0487—Interaction 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/0488—Interaction 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/04883—Interaction 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
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The method that the embodiment of the invention provides a kind of to generate sliding trace in touch panel device, the contact track sent including receiving touch panel device, and two adjacent touch points on contact track are successively obtained according to the corresponding time sequencing occurred that touches in contact;Two points are randomly selected on contact track between the every two adjacent touch point successively obtained;According between two selected points and two selected points and the successively positional relationship between two adjacent touch points for obtaining, two control points of Bezier are obtained;Based on obtained two control points, to Bezier fitting is carried out between the every two adjacent touch point successively obtained, to generate sliding trace.The method provided by the embodiments of the present application that sliding trace is generated in touch panel device, according to the position of touch point on contact track, the control point of Bezier is calculated, thus the directional information provided according to control point, it carries out curve fitting to contact track, to generate smooth sliding trace.
Description
Technical field
A kind of generating the present invention relates to computer graphical processing field more particularly in touch panel device sliding trace
Method.
Background technique
Current electronic product generally all has handwriting functions, for example, writing signing, hand annotation, handwritten signature are hand-written
Identification, the hand-written functions such as record the note.
When the finger of felt pen or people moves on device screen, equipment generally notifies phase in a manner of touch event
The location of the finger of the processing software current touch pen or people answered.Due to the processing capacity and event notification mechanism of equipment
There are certain limitations (for example, the time interval of notice touch event is uneven) and user with finger or felt pen
There may be shake when carrying out hand-written operation, therefore, there are pleats for the touch track formed on device screen by hand-written operation
Wrinkle, the inadequate problem of smoothness.
Summary of the invention
The method that the embodiment provides a kind of to generate sliding trace in touch panel device, realizing has
When executing hand-written operation on the electronic equipment of handwriting functions, it is capable of forming smooth sliding trace, is solved in the prior art
It is hand-written to operate the inadequate problem of the sliding trace smoothness formed on device screen.In order to achieve the above objectives, reality of the invention
It applies example and provides a kind of method for generating sliding trace in touch panel device, comprising the following steps: receive the touch screen and set
The contact track that preparation is sent, and two are successively obtained on the contact track according to the corresponding time sequencing occurred that touches in contact
Adjacent touch point;Two points are randomly selected on contact track between the every two adjacent touch point successively obtained;Root
According between two selected points and two selected points and the successively position between two adjacent touch points for obtaining
Relationship obtains two control points of Bezier;
It is bent to Bezier is carried out between the every two adjacent touch point successively obtained based on obtained two control points
Line fitting, to generate sliding trace.
In above-mentioned steps, after obtaining the control point between two adjacent touch points, so that it may be touched at this two
One section of Bezier is fitted between point, in this way, according to the touch of user sequence, it is two adjacent constantly on contact track
It is fitted one section of Bezier between touch point, Bezier corresponding to entire contact track can be obtained.
Optionally, two selected points are corrected, calculate two phases the step of to obtain the control point of Bezier
Adjacent touch point and two selected points are in totally four points, two-by-two the midpoint between adjacent point;Calculate line between midpoint
Length, and the ratio between computational length;According to ratio and midpoint, the position of two selected points is corrected, is put down respectively
It moves two selected points and draws two points to the position or at the location, to obtain the control of Bezier
Point.
Optionally, two adjacent touch points and two selected points are calculated in totally four points, two-by-two adjacent point it
Between midpoint the step of are as follows: calculate two adjacent touch points starting point and close to the starting point selected point between starting in
Point, the transition midpoint between two selected points, the terminal of selected another point and described two adjacent touch points
Between termination midpoint.
The step of above-mentioned calculating midpoint using one of touch point of two adjacent touch points as two touch points it
Between one section of Bezier starting point, terminal of another touch point as this section of Bezier, calculate separately starting point with
Midpoint between the selected point of starting point, between the midpoint and another selected point and terminal between two selected points
Midpoint, the midpoint between position and two adjacent touch points due to correcting selected two points is substantially unrelated, it is above-mentioned
Step is not necessarily to calculate the midpoint between two adjacent touch points.
Optionally, the step of calculating the length of line between midpoint are as follows: calculate the of starting midpoint and transition midpoint line
One length, transition midpoint and the second length for terminating midpoint, and starting midpoint and the third length for terminating midpoint.
Optionally, the step of ratio between computational length are as follows: calculate the first length and the first length and the second length it
The ratio of sum;Calculate the ratio of the sum of the second length and the second length and third length.
Optionally, it is being based on obtained control point, carried out curve fitting to contact track, before generating sliding trace
Further include the steps that adjusting the distance between control point and two adjacent touch points.
Optionally, before generating sliding trace further include: the length of a curve for calculating sliding trace to be generated, according to being counted
The length of calculation calculates the quantity of the coordinate points on the curve between two adjacent touch points;Based on the quantity and described
The diameter of two adjacent touch points determines the diameter of the coordinate points;According to the diameter of the coordinate points, in described two phases
Bezier fitting is carried out between adjacent touch point, to generate the sliding trace of variable-width.
Optionally, the obtaining step of the quantity of coordinate points are as follows: coordinate system is established, by the curve of the sliding trace to be generated
It is mapped to the coordinate system;According to the spacing between the length and preset coordinate points of the sliding trace to be generated, institute is obtained
State the quantity of coordinate points on curve.
Touch the calculating step of spot diameter are as follows: obtain the touch time of touch point;Calculate the touching of two adjacent touch points
Touch the time difference;According to the distance between described two adjacent touch points and the touch time difference, described two touches are obtained
Touch speed between point;It according to the touch speed, determines in two adjacent touch points, touches the touching of time rearward
Touch diameter a little.
Optionally, it obtains after touch speed between the first two touch point further include: according to upper one adjacent two
Touch speed between a touch point, and the weighted value of setting adjust between obtained current two adjacent touch points
Touch speed.
Optionally, after the control point for obtaining Bezier further include: be based on obtained control point, draw out two
Curve between adjacent touch point, and curve is saved in bitmap file;Between adjacent touch point a pair of under drafting
Curve when, call above-mentioned bitmap file.
Optionally, the step of generating sliding trace are as follows: carry out curve fitting, will be drawn to contact track drawing buffer area
The Bezier of system is sent to display buffer and is shown.
Optionally, the step of obtaining two adjacent touch points in touch track are as follows: obtain the touch that touch track is sent
The coordinate of point;Obtain the coordinate of touch point on the contact track that the touch panel device is sent;According to acquired touch point
Coordinate calculates the distance of two adjacent touch points on the contact track;If the distance is less than predetermined threshold, give up
One of them of described two adjacent touch points, so that the distance between the touch point and next touch point do not given up are equal to
Or it is greater than the predetermined threshold.
Optionally, the setting up procedure of predetermined threshold are as follows: obtain the screen density of touch panel device;According to acquired screen
The screen density threshold of density and setting, obtains the quantity of touch point to be given up;According to the quantity of touch point to be given up, touched
Touch the average distance of two neighboring touch point on track;Using average distance as predetermined threshold.
To sum up, the method that the embodiment of the invention provides a kind of generates sliding trace in touch panel device, this method exist
Two points are randomly selected on contact track between two adjacent touch points, by solving two adjacent touch points and random institute
Two points chosen are between the midpoint and midpoint between totally four points the step of the length and ratio of line, to randomly selecting
The positions of two points be corrected so that the two infinite approach control points randomly selected, finally based on calibrated
One section of Bezier is drawn out at the control point arrived between two adjacent touch points, or according to the control calculated
The coordinate value of point, directly draws out two control points, according to the control point drawn out, draws between two adjacent touch points
One section of Bezier out.By the Bezier between adjacent touch point multipair on connecting terminal track, finally obtain
Smooth sliding trace corresponding with contact track.From the foregoing, it can be seen that shellfish is calculated according to touch point in the embodiment of the present invention
The control point of Sai Er curve, to accurately determine the half interval contour of two adjacent touch points on contact track according to control point
Shape, the directional information that touch panel device is provided according to the control point between every two adjacent touch point, fitting
Smooth sliding trace out directly connects each touch point rather than in the prior art, causes to generate between line hard
Angle, it is unsmooth.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be in embodiment or description of the prior art
Required attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is only some realities of the invention
Example is applied, it for those of ordinary skill in the art, without creative efforts, can also be according to these attached drawings
Obtain other attached drawings.
Fig. 1 is a kind of flow chart of method that sliding trace is generated in touch panel device provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic diagram that Bezier drafting is carried out according to control point provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
As shown in Figure 1, the embodiment of the present application provides a kind of method that sliding trace is generated in touch panel device, including
Step:
S100: the contact track that touch panel device is sent is received, and touches the time sequencing occurred according to contact is corresponding
Successively obtain two adjacent touch points on contact track.
When executing step S100, due to touch panel device renewal speed quickly, lead to different resolution difference size
Touch panel device it is very much, equipment degree of fragmentation is high, and for the touch panel device of high resolution, when obtaining touch point,
The touch point of acquisition is more, takes a little close, to influence the response speed of touch panel device, the embodiment of the present application considers high-resolution
Rate equipment and low resolution equipment have a differentiation standard, that is, there is a resolution threshold, are high score when being higher than the threshold value
Resolution equipment is low resolution equipment when being lower than the threshold value, for example, cell phone apparatus of the screen density higher than 320 is high-resolution
Rate mobile phone, mobile phone of the screen density lower than 320 are low resolution mobile phone.The embodiment of the present application is when executing step S100, first
Then the screen density for obtaining touch panel device calculates the ratio of the screen density threshold of acquired screen density and setting,
The remainder of the two is obtained, which is exactly the quantity for the point for needing to give up when obtaining touch point, according to what is sent on contact track
The total amount of touch point and the quantity of cut-off point obtain the quantity for drawing the practical touch point used of Bezier, in conjunction with contact
The length of track obtains the average distance of two touch points adjacent on contact track, using obtained average distance as phase
The predetermined threshold of two adjacent touch point distances.
It should be noted that the embodiment of the present application is to generate response to the touch action of user while user touches,
Smooth touch track is drawn out, therefore, the quantity of touch point can not be got before generating final sliding trace, on
The total amount of the touch point sent on the contact track mentioned in embodiment is stated, the last time that can be touched before occurring for this touches
Act the quantity of touch point occurred.During realization, obtained contact track can be mapped in coordinate system, thus
The coordinate value of each touch point on available contact track, and then according to coordinate value, calculate the distance between two o'clock and two
Midpoint between point.
Optionally, after the predetermined threshold of distance determines between two adjacent touch points, when executing step S100, according to
The coordinate value of touch point on acquired contact track calculates the actual range between two adjacent touch points, by the reality
Border distance and above-mentioned predetermined threshold are compared, if actual range is less than predetermined threshold, give up two adjacent touches
One of them of point, so that the distance between touch point and next touch point for not giving up are equal to or more than predetermined threshold.
In touch track in two adjacent touch points, it can give up and touch time point rearward, can also give up and touch the time and lean on
Preceding point.As an example it is assumed that the two adjacent touch points got are Q1 respectively, Q2, Q1 are touch time forward points,
Q2 is to touch the point of time rearward, and the distance between Q1 and Q2 are less than predetermined threshold L and judge if giving up touch point Q2
Whether the distance between touch point Q1 and next touch point Q3 for not giving up are less than predetermined threshold L, if be equal to or more than
Predetermined threshold L then retains touch point Q3;If still less than predetermined threshold L, cut-off point Q3 continues to judge under Q1 and Q3
The distance between one touch point.If giving up touch point Q1, due to will be between Q1 and the adjacent touch of the front point Q0
Distance made judgement, then the distance between Q0 and the touch point Q2 not given up are centainly greater than after giving up touch point Q1
Predetermined threshold L.Next it is just to continue with and will be compared between the distance between touch point Q2 and touch point Q3 and predetermined threshold L.
It should be noted that the length for calculating contact track is prior art, which is not described herein again.And ordinary circumstance
Under, what the embodiment of the present application was given up is the touch point along the starting point of contact track to terminating point direction rearward, because forward
Touch point just have determined that when accepted or rejected between the upper a pair of two adjacent touch points of judgement.
The embodiment of the present application is by setting the predetermined threshold between two adjacent touch points, so that larger in screen density
Touch panel device on when executing hand-written operation, do not need to take many touch points, thus drawing out smooth sliding rail yet
While mark, the response speed of equipment is nor affected on, and what the predetermined threshold took is average distance between touch point, generally
In the case of, which is unlikely to excessive, even if also can guarantee when executing hand-written operation on the low density touch panel device of screen
For generating the quantity of the touch point of sliding trace, and then having ensured the quality for the sliding trace drawn.
As shown in Fig. 2, executing step S200: in every two successively obtained after getting two adjacent touch points
Two points are randomly selected on contact track between a adjacent touch point.As shown, adjacent two touch points difference
For P0, P3, i.e., the starting point of the Bezier between two adjacent touch points is P0, and terminating point is P3.It is mentioned here
Starting point and ending point is determined according to the glide direction of contact track, wherein glide direction can be according on contact track
The time that the corresponding touch action in contact occurs determines.
It should be noted that touch point P0 and P3 are two adjacent touch points, and it is clear in order to describe, as shown in Fig. 2, right
The distance between touch point is exaggerated.
The application can carry out curve fitting between adjacent touch point with Bezier interpolation algorithm three times, so needing
Two control points are calculated according to the coordinate of touch point P0 and P3, it is between setting touch point P0 and P3, Bezier
Two control points are P1, P2, and two point a1 and a2 are randomly selected between P0 and P3, are calculated for convenience, can be to a1, a2 two
The positional relationship of a point and control point P1, P2 are preset.A1 can be set, a2 can also be set between P1, P2
P1, P2 can also set P1, a1 is between P2, a2 etc. between a1, a2.The embodiment of the present application with assume two point a1 and
A2 between control point P1 and P2 for be illustrated.Then in step S300, according between two selected points, Yi Jisuo
Positional relationship between two points chosen and the two adjacent touch points successively obtained obtains two controls of Bezier
The step of system point includes: to calculate P0 and the midpoint between the selected point a1 of P0, which can be referred to as starting midpoint, a1
Midpoint between a2, the midpoint can be referred to as transition midpoint, the midpoint between a2 and P3, which can be referred to as to terminate
Midpoint.
When practical execution aforesaid operations, it is assumed that a1 (x1, y1) and a2 (x2, y2) calculate P0 between two control points
Midpoint between (x0, y0) and a1 (x1, y1) is M1 (xc1,yc1), the midpoint calculated between a1 (x1, y1) and a2 (x2, y2) is
M2(xc2,yc2) and a2 (x2, y2) and P3 (x3, y3) between midpoint be M3 (xc3,yc3)。
Then length len1, the length len2 of line between midpoint M2 and M3 of line between midpoint M1 and M2 are calculated, in
The length len3 of line between point M1 and M3, and the ratio between these three length is calculated, the formula of ratio calculated are as follows:
K1=len1/ (len1+len2);
K2=len2/ (len2+len3);
According to ratio k 1, k2 and above-mentioned midpoint M1, M2 and M3 correct the position of a1 and a2 by following formula:
xm1=xc1+(xc2-xc1)*k1;
ym1=yc1+(yc2-yc1)*k1;
xm2=xc2+(xc3-xc2)*k2;
ym2=yc2+(yc3-yc2)*k2;
Wherein, (xm1,ym1) it is in M1 (xc1,yc1) on the basis of, in conjunction with M2 (xc2,yc2) and k1 value, to M1 carry out
Translate the coordinate of obtained control point P1.(xm2,ym2) it is in M2 (xc2,yc2) on the basis of, in conjunction with P3 ((xc3,yc3)) and k2
Value, M2 is translated, the coordinate of obtained control point P2.
By above-mentioned step, the Bezier control on contact track between every two adjacent touch point can be obtained
Point processed.It should be noted that two points of selection can be moved to calculated control point after obtaining the position at control point
Set, control point can also be repainted in calculated control point position, thus according to the control point obtained after movement or
The direction of a curve information that control point that person obtains after repainting provides, draw out from two adjacent touch points one of them
Touch point is set out, and levels off to the Bezier of another touch point.To the adjacent touch point of every a pair on contact track
Between all draw Bezier after, these Beziers connect two-by-two, can present on touch panel device smooth
Sliding trace.During realization, sliding trace can also be drawn with canvas technology, canvas technology can be according to every
The starting point that section Cubic kolmogorov's differential system is chosen, control point and terminating point are depicted as touching sliding trace, then by further
Retouch side and filling formed smooth sliding trace and show on the touchscreen.In compared with the prior art, directly adjacent
The curve plotting method that is attached of touch point, curve plotting method provided by the embodiments of the present application reduces hard angle in curve
Generation, the higher curve of smoothness can be obtained.
Optionally, before generating sliding trace, further include adjust between control point and two adjacent touch points away from
From can specifically be realized by adjusting the coordinate of control point P1 and P2.It, can be by one between 0 and 1 during realization
Between smoothness parameter smooth_value the coordinate of control point P1 and P2 are adjusted, adjust process are as follows:
Ctrl1_x=xm1+(xc2-xm1)*smooth_value+x1-xm1;
Ctrl1_y=ym1+(yc2-ym1)*smooth_value+y1-ym1;
Ctrl2_x=xm2+(xc2-xm2)*smooth_value+x2-xm2;
Ctrl2_y=ym2+(yc2-ym2)*smooth_value+y2-ym2;
Wherein, ctrl1_x and ctrl1_y is respectively the abscissa and ordinate of control point P1 adjusted, ctrl2_x and
Ctrl2_y is respectively the abscissa and ordinate of control point P2 adjusted.
It should be noted that verified, the value of smoothness smooth_value is bigger, and obtained sliding trace is more smooth,
Therefore, smoothness can suitably be tuned up within the allowable range, in conjunction with actual conditions to further enhance sliding rail generated
The smoothness of mark.
In order to which sliding trace is preferably presented, the embodiment of the present application also provides the Beziers for drawing thickness variation
Method, the i.e. diameter by calculating the drafting speed between two adjacent touch points to determine touch point.The application is real
Example is applied when acquiring touch point, reads the touch time of acquired touch point, according to the touch time, calculates two adjacent touchings
The touch time difference a little is touched, because of the coordinate value according to two adjacent touch points, can be calculated between two touch points
Distance according to distance and touches the time difference, so that it may calculate the touch speed between two o'clock, pass through the speed and diameter of setting
Corresponding relationship, diameter corresponding with speed is touched can be obtained.
Because during actually carrying into execution a plan, generally presetting first touch point on Bezier path
Diameter, so, between first touch point and second touch point on Bezier path, determined according to speed is touched
When touching spot diameter, identified is the diameter of second touch point.The rest may be inferred, in two adjacent touch points, according to touching
Touch speed it is confirmed that touch the time rearward, i.e., the diameter close to the touch point of Bezier terminal.
It should be noted that touching the diameter of speed and touch point can be proportional to, it can also be in inverse relation, only
Want the diameter of touch point can be according to the variation for touching speed presentation certain rule.
In order to avoid between two adjacent touch points of upper a pair touch speed and adjacent two touch points of lower a pair
Touch speed between differ too big so that the width for the curve drawn has lofty variation, the embodiment of the present application is set
One weighted value between 0 and 1, and the touch speed between current two adjacent touch points is adjusted with the weighted value,
(weighted value between one 0 to 1) * (current two spot speed)+(1- weighted value) * (upper one two can specifically be passed through
The speed of point) the touch speed between current two adjacent touch points is calculated.
There is the too fast situation of change width to further avoid Bezier, the embodiment of the present application has also preset one
The maximum diameter and minimum diameter of a touch point, maximum diameter and minimum diameter here can by the diameter to touch point into
Row statistics, presets based on experience value.And compared with maximum gauge/both (speed+1) and minimum diameter and take the larger value, if should
The larger value has been more than set maximum gauge, then takes maximum gauge, if the larger value is less than set minimum diameter,
Take minimum diameter.The diameter for the touch point calculated is adjusted through the above way, Bezier is enabled to exist
It is not in or to be less than more than maximum gauge while capable of showing different width sizes according to different touch speed
Too fast variation will not be presented in the case where minimum diameter, i.e. width, further ensure the smoothness of sliding trace.
Optionally, the method for drafting of the Bezier of change width are as follows: calculate the length of the curve of sliding trace to be generated
Degree;It has been mentioned hereinbefore that the contact track that touch panel device transmits can be mapped in coordinate system, we can will be to here
The curve mapping of sliding trace is generated into corresponding coordinate system, according between the length and preset coordinate points calculated
Spacing carrys out the quantity of the coordinate points on calculated curve.For example, calculated length of curve is 10, between the coordinate points of setting
Distance be 1, then the quantity of coordinate points is just 11 on curve.It should be noted why being referred to as coordinate points here
And touch point, it is because the coordinate points that have may not be touch point, but in order to draw the same of the sliding trace of thickness variation
When, it avoids after amplifying sliding trace, the discontinuous situation of curve occurs, this programme is also adjacent by two when drawing curve
Touch point between coordinate points all draw out.That is, coordinate points here may include two adjacent touch points,
In the example that the quantity of i.e. aforementioned calculated coordinate points is 11, two adjacent touch points have been contained in 11 points.When
So, it can not also include two adjacent touch points, for example can set in first coordinate points and two adjacent touch points
The distance between starting point, and set the distance between the terminal in the last one coordinate points and two adjacent touch points, then
Above-mentioned two distance is subtracted with the total length of curve, the quantity of coordinate points can also be calculated.It should be noted coordinate points
Between spacing is smaller or two adjacent touch points between coordinate points quantity it is more, the sliding of obtained variable-width
Track is more smooth.
The diameter between two adjacent touch points being had determined based on above-mentioned quantity and front, so that it may determine
The diameter of each coordinate points.For example, if the diameter of the starting point of two adjacent touch points of setting is 1, or according to
The diameter for touching the starting point that speed determines is 1, and the diameter according to the terminal for touching two adjacent touch points that speed determines is
11, there are 9 coordinate points between the two adjacent touch points, then, in the present solution, the diameter of first coordinate points is exactly 2,
The diameter of two coordinate points is 3, and the diameter for the 9th coordinate points that the diameter of third coordinate points is 4 ... ... is 10, i.e., touches at 2
It touches a little, 9 coordinate points between totally 11 points, arrange in arithmetic progression by diameter.It certainly, is in equal differences between touch point and coordinate points
Column arrangement, or only between coordinate points in arithmetic progression arrangement, only one of which makes more smooth one of sliding trace
Kind of mode, when specific implementation, can also be in Geometric Sequence arrangement or other arrangement modes.
It is above-mentioned draw variable-width curve when, if touch speed and lower a pair between upper a pair of two touch points
At ascendant trend between touch speed between two touch points, then curve width is in overstriking trend, if touch speed it
Between it is on a declining curve, then curve width is in narrowing trend.
It should be noted that if given up when obtaining adjacent touch point on contact track to touch point, this
The touch point mentioned in scheme is exactly the touch point after giving up;If do not given up to touch point, the touching mentioned in this programme
Touch all touch points on the contact track a little just sent for touch panel device.
When executing step S400, obtained control point typically just provides directional information, as shown in Fig. 2, being drawn
Bezier out is generally without the two control points P1 and P2.On contact track between the adjacent touch point of every a pair
After having drawn Bezier, the drafting of the corresponding sliding trace of entire contact track is just completed.
Should be noted step S100, S200, S300, all steps in S400 or one of them or it is more
The combination of a step can be completed by touch panel device itself, for example, can by touch panel device processor or
Individual graphics processor of person etc. is completed, can also by the third party device other than touch panel device after the completion of, then by third
Sliding trace after the completion of method, apparatus is sent to touch panel device to show.
Due in touch panel device, generally notified in a manner of touch event corresponding processing software current touch pen or
The location of finger of person people, and then processing software is responded according to position.It is held since felt pen or the finger of people
To the process for showing figure on touch panel device, it is unavoidable that touch panel device generates operating lag for row touch operation.This Shen
Please embodiment in order to shorten the finger of felt pen or people slide time interval between graphical display on the screen, will draw
Good graphics saving is saved in bitmap into bitmap file.Later in graphing, directly adjusted from bitmap file
With the figure, without reruning the rendering algorithm of Bezier to each figure, weaken from touching
Delay sense between display.
Further, the embodiment of the present application opens two buffer areas, is to draw buffer area and display buffer respectively,
After drawing the operation that buffer area completion carries out curve fitting to contact track, the sliding trace generated after fitting is sent to display
Buffer area is shown.Drafting of the thread for Bezier can be individually opened, in such drawing process, is touched
It when the main thread of screen equipment receives other requests, can still be responded, and be unlikely to because of drafting curve and to other
Request is not responding to.
The method that the embodiment of the present application also provides a kind of to generate sliding trace in touch panel device, with above-described embodiment
Unlike, after this method receives the contact track that touch panel device is sent, according to the corresponding touch action in contact occur when
Between sequence, what is successively obtained is four adjacent touch points on contact track;Then according to the position between four selected points
Relationship is set, the control point of Bezier is obtained;It is finally based on obtained control point, it is adjacent to every four successively chosen
The fitting that Bezier is carried out between touch point, generates sliding trace.
Above-described embodiment gets time upper four adjacent points first, for example four points are respectively T0, T1, T2, T3.Point
It is other that this four points are attached, line segment T0T1, T1T2, T2T3 are obtained, calculates the midpoint of line segment T0T1 for M0', in T1T2
Point is M1', and the midpoint of T2T3 is M2', then calculates separately midpoint M0' and M1', M1' and M2', line between M2' and M0'
Length, and calculate separately the ratio between this three sections of wire lengths.The formula of ratio calculated can be with are as follows:
K1=len1/ (len1+len2);
K2=len2/ (len2+len3);
According to ratio k 1, k2 and above-mentioned midpoint M0', M1' and M2' are calculated by the following formula control point Q1 and Q2
Coordinate:
xq1=xm0+(xm1-xm0)*k1;
yq1=ym0+(ym1-ym0)*k1;
xq2=xm1+(xm2-xm1)*k2;
yq2=ym1+(ym2-ym1)*k2;
(xq1, yq1) be control point Q1 coordinate value, can by translate touch point T1 obtain, can also by draw should
The corresponding coordinate points of coordinate value obtain.(xq2, yq2) be control point Q2 coordinate value, can by translate touch point T2 obtain,
It can be obtained by drawing the corresponding coordinate points of the coordinate value.
Based on identical inventive concept, present invention also provides a kind of in touch panel device generates the dress of sliding trace
It sets, including reception and acquiring unit, is sent out for receiving the contact track of touch panel device transmission, and according to the corresponding touch in contact
Raw time sequencing successively obtains two adjacent touch points on contact track;Selection unit, in every two successively chosen
Two points are randomly selected on contact track between a adjacent touch point;Control point acquiring unit, for according to selection unit
The two adjacent touch points successively chosen between two selected points and on two selected points and contact track it
Between positional relationship, obtain two control points of Bezier;Generation unit, for being based on obtained two control points,
It carries out curve fitting between the every two adjacent touch point successively chosen, to generate sliding trace.
Based on identical inventive concept, the embodiment of the present application also provides another kinds to generate sliding rail in touch panel device
The device of mark, the receiving unit including receiving the contact track that touch panel device is sent, the receiving unit are corresponding according to contact
It touches the time sequencing occurred and successively obtains four adjacent touch points on contact track;Control point acquiring unit is used for basis
Positional relationship between four selected points, obtains the control point of Bezier;Generation unit, for based on obtained
Control point, to Bezier fitting is carried out between the every four adjacent touch points successively chosen, to generate sliding trace.
In several embodiments provided herein, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the division of unit,
Only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can be with
In conjunction with or be desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed
Mutual coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING of device or unit or
Communication connection can be electrical property, mechanical or other forms.
Unit may or may not be physically separated as illustrated by the separation member, shown as a unit
Component may or may not be physical unit, it can and it is in one place, or may be distributed over multiple networks
On unit.It can some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit is individually handled, can also be integrated in one unit with two or more units.Above-mentioned integrated unit was both
It can take the form of hardware realization, can also be realized in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at one
In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computer
Equipment (can be personal computer, server or the network equipment etc.) executes the part step of each embodiment method of the present invention
Suddenly.And storage medium above-mentioned include: USB flash disk, mobile hard disk, read-only memory (Read-Only Memory, abbreviation ROM), with
Machine access memory (Random Access Memory, abbreviation RAM), magnetic or disk etc. are various to can store program code
Medium.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used
To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;
And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and
Range.
Claims (15)
1. a kind of method for generating sliding trace in touch panel device, which comprises the following steps:
The contact track that the touch panel device is sent is received, and is successively obtained according to the corresponding time sequencing occurred that touches in contact
Take two adjacent touch points on the contact track;
Two points are randomly selected on contact track between the every two adjacent touch point successively obtained;
According between two selected points and two selected points and successively between two adjacent touch points for obtaining
Positional relationship, obtain two control points of Bezier;
It is quasi- to Bezier is carried out between the every two adjacent touch point successively obtained based on obtained two control points
It closes, to generate sliding trace.
2. the method according to claim 1 for generating sliding trace, which is characterized in that two selected by the correction
Point, the step of to obtain the control point of Bezier are as follows:
Described two adjacent touch points and two selected points are calculated in totally four points, two-by-two between adjacent point in
Point;
The length of line between the midpoint is calculated, and calculates the ratio between the length;
According to the ratio and the midpoint, the position at the control point of Bezier is calculated, translates selected two respectively
A point draws two points to the position or at the location, to obtain the control point of Bezier.
3. the method according to claim 2 for generating sliding trace, which is characterized in that the calculating is described two adjacent
Touch point and two selected points are in totally four points, two-by-two the step of midpoint between adjacent point specifically:
According to the glide direction of the contact track, the starting point of described two adjacent touch points is calculated and close to the starting point
Starting midpoint between selected point, the transition midpoint between two selected points, another selected point with it is described two
Termination midpoint between the terminal of adjacent touch point.
4. the method according to claim 3 for generating sliding trace, which is characterized in that calculate line between the midpoint
The specific steps of length are as follows:
It calculates first length at the starting midpoint and transition midpoint line, the transition midpoint and described terminates midpoint
Second length, and the starting midpoint and the third length for terminating midpoint.
5. the method according to claim 4 for generating sliding trace, which is characterized in that described to calculate between the length
The step of ratio specifically:
The ratio of the sum of first length and first length and second length is calculated, and calculates second length
The ratio of degree and the sum of second length and the third length.
6. the method according to claim 1 for generating sliding trace, which is characterized in that described to be based on obtained control
Point carries out Bezier fitting between described two adjacent touch points, before generating sliding trace further include:
Adjust the control point and described two adjacent the distance between touch points.
7. the method according to claim 1 for generating sliding trace, which is characterized in that also wrapped before generating sliding trace
It includes:
Calculate the length of a curve of sliding trace to be generated;
According to the length, the quantity of the coordinate points on the curve between two adjacent touch points is calculated;
Diameter based on the quantity and described two adjacent touch points, determines the diameter of the coordinate points;
According to the diameter of the coordinate points, Bezier fitting is carried out between described two adjacent touch points, to generate
The sliding trace of variable-width.
8. the method according to claim 7 for generating sliding trace, which is characterized in that the acquisition of the quantity of the coordinate points
Step are as follows:
Coordinate system is established, by the curve mapping of the sliding trace to be generated to the coordinate system;
According to the spacing between the length and preset coordinate points of the sliding trace to be generated, coordinate points on the curve are obtained
Quantity.
9. the method according to claim 7 or 8 for generating sliding trace, which is characterized in that the meter for touching spot diameter
Calculate step are as follows:
Obtain the touch time of touch point;
Calculate the touch time difference of two adjacent touch points;
According to the distance between described two adjacent touch points and the touch time difference, obtain between described two touch points
Touch speed;
It according to the touch speed, determines in two adjacent touch points, touches the diameter of the touch point of time rearward.
10. the method according to claim 9 for generating sliding trace, which is characterized in that described to obtain described two touches
After touch speed between point further include:
According to the touch speed between the upper two neighboring touch point of a pair, and the weighted value of setting, adjust obtained current
Touch speed between two adjacent touch points.
11. the method according to claim 1 for generating sliding trace, which is characterized in that described to be based on obtained control
Point carries out Bezier fitting between described two adjacent touch points, after generating sliding trace further include:
Sliding trace generated is saved in bitmap file;
When sliding trace between adjacent touch point a pair of under drafting, institute's bitmap file is called.
12. the method according to claim 1 for generating sliding trace, which is characterized in that the step for generating sliding trace
Suddenly are as follows:
It carries out curve fitting drawing buffer area to the contact track;
Display buffer is sent by the sliding trace generated after curve matching to show.
13. the method according to claim 1 for generating sliding trace, which is characterized in that two in the acquisition touch track
The step of a adjacent touch point are as follows:
Obtain the coordinate of touch point on the contact track that the touch panel device is sent;
According to the coordinate of acquired touch point, the distance of two adjacent touch points on the contact track is calculated;
If the distance is less than predetermined threshold, give up one of them of described two adjacent touch points, so that not giving up
Touch point and the distance between next touch point be equal to or more than the predetermined threshold.
14. the method according to claim 13 for generating sliding trace, which is characterized in that the setting of the predetermined threshold
Journey are as follows:
Obtain the screen density of touch panel device;
According to the screen density threshold of acquired screen density and setting, the quantity of touch point to be given up is obtained;
According to the quantity of touch point on the quantity of the touch point to be given up and the contact track, obtain on the contact track
The average distance of two neighboring touch point;Using the average distance as the predetermined threshold.
15. a kind of method for generating sliding trace in touch panel device, which comprises the following steps:
The contact track that the touch panel device is sent is received, and is successively obtained according to the corresponding time sequencing occurred that touches in contact
Take four adjacent touch points on the contact track;
According to the positional relationship between four selected points, the control point of Bezier is obtained;
Based on obtained control point, to carrying out Bezier fitting between the every four adjacent touch points successively chosen,
To generate sliding trace.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710478895.3A CN109101171B (en) | 2017-06-21 | 2017-06-21 | Method for generating sliding track in touch screen equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710478895.3A CN109101171B (en) | 2017-06-21 | 2017-06-21 | Method for generating sliding track in touch screen equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109101171A true CN109101171A (en) | 2018-12-28 |
CN109101171B CN109101171B (en) | 2020-12-11 |
Family
ID=64796291
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710478895.3A Active CN109101171B (en) | 2017-06-21 | 2017-06-21 | Method for generating sliding track in touch screen equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109101171B (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111078106A (en) * | 2020-02-26 | 2020-04-28 | 紫光云(南京)数字技术有限公司 | Curve generation method and device applied to touch screen equipment and computer storage medium |
CN111443864A (en) * | 2020-04-14 | 2020-07-24 | 重庆赋比兴科技有限公司 | iOS-based curve drawing method |
CN111949157A (en) * | 2020-07-30 | 2020-11-17 | 通彩视听科技(上海)有限公司 | Simulated writing handwriting processing method, computer equipment and storage medium |
CN112091436A (en) * | 2020-08-27 | 2020-12-18 | 深圳市昆业激光设备科技有限公司 | Laser marking method |
CN112346581A (en) * | 2019-08-07 | 2021-02-09 | 南京中兴新软件有限责任公司 | Method and device for drawing movement track and computer readable storage medium |
CN114241038A (en) * | 2021-10-29 | 2022-03-25 | 惠州高盛达智显科技有限公司 | Touch parameter adjusting method and system based on pattern recognition |
CN114967972A (en) * | 2022-04-27 | 2022-08-30 | 华南理工大学 | Method, system and device for adjusting sampling rate of touch screen and storage medium |
CN115079924A (en) * | 2022-06-29 | 2022-09-20 | 广东明创软件科技有限公司 | Screen display method, device, terminal, storage medium and product |
CN115291789A (en) * | 2022-08-03 | 2022-11-04 | 青岛海信移动通信技术股份有限公司 | Handwriting fitting method and device, terminal equipment and medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102998684A (en) * | 2012-11-21 | 2013-03-27 | 厦门雅迅网络股份有限公司 | Terminal positioning track fitting method based on Bezier curve |
CN103500037A (en) * | 2013-09-11 | 2014-01-08 | 天脉聚源(北京)传媒科技有限公司 | Track smoothing method and device |
CN105190697A (en) * | 2012-12-21 | 2015-12-23 | 思杰***有限公司 | Systems and methods for presenting a free-form drawing |
CN105335069A (en) * | 2014-07-09 | 2016-02-17 | 阿里巴巴集团控股有限公司 | Method and device for generating sliding track in touch screen equipment |
CN105354870A (en) * | 2015-10-21 | 2016-02-24 | 新奥特(北京)视频技术有限公司 | Restoration method and apparatus for drawn track |
-
2017
- 2017-06-21 CN CN201710478895.3A patent/CN109101171B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102998684A (en) * | 2012-11-21 | 2013-03-27 | 厦门雅迅网络股份有限公司 | Terminal positioning track fitting method based on Bezier curve |
CN105190697A (en) * | 2012-12-21 | 2015-12-23 | 思杰***有限公司 | Systems and methods for presenting a free-form drawing |
CN103500037A (en) * | 2013-09-11 | 2014-01-08 | 天脉聚源(北京)传媒科技有限公司 | Track smoothing method and device |
CN105335069A (en) * | 2014-07-09 | 2016-02-17 | 阿里巴巴集团控股有限公司 | Method and device for generating sliding track in touch screen equipment |
CN105354870A (en) * | 2015-10-21 | 2016-02-24 | 新奥特(北京)视频技术有限公司 | Restoration method and apparatus for drawn track |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112346581A (en) * | 2019-08-07 | 2021-02-09 | 南京中兴新软件有限责任公司 | Method and device for drawing movement track and computer readable storage medium |
CN111078106A (en) * | 2020-02-26 | 2020-04-28 | 紫光云(南京)数字技术有限公司 | Curve generation method and device applied to touch screen equipment and computer storage medium |
CN111443864A (en) * | 2020-04-14 | 2020-07-24 | 重庆赋比兴科技有限公司 | iOS-based curve drawing method |
CN111443864B (en) * | 2020-04-14 | 2023-03-07 | 重庆赋比兴科技有限公司 | iOS-based curve drawing method |
CN111949157A (en) * | 2020-07-30 | 2020-11-17 | 通彩视听科技(上海)有限公司 | Simulated writing handwriting processing method, computer equipment and storage medium |
CN111949157B (en) * | 2020-07-30 | 2024-07-19 | 通彩视听科技(上海)有限公司 | Method for processing simulated writing, computer equipment and storage medium |
CN112091436A (en) * | 2020-08-27 | 2020-12-18 | 深圳市昆业激光设备科技有限公司 | Laser marking method |
CN114241038A (en) * | 2021-10-29 | 2022-03-25 | 惠州高盛达智显科技有限公司 | Touch parameter adjusting method and system based on pattern recognition |
CN114967972A (en) * | 2022-04-27 | 2022-08-30 | 华南理工大学 | Method, system and device for adjusting sampling rate of touch screen and storage medium |
CN115079924A (en) * | 2022-06-29 | 2022-09-20 | 广东明创软件科技有限公司 | Screen display method, device, terminal, storage medium and product |
CN115291789A (en) * | 2022-08-03 | 2022-11-04 | 青岛海信移动通信技术股份有限公司 | Handwriting fitting method and device, terminal equipment and medium |
CN115291789B (en) * | 2022-08-03 | 2024-04-26 | 青岛海信移动通信技术有限公司 | Handwriting fitting method, handwriting fitting device, terminal equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN109101171B (en) | 2020-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109101171A (en) | A method of generating sliding trace in touch panel device | |
CN107526526B (en) | Method and device for determining pressure-sensitive handwriting area | |
JP2019512118A (en) | Method and system for generating and selectively outputting two types of ink vector data | |
WO2020211438A1 (en) | Graphic processing method, apparatus, and device based on writing trajectory, and storage medium | |
JP2017529623A (en) | Wet ink predictor | |
CN102103761B (en) | Method for realizing original handwriting | |
CN107943365B (en) | Line handwriting presenting method and device, electronic equipment and storage medium | |
WO2011044677A1 (en) | Method and apparatus for drawing and erasing calligraphic ink objects on a display surface | |
KR20130066511A (en) | Method and apparatus for calligraphic beautification of handwritten characters | |
KR20170054519A (en) | Smoothing and gpu-enabled rendering of digital ink | |
CN106951132B (en) | The report point of capacitive touch screen determines method, apparatus, touch screen and terminal | |
CN103500037A (en) | Track smoothing method and device | |
CN112905102A (en) | Method and device for realizing writing tip, electronic equipment and readable storage medium | |
CN105074780B (en) | System and method for interactive image caricature generation by an electronic device | |
CN113626903B (en) | Road curve setting method and device, electronic equipment and storage medium | |
CN107957847A (en) | Touch track display method, device, equipment and storage medium | |
CN113342208A (en) | Railway line selection method based on multi-point touch equipment, terminal and storage medium | |
CN111124242B (en) | Function key display method and device, electronic equipment and storage medium | |
CN102103762B (en) | Method for realizing original handwriting | |
CN106201314A (en) | A kind of display packing realizing handwriting input on touch screen and display device | |
CN117234402A (en) | Writing method of electronic whiteboard, electronic equipment and storage medium | |
CN108694006B (en) | Method and device for achieving icon wheel-imitating rolling effect | |
CN115984513A (en) | Integrating two-dimensional input devices into three-dimensional computing environments | |
US10915185B2 (en) | Generating a three-dimensional image using tilt angle of a digital pen | |
WO2021218448A1 (en) | Handwriting forming method and apparatus, and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |