Disclosure of Invention
An object of the embodiments of the present application is to provide a touch-control handwriting generating method and device based on a touch screen, which can adjust according to a touch switch adjustment request of the touch screen, thereby avoiding a problem of synchronous failure of touch-control handwriting during a screen projection process, and further solving a problem of redundant data accumulation of screen projection equipment.
A first aspect of the embodiments of the present application provides a touch handwriting generating method based on a touch screen, including:
generating a touch state according to the received touch instruction;
judging whether a touch switch adjustment request is received or not;
when the touch switch adjustment request is received, coding the touch state according to the touch switch adjustment request to obtain a coding result;
and generating touch handwriting in the touch screen according to the coding result.
In the implementation process, the method can be used in a touch television which is performing PC screen projection work, so that a touch instruction received by a touch screen of the touch television is converted into a touch state, and the touch state is coded according to the actual switching condition of a touch switch; and after the touch television encodes the touch instruction to obtain an encoding result, generating touch handwriting according to the encoding result. Therefore, by implementing the implementation mode, the touch note can be accurately and effectively generated in the electronic equipment (such as the PC) for screen projection, and meanwhile, the generation of wrong touch state records due to the change of the touch switch state of the touch television is avoided, so that the touch state records are prevented from being recorded in the electronic equipment for screen projection, the redundant data of the type is prevented from appearing in the electronic equipment, and the stability and the accuracy of the touch operation logic of the electronic equipment are ensured.
Further, before the step of generating the touch handwriting in the touch screen according to the encoding result, the method further includes:
and when the touch switch adjustment request is not received, coding is carried out according to the touch state to obtain a coding result.
Further, after the step of encoding according to the touch state to obtain an encoding result, the method further includes:
judging whether the state of the touch switch is an open state or not;
when the touch switch is in an open state, generating touch handwriting in the touch screen according to an encoding result; updating the state of the touch switch according to the touch switch adjustment request;
and when the touch switch state is the closed state, executing the step of updating the touch switch state according to the touch switch adjustment request.
Further, when the touch switch adjustment request is received, the step of coding the touch state according to the touch switch adjustment request to obtain a coding result includes:
when the touch switch adjustment request is received, judging whether the touch switch adjustment request is a touch switch opening request;
when the touch switch adjustment request is a touch switch opening request, matching a first code corresponding table corresponding to the touch switch opening request;
and coding the touch state according to the first coding correspondence table to obtain a coding result.
Further, when the touch switch adjustment request is received, the step of coding the touch state according to the touch switch adjustment request to obtain a coding result includes:
when the touch switch adjustment request is received, judging whether the touch switch adjustment request is a touch switch closing request;
when the touch switch adjustment request is a touch switch closing request, matching a second code corresponding table corresponding to the touch switch closing request;
and coding the touch state according to the second coding correspondence table to obtain a coding result.
Further, the step of generating the touch handwriting in the touch screen according to the coding result comprises:
and generating touch handwriting in the next frame of picture of the touch screen according to the coding result.
A second aspect of the embodiments of the present application provides a touch-control handwriting generating device based on a touch screen, where the touch-control handwriting generating device based on the touch screen includes:
the touch control unit is used for generating a touch control state according to the received touch control instruction;
the first judgment unit is used for judging whether a touch switch adjustment request is received or not;
the coding unit is used for coding the touch control state according to the touch control switch adjustment request to obtain a coding result when the touch control switch adjustment request is received;
and the handwriting generating unit is used for generating touch handwriting in the touch screen according to the coding result.
In the implementation process, the device can ensure that the touch note is accurately and effectively generated in the electronic equipment (such as the PC) for screen projection, and meanwhile, the generation of wrong touch state record due to the change of the touch switch state of the touch television is avoided, so that the touch state record is prevented from being recorded in the electronic equipment for screen projection, the redundant data of the type is prevented from being generated in the electronic equipment, and the touch operation logic of the electronic equipment is ensured to be stable and accurate.
Further, the handwriting generating unit is specifically configured to generate a touch handwriting in a next frame of picture of the touch screen according to the encoding result.
A third aspect of the embodiments of the present application provides an electronic device, including a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the method for generating touch handwriting based on a touch screen according to any one of the first aspect of the embodiments of the present application.
A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, which stores computer program instructions, where the computer program instructions, when read and executed by a processor, perform the method for generating touch handwriting based on a touch screen according to any one of the first aspect of the embodiments of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
Referring to fig. 5, fig. 5 shows a schematic diagram of a touch data stream.
In an interactive smart tablet all-in-one machine (such as a touch television, a smart television, a flat-panel only machine and the like), two (or more) output channels are generally provided. Wherein, each output channel is connected with a host system. For example, as shown in FIG. 5, channel A connects to an android host and channel B connects to a PC host. The android host is the touch television described in the application, and the touch screen of the android host is the touch screen described in the application.
On the basis of fig. 5, in the conventional method, when only the interface image of the android host is displayed on the screen display interface of the android host, the channel controller controls the touch device to close the touch data of the channel B, so that the PC host is prevented from still responding to the touch data when no interface image is output.
On the basis of fig. 5, in the conventional method, the interface image of the PC host is mainly displayed on the screen display interface of the android host, and a part of the interface image of the android host is superimposed on the upper layer. When a user operates the android image superposed on the upper layer through the touch screen, the channel controller immediately closes the channel B output of the touch screen.
This may result in that, when the touch screen receives the closing instruction, the touch screen directly closes the switch of the corresponding channel, and the touch data of the corresponding channel is no longer output. After the touch screen receives the opening instruction, the touch screen directly opens the switch of the corresponding channel, the touch data of the corresponding channel are output in the next frame, and the touch data are output according to the current actual touch state.
Therefore, when the touch data of the channel B is closed, the touch still does not leave the touch screen, and therefore the PC host does not respond to the lift-off data after the closing. Resulting in a logical disorder of the touch operation of the host PC. When the touch data of the channel B is turned on again, the touch is already in the response range of the touch screen, so that the PC host does not respond when the previous falling data is turned off. Resulting in delay of touch operation of the PC host at this time or confusion of operation logic of the lamp if the operation is unsuccessful.
As in the case of the following table, the PC responds to only one click during two touch clicks, and the click operation presents a delay.
The states shown in the table above are states in response to an exception.
Here, "↓" is used to indicate falling of the touch, "-" is used to indicate panning of the touch, "# 97" is used to indicate lifting of the touch, and "# is used to indicate no data.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Example 1
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a touch handwriting generating method based on a touch screen according to an embodiment of the present application. The touch handwriting generating method based on the touch screen comprises the following steps:
and S101, generating a touch state according to the received touch instruction.
S102, judging whether a touch switch adjustment request is received, if so, executing steps S103-S104; if not, the flow is ended.
S103, coding the touch state according to the touch switch adjustment request to obtain a coding result.
And S104, generating touch handwriting in the touch screen according to the coding result.
In the embodiment of the present application, the execution subject of the method may be a computing device such as a computer and a server, and is not limited in this embodiment.
In this embodiment, an execution subject of the method may also be an intelligent device such as a smart phone and a tablet computer, which is not limited in this embodiment.
It can be seen that, the touch handwriting generating method based on the touch screen described in this embodiment can be used in a touch television which is performing PC screen projection work, so that a touch instruction received by the touch screen of the touch television is converted into a touch state, and the touch state is encoded according to an actual switching condition of a touch switch; and after the touch television encodes the touch instruction to obtain an encoding result, generating touch handwriting according to the encoding result. Therefore, by implementing the implementation mode, the touch note can be accurately and effectively generated in the electronic equipment (such as the PC) for screen projection, and meanwhile, the generation of wrong touch state records due to the change of the touch switch state of the touch television is avoided, so that the touch state records are prevented from being recorded in the electronic equipment for screen projection, the redundant data of the type is prevented from appearing in the electronic equipment, and the stability and the accuracy of the touch operation logic of the electronic equipment are ensured.
Example 2
Please refer to fig. 2, and fig. 2 is a schematic flowchart of a touch handwriting generating method based on a touch screen according to an embodiment of the present application. As shown in fig. 2, the method for generating touch handwriting based on a touch screen includes:
s201, generating a touch state according to the received touch instruction.
S202, judging whether a touch switch adjustment request is received or not, if so, executing a step S203; if not, the steps S207 to S208 are executed.
In this embodiment, the request for changing the channel output switch sent to the touch device may be other devices outside the touch device or other functions inside the touch device.
S203, judging whether the touch switch adjustment request is a touch switch opening request, if so, executing a step S204; if not, go to step S205.
S204, matching a first code corresponding table corresponding to the touch switch opening request; and coding the touch state according to the first coding correspondence table to obtain a coding result. And executing steps S209 to S210.
In this embodiment, when the touch switch adjustment request is a touch switch turn-on request, the touch state is encoded according to the following first encoding mapping table to obtain an encoding result. The following table is a first encoding correspondence table.
S205, judging whether the touch switch adjustment request is a touch switch closing request, if so, executing a step S206; if not, the flow is ended.
S206, matching a second code corresponding table corresponding to the touch switch closing request; and coding the touch state according to the second coding correspondence table to obtain a coding result. And executing steps S209 to S210.
In this embodiment, when the touch switch adjustment request is a touch switch closing request, the touch state is encoded according to the following second encoding mapping table to obtain an encoding result. The following table is a second encoding correspondence table.
In this embodiment, the second encoding correspondence table may also be a following table.
In this embodiment, a second encoding lookup table is used. And after receiving the touch switch request, immediately coding the touch state of the current frame according to the coding corresponding relation of the following table, and sending a frame of coding result in the corresponding channel. Rather than recording its request and waiting for the next frame to be output.
And S207, coding according to the touch state to obtain a coding result.
In this embodiment, when the touch switch adjustment request is not received, the encoding is directly performed according to the touch state, and an encoding result is obtained.
S208, judging whether the state of the touch switch is an open state, if so, executing steps S209-S210; if not, go to step S210.
And S209, generating touch handwriting in the next frame of picture of the touch screen according to the coding result.
By implementing the implementation mode, the touch switch adjustment request and the touch switch state of each touch data channel can be recorded. When the touch screen receives that a certain channel needs to be closed or opened, the on-off state of the channel is not changed immediately, and the touch switch adjustment request is recorded. And generating touch handwriting after the touch detection of the next frame is finished.
And S210, updating the state of the touch switch according to the touch switch adjustment request.
In this embodiment, as shown in the following table, in the 1 st touch process (from the 1 st frame to the 5 th frame), the 3 rd frame receives the request for turning off the channel controller. At this time, the touch device only records the request, and if the 3 rd frame of touch data is output, the 4 th frame encodes the "-" touch state into the "×) output state for output. At this time, the PC can correctly respond to the lifting state and complete one click without delay and abnormity.
As shown in the following table, during the 2 nd touch (from the 7 th frame to the 11 th frame), a channel controller open request is received at the 8 th frame. At this time, the touch device only records the request, and if the 8 th frame of touch data is already output, the "-" touch state is encoded into the "↓" output state at the 9 th frame and output. At this time, the PC can correctly respond to the falling state and complete one click without delay and abnormity.
The following table is a modified condition response comparison table. The comparison may be made with reference to the first table in this embodiment.
It can be seen that, by implementing the method for generating touch handwriting based on a touch screen described in this embodiment, it can be ensured that a touch note is accurately and effectively generated in an electronic device (such as the PC) for screen projection, and meanwhile, an erroneous touch state record is prevented from being generated due to a change in a state of a touch switch of a touch television, so that the touch state record is prevented from being recorded in the electronic device for screen projection, and further, such redundant data is prevented from appearing in the electronic device, and the touch operation logic of the electronic device is ensured to be stable and accurate.
Example 3
Please refer to fig. 3, fig. 3 is a schematic structural diagram of a touch handwriting generating device based on a touch screen according to an embodiment of the present application. As shown in fig. 3, the touch handwriting generating device based on the touch screen includes:
a touch unit 310, configured to generate a touch state according to a received touch instruction;
a first determining unit 320, configured to determine whether a touch switch adjustment request is received;
the encoding unit 330 is configured to, when receiving a touch switch adjustment request, encode a touch state according to the touch switch adjustment request to obtain an encoding result;
and the handwriting generating unit 340 is configured to generate a touch handwriting in the touch screen according to the encoding result.
In the embodiment of the present application, for explanation of a touch-control handwriting generating device based on a touch screen, reference may be made to the description in embodiment 1 or embodiment 2, and details are not repeated in this embodiment.
It can be seen that, by implementing the touch-control handwriting generating device based on a touch-control screen described in this embodiment, it can be ensured that a touch-control note is accurately and effectively generated in an electronic device (such as the PC) for screen projection, and meanwhile, it is avoided that an erroneous touch-control state record is generated due to a change in the state of a touch switch of a touch-control television, so that the touch-control state record is prevented from being recorded in the electronic device for screen projection, and further, such redundant data is prevented from appearing in the electronic device, and it is ensured that the touch-control operation logic of the electronic device is stable and accurate.
Example 4
Referring to fig. 4, fig. 4 is a schematic structural diagram of a touch trace generating device based on a touch screen according to an embodiment of the present disclosure. The touch-control-screen-based touch-control-handwriting generating device shown in fig. 4 is obtained by optimizing the touch-control-screen-based touch-control-handwriting generating device shown in fig. 3. As shown in fig. 4, the encoding unit 330 is further configured to perform encoding according to the touch state to obtain an encoding result when the touch switch adjustment request is not received.
As an optional implementation manner, the touch-writing generating apparatus further includes:
a second determining unit 350, configured to determine whether the touch switch is in an on state;
the handwriting generating unit 340 is specifically configured to generate a touch handwriting in the touch screen according to the encoding result when the touch switch is in the on state.
A state updating unit 360, configured to update the state of the touch switch according to the touch switch adjustment request after the touch handwriting is generated;
the state updating unit 360 is further configured to update the state of the touch switch according to the touch switch adjustment request when the state of the touch switch is an off state.
As an alternative embodiment, the encoding unit 330 includes:
the first sub-unit 331, configured to determine whether the touch switch adjustment request is a touch switch turn-on request when the touch switch adjustment request is received;
a second subunit 332, configured to, when the touch switch adjustment request is a touch switch turn-on request, match a first code correspondence table corresponding to the touch switch turn-on request;
the third subunit 333 is configured to encode the touch state according to the first encoding correspondence table to obtain an encoding result.
As an alternative embodiment, the encoding unit 330 includes:
the first sub-unit 331 is further configured to, when receiving the touch switch adjustment request, determine whether the touch switch adjustment request is a touch switch turn-off request;
the second sub-unit 332 is further configured to, when the touch switch adjustment request is a touch switch turn-off request, match a second code mapping table corresponding to the touch switch turn-off request;
the third subunit 333 is further configured to encode the touch state according to the second encoding correspondence table to obtain an encoding result.
As an optional implementation manner, the handwriting generating unit 340 is specifically configured to generate a touch handwriting in a next frame of picture of the touch screen according to the encoding result.
In the embodiment of the present application, for explanation of a touch-control handwriting generating device based on a touch screen, reference may be made to the description in embodiment 1 or embodiment 2, and details are not repeated in this embodiment.
It can be seen that, by implementing the touch-control handwriting generating device based on a touch-control screen described in this embodiment, it can be ensured that a touch-control note is accurately and effectively generated in an electronic device (such as the PC) for screen projection, and meanwhile, it is avoided that an erroneous touch-control state record is generated due to a change in the state of a touch switch of a touch-control television, so that the touch-control state record is prevented from being recorded in the electronic device for screen projection, and further, such redundant data is prevented from appearing in the electronic device, and it is ensured that the touch-control operation logic of the electronic device is stable and accurate.
The embodiment of the application provides electronic equipment, which comprises a memory and a processor, wherein the memory is used for storing a computer program, and the processor runs the computer program to enable the electronic equipment to execute the touch handwriting generating method based on a touch screen in any one of embodiment 1 or embodiment 2 of the application.
The embodiment of the present application provides a computer-readable storage medium, which stores computer program instructions, and when the computer program instructions are read and executed by a processor, the method for generating touch handwriting based on a touch screen according to any one of embodiment 1 or embodiment 2 of the present application is executed.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.