A method for implementing gesture sliding screen based on embedded Linux

By building a linked list data structure and canvas on embedded Linux devices, combining gesture sliding operation and preset display strategies, the problem of difficult for the device to quickly locate target data when displaying a large amount of data is solved, an efficient interactive interface is achieved, and the user experience is improved.

CN119576203BActive Publication Date: 2025-05-23BEIJING PINGZHI ORIENTAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510115023.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-05-23
Estimated Expiration
2045-01-24

AI Technical Summary

Technical Problem

When embedded Linux devices display exceeding the maximum display data volume on the display screen, it is difficult to quickly locate the target data location. Due to hardware resource limitations, it is not suitable for running a graphical user interface that occupies large system resources, resulting in stuttering and slow buffering of the user interface.

Method used

By building a linked list data structure and canvas between the application layer and the FrameBuffer driver and the touch screen driver, gesture sliding operation is realized, and preset display strategies and frame timers are used to optimize data reading and writing, and improve the response speed of the interactive interface.

Benefits of technology

Without increasing hardware costs, a graphical interface similar to gesture sliding control in the mobile phone is realized, which improves the flexibility of embedded device control and the speed of target content positioning, avoids problems such as lag and slow buffering, and significantly improves the user interface interaction experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576203B_ABST
    Figure CN119576203B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, electronic device and storage medium for implementing gesture sliding screen based on embedded Linux, the method comprising monitoring gesture sliding screen events, and calculating the sliding direction and sliding speed of the gesture sliding screen according to the continuously changing touch point coordinates in the gesture sliding screen events; selecting a display strategy corresponding to the calculated sliding speed from multiple preset display strategies according to the sliding speed; after each overflow of the frame grabbing timer started during gesture sliding, a frame of data is obtained from the canvas according to the sliding direction and the current canvas reading position and the display strategy and written into FrameBuffer, and the current canvas reading position is recorded and refreshed on the display list of the display window, and the frame grabbing is stopped when the frame grabbing stop condition is reached. The present invention realizes a graphical interface similar to the gesture sliding control in a mobile phone on the embedded system interaction interface without increasing the hardware cost, thereby improving the flexibility and speed of embedded device control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of embedded Linux, and in particular to a method, electronic device and storage medium for implementing gesture screen sliding based on embedded Linux. Background Art

[0002] Linux embedded systems are widely used in electronic products in the industrial and consumer fields because of their open source, streamlined and efficient, stable, customizable and low power consumption. At present, when embedded Linux devices display data that exceeds the maximum display amount of the display screen, they all use hard keys or soft keys on the interactive interface to turn pages. The data search speed is slow and it is difficult to quickly locate the target data location.

[0003] The graphical user interface can realize the operation interface of the installed equipment through gesture control, and the continuous movement and selection of the data displayed on the display screen can be realized through gestures such as sliding and clicking. The graphical user interface can not only improve the user experience, but also has flexible operation. In particular, the display window display content can be controlled by sliding gestures, and it can quickly locate the target content position compared to turning pages with buttons.

[0004] However, due to the hardware resource limitations of the Linux embedded system itself, these electronic products are not suitable for running functional software that takes up a lot of system resources, such as complex graphical user interfaces. When running large graphical user interface software, it will bring huge overhead to the low-power embedded system. Without increasing hardware costs (such as increasing memory, increasing CPU frequency, etc.), it will cause user interface operation jams and slow buffering, resulting in a very poor user experience.

[0005] Therefore, it is crucial to implement a graphical interface similar to the gesture sliding control in mobile phones on the interactive interface of the embedded system without introducing the overhead brought by a large-scale graphics system that consumes huge resources. Summary of the invention

[0006] In order to realize a graphical interface similar to the gesture sliding control in a mobile phone on the interactive interface of an embedded system without increasing huge expenses, an embodiment of the present invention provides a method, an electronic device and a storage medium for realizing gesture sliding based on embedded Linux.

[0007] The specific technical solutions are as follows:

[0008] In a first aspect, an embodiment of the present invention provides a method for implementing gesture screen sliding based on embedded Linux, comprising the following steps:

[0009] Creating a linked list data structure according to the number of rows and columns of the target data and applying for a piece of memory as a canvas according to the number of columns of the target data and the display list style of the screen; wherein the display list style at least includes the number of rows, the number of columns, the row height in pixels, and the column width in pixels of the display list;

[0010] Obtain target data from the application layer, and store each row of target data into a row node corresponding to the linked list data structure in sequence starting from the start position of the linked list data structure in accordance with the row order of the target data, and store each column of data of each row of target data into a cell node corresponding to the row node in accordance with the column order of the target data;

[0011] According to the received target data opening request, the canvas target data is drawn to the canvas from the starting position of the linked list data structure to complete the initialization of the canvas target data, and the current linked list reading position is recorded;

[0012] Reading a frame of data from the start position of the canvas and copying it to the FrameBuffer, refreshing the display list on the screen and recording the current canvas reading position; wherein the frame of data is the canvas data used to fill up all the FrameBuffer; the current canvas reading position includes the number of rows and columns read by the current canvas;

[0013] Monitor the gesture sliding screen event, and calculate the sliding direction and sliding speed of the gesture sliding screen according to the continuously changing touch point coordinates in the gesture sliding screen event;

[0014] Selecting a display strategy corresponding to the current sliding speed from a plurality of preset display strategies according to the sliding speed; wherein the display strategy includes a step distance; the step distance is the number of pixel rows or columns of newly added data in a frame of data written to the graphics card FrameBuffer for display each time compared with the previous time;

[0015] After the frame fetching timer started when the gesture slides overflows, a frame of data is obtained from the canvas and written into the FrameBuffer according to the sliding direction, the current canvas reading position and the display strategy, and the current canvas reading position is recorded and refreshed on the display list of the display window until the frame fetching stop condition is reached and the frame fetching stops.

[0016] Optionally, the linked list data structure is created according to the number of rows and columns of the target data; the number of rows of the created linked list data structure is equal to the number of rows of the target data, the number of cells in each row is equal to the number of columns of the target data, and each row is a row node, and two adjacent row nodes are bidirectionally linked; each row includes a plurality of cell nodes, and two adjacent cell nodes in each row are bidirectionally linked;

[0017] A piece of memory is applied for as a canvas according to the number of columns of the target data and the display list style of the screen, the row height of each row in the canvas is equal to the row height pixel of the display list, and the column width of each column in the canvas is equal to the column width pixel of the display list; the width of the canvas is equal to the number of columns of the target data multiplied by the column width pixel of the display list, the height of the canvas is at least equal to the pixel height of the display list, and the canvas is provided with a boundary marker for identifying the boundary of the canvas; the boundary marker includes the top and / or bottom boundary markers of the canvas and the left and / or right boundary markers of the canvas.

[0018] Optionally, upon receiving a request to open the target data, the canvas target data is initialized by drawing the data to the canvas from the starting position of the linked list data structure, and the current linked list reading position is recorded, specifically:

[0019] According to the received target data opening request, the data of each row node is read sequentially from the starting position of the linked list data structure, and the data of each cell node in the read row node is filled and drawn sequentially from the starting position of the canvas to the corresponding pixel coordinate position of the canvas, the initialization of the canvas target data is completed, and the current linked list reading position of the linked list data structure is recorded; wherein the data in each cell node of the read row node includes text information and picture information;

[0020] Filling and drawing the text information to the corresponding pixel coordinate position of the canvas is to read the font information from the corresponding font library according to the set font, calculate the pixel coordinate position in the canvas, and fill the corresponding pixel coordinate position one by one in the canvas memory in the form of pixel points;

[0021] Drawing the image information to the corresponding pixel coordinate position of the canvas is to read the image storage path information from the cell, open the image file, obtain the BMP bitmap data, and fill it in the corresponding pixel coordinate position of the canvas.

[0022] Optionally, monitoring the screen sliding gesture event and calculating the sliding direction and sliding speed of the screen sliding gesture according to the continuously changing touch point coordinates in the screen sliding gesture event includes the following steps:

[0023] Take three continuously changing touch sampling point coordinates from the gesture sliding event and record the clock tick of each sampling point;

[0024] According to the x and y coordinates of the three sampling points, calculate the displacements of the three sampling points in the x and y directions;

[0025] Determine the sliding direction based on the displacement size and coordinates;

[0026] The sliding speed of the gesture screen sliding is calculated based on the calculated displacement, sliding direction, and time information recorded by the clock tick of each sampling point.

[0027] Optionally, the frame fetching stop condition includes:

[0028] The number of frames written to FrameBuffer by this gesture sliding reaches the preset total number of frames that need to be displayed;

[0029] Detecting the end mark of the target data; and

[0030] The left or right boundary marker is detected.

[0031] Optionally, the canvas includes multiple sub-canvases, and a starting sub-canvas and a preset sub-canvas order are set, and the three sub-canvases are used alternately in a cyclic manner according to the preset canvas order; each sub-canvas includes a boundary identifier for identifying the boundary of the sub-canvas; when the canvas includes three sub-canvases, the initialization of the canvas target data is completed when the starting sub-canvas is filled.

[0032] Optionally, acquiring a frame of data from the canvas and writing it into FrameBuffer according to the sliding direction, the current canvas reading position, and the display strategy includes:

[0033] When the sliding direction is upward or downward, judging whether the remaining data height of the current sub-canvas is enough for a frame of data pixel height according to the stepping distance of the display strategy and the current canvas reading position;

[0034] If yes, directly get a frame of data and write it into FrameBuffer;

[0035] Otherwise, determine whether the end mark of the target data is detected. If the end mark is detected, obtain the last frame of data by reducing the current step distance and write it into FrameBuffer; otherwise, read the remaining data from the current sub-canvas, and then read new data from the linked list data structure according to the sliding direction and the current linked list reading position and draw it to the next sub-canvas, while recording the previous linked list reading position, and then read data from the starting position of the next sub-canvas to make up a frame of data and write it into FrameBuffer;

[0036] Optionally, when the number of frames written into the FrameBuffer is short of a preset number of frames to reach a preset total number of frames to be displayed, the stepping distance is reduced by a preset distance each time a frame of data is taken.

[0037] In a second aspect, an embodiment of the present invention further provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0038] Memory, used to store computer programs;

[0039] The processor is used to implement the steps of the method for implementing gesture screen sliding based on embedded Linux as described in the first aspect when executing the program stored in the memory.

[0040] In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the method steps for implementing gesture sliding based on embedded Linux described in the first aspect are implemented.

[0041] The embodiment of the present invention provides a method, electronic device and storage medium for implementing gesture sliding screen based on embedded Linux. A linked list data structure and a canvas are constructed between the application layer and the FrameBuffer driver and the touch screen driver according to the display list style and the target data style. By constructing the linked list data structure, the canvas and the data reading and writing of the FrameBuffer on the Linux system, a graphical interface similar to the gesture sliding control in a mobile phone is implemented on the interactive interface of the embedded system without introducing the overhead brought by a large-scale graphics system with huge resource consumption and without increasing the hardware cost (such as increasing the memory, improving the CPU frequency, etc.), thereby improving the flexibility of embedded device control and the speed of target content positioning without problems such as freezes and slow buffering, and effectively improving the user interface interaction experience.

[0042] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.

[0043] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0045] Figure 1 A flowchart of a method for implementing gesture screen sliding based on embedded Linux provided by an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of the structure of a linked list data structure in an embodiment of the present invention;

[0047] Figure 3 A schematic diagram of a flow chart of step S400 in an embodiment of the present invention;

[0048] Figure 4 It is a schematic diagram of the structure relationship between the linked list data structure and the sub-canvases and FrameBuffer when there are three sub-canvases in an embodiment of the present invention;

[0049] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0051] like Figure 1 As shown, the embodiment of the present application provides a method for implementing gesture screen sliding based on embedded Linux, and the method includes the following steps:

[0052] Step S100, create a linked list data structure according to the number of rows and columns of the target data (for example, M rows and N columns), and apply for a piece of memory as a canvas according to the number of columns of the target data and the user's display list style requirements for the device screen display window (the function of the canvas is to preload the text and image content to be displayed in the memory in the form of pixels). Among them, the number of rows of the linked list data structure is equal to the number of rows of the target data, the number of cells in each row is equal to the number of columns of the target data, and each row is a row node, and two adjacent row nodes are bidirectionally linked; the cell node of each row is used to store the text or image information to be displayed, and two adjacent cell nodes in each row are bidirectionally linked, such as Figure 2 As shown; the style of the display list includes at least the number of rows, columns, row height pixels and column width pixels of the display list; the row height of each row in the canvas is equal to the row height pixels of the display list, and the column width of each column in the canvas is equal to the column width pixels of the display list; the width of the canvas is equal to the number of columns of the target data multiplied by the column width pixels of the display list, and the height of the canvas is at least equal to the pixel height of the display list, that is, at least equal to the number of rows of the display list multiplied by the row height pixels of the display list; the canvas is provided with a boundary marker for identifying the boundary of the canvas; the boundary marker includes the top and / or bottom boundary markers of the canvas and the left and / or right boundary markers of the canvas.

[0053] Step S200, obtain the target data from the application layer, and store each row of target data into the corresponding row node in sequence starting from the starting position of the linked list data structure in accordance with the row order of the target data, and store each column of data of each row of target data into the cell node of the corresponding row node in accordance with the column order of the target data, that is, the target data and the linked list data structure have a one-to-one correspondence between rows and columns.

[0054] Step S300, according to the received request to open the target data, the canvas target data is drawn to the canvas from the starting position of the linked list data structure to complete the initialization of the canvas target data, and the current linked list reading position is recorded; then, starting from the starting position of the canvas, a frame of data is read and copied to the FrameBuffer driver for refresh display, and the current canvas reading position is recorded to complete the content initialization of the display list of the display window; wherein, a frame of data is a frame of canvas data used to fill all the FrameBuffer, that is, the data of the pixel space occupied by all rows and columns of the display list; the current canvas reading position includes the number of rows and columns read by the current canvas.

[0055] In this embodiment, upon receiving a request to open the target data, the canvas target data is initialized starting from the starting position of the linked list data structure and the current linked list reading position is recorded, specifically:

[0056] According to the received request to open the target data, the data of each row node is read in sequence from the starting position of the linked list data structure, and the data in each cell node of the read row node is filled and drawn from the starting position of the canvas to the corresponding pixel coordinate position of the canvas, completing the initialization of the canvas target data, and recording the current linked list reading position of the linked list data structure. Among them, the data in each cell node of the read row node includes text information and image information; filling and drawing the text information to the corresponding pixel coordinate position of the canvas is to read the font information from the corresponding font library according to the set font, calculate the pixel coordinate position in the canvas, and fill it one by one in the canvas memory in the form of pixel points to the corresponding pixel coordinate position; drawing the image information to the corresponding pixel coordinate position of the canvas is to read the image storage path information from the cell, open the image file, obtain the BMP bitmap data, and fill it in the corresponding pixel coordinate position of the canvas.

[0057] Step S400: monitor the screen sliding gesture event, and calculate the sliding direction and sliding speed of the screen sliding gesture according to the continuously changing touch point coordinates in the screen sliding gesture event. Figure 3 As shown, step S400 includes the following steps:

[0058] Step S401: Take three continuously changing touch sampling point coordinates from the gesture sliding screen event, and record the clock tick (millisecond level) of each sampling point;

[0059] Step S402, calculating the displacements of the three sampling points in the x and y directions according to the x and y coordinates (x1, y1), (x2, y2), and (x3, y3) of the three sampling points;

[0060] Step S403, determine the sliding direction according to the displacement size and coordinates; for example, if the displacement in the y direction is greater than the x direction, the sliding direction of the gesture screen sliding is determined to be up and down sliding. If y3 is greater than y1, the direction is determined to be downward, otherwise the direction is determined to be upward. If the displacement in the x direction is greater than the y direction, the sliding direction of the gesture screen sliding is determined to be left and right sliding. If x3 is greater than x1, the direction is determined to be right, otherwise the direction is determined to be left. It should be noted that the origin of the screen coordinates is the upper left corner;

[0061] Step S404: Calculate the sliding speed of the gesture sliding screen according to the calculated displacement, sliding direction, and time information recorded by the clock tick of each sampling point.

[0062] Step S500: Select a display strategy corresponding to the calculated sliding speed from a plurality of preset display strategies according to the sliding speed; wherein the display strategy includes a step distance; the step distance is the pixel points (newly added row pixel points or column pixel points) of the newly added data in a frame of data written to the graphics card FrameBuffer for display each time compared with the previous one; in the embodiment of the present application, in order to be closer to the sliding screen effect, the preset plurality of display strategies meet the following requirements:

[0063] The faster the gesture slides, the larger the step distance; conversely, the slower the gesture slides, the smaller the step distance.

[0064] Step S600, after each overflow of the frame fetching timer started when the gesture slides, a frame of data is obtained from the canvas and written into the FrameBuffer according to the gesture sliding direction, the current canvas reading position and the display strategy, and the current canvas reading position is recorded and refreshed on the display list of the display window until the frame fetching stop condition is reached and the frame fetching stops. In an embodiment of the present application, the frame fetching stop condition includes but is not limited to, the number of frames written into the FrameBuffer by the gesture sliding reaches the preset total number of frames that need to be displayed, and the end mark of the target data and the boundary mark of the left or right end are detected. In this way, when different data frames with overlapping data contents are continuously refreshed in the FrameBuffer, according to the principle of visual persistence, the visual effect of the list sliding under the control of the gesture sliding screen is achieved. In this embodiment, the frame timer settings of all strategies are the same as the total number of frames that need to be displayed, which are pre-set fixed values. The frame timer is set to 30 milliseconds, so the frame rate is also 30 milliseconds. One frame of data will be displayed in the display window every 30 milliseconds. The frame rate is controlled at about 30 frames per second through the timer. In this way, when different data frames with overlapping display contents are continuously refreshed in the FrameBuffer, according to the principle of visual persistence, the visual effect of the list sliding under gesture control is achieved.

[0065] This application constructs a linked list data structure and canvas according to the display list style and the target data style, and by constructing a linked list data structure, canvas and FrameBuffer data reading and writing on the Linux system, without introducing the overhead brought by a large-scale graphics system with huge resource consumption and without increasing hardware costs (such as increasing memory, increasing CPU frequency, etc.), a graphical interface similar to the gesture sliding control in a mobile phone is implemented on the interactive interface of the embedded system, thereby improving the flexibility of embedded device control and the speed of target content positioning, without problems such as lag and slow buffering, and effectively improving the user interface interaction experience.

[0066] To ensure the real-time and smoothness of sliding, in an embodiment of the present application, the canvas includes multiple sub-canvases; to ensure the real-time and smoothness of sliding on an embedded device, in some embodiments, the canvas includes three sub-canvases, namely, a first sub-canvas, a second sub-canvas and a third sub-canvas, each of which includes a border mark for identifying the border of the sub-canvas; the border mark canvas top and / or bottom border mark and the canvas left and / or right border mark, the border mark of the canvas includes the border marks of all sub-canvases; setting the starting sub-canvas and The sub-canvas sequence is preset (the starting position of the starting sub-canvas is the starting position of the canvas), and the three sub-canvases are used alternately in a loop according to the preset canvas sequence. For example, the preset canvas sequence is the first sub-canvas, the second sub-canvas, the third sub-canvas, and the first sub-canvas. Considering that the sub-canvas memory occupancy cannot be too large, the width of each sub-canvas is equal to the pixel width of the canvas, and the height of the sub-canvas is set to 3 times the pixel height of the display list height. When the canvas includes three sub-canvases, step S300 completes the filling of the starting sub-canvas, i.e., completes the initialization of the canvas target data. Figure 4 The diagram of the structure relationship between the linked list data structure, the sub-canvas and the FrameBuffer is shown. At this time, according to the gesture sliding direction, the current canvas reading position and the display strategy, a frame of data is obtained from the canvas and written into the FrameBuffer, including:

[0067] When sliding up and down, determine whether the remaining data height of the current sub-canvas is enough for one frame of data pixels according to the stepping distance of the display strategy and the current canvas reading position. If so, directly obtain one frame of data and write it to FrameBuffer; otherwise, read the remaining data from the current sub-canvas, and then read new data from the linked list data structure according to the sliding direction and the current linked list reading position and draw it to the next sub-canvas. At the same time, record the previous linked list reading position, and then read data from the starting position of the next sub-canvas to make up one frame of data and write it to FrameBuffer; the three sub-canvases are used in a cycle until the end mark of the target data is detected. If the end mark is detected but the remaining data of the canvas is not enough for one frame, the last frame of data is obtained by reducing the stepping distance and written to FrameBuffer, and then stop taking frames.

[0068] When sliding left or right, you only need to determine whether you have reached the left or right boundary based on the boundary marker. If you have not reached the boundary, take a frame of data from the canvas and write it into the FrameBuffer based on the current canvas reading position and display strategy; if you reach the left or right boundary and the remaining data on the canvas is not enough for one frame, get the last frame of data and write it into the FrameBuffer by reducing the step distance this time, and then stop taking frames.

[0069] In the implementation of the present application, the display window display list will perform several frame fetching operations through the frame fetching timer from the start of sliding to the stop. Some embodiments of the present application achieve smooth processing by successively reducing the stepping distance for the subsequent frame fetching operations to avoid the sudden braking effect of the sliding screen. That is, when the number of frames written to the FrameBuffer is still short of the preset number of frames to reach the preset total number of frames that need to be displayed, the stepping distance of each frame of data is reduced by the preset distance.

[0070] and Figure 1 Corresponding to the embodiment shown, the embodiment of the present invention further provides an electronic device, see Figure 5 , including a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504;

[0071] Memory 503, used for storing computer programs;

[0072] The processor 501 is used to implement any one of the gesture sliding screen method steps based on embedded Linux in the above embodiments when executing the program stored in the memory.

[0073] It can be seen from this embodiment that the electronic device provided by the embodiment of the present invention can realize a graphical interface similar to the gesture sliding control in a mobile phone on the interactive interface of the embedded system without introducing the overhead brought by a large-scale graphics system with huge resource consumption and without increasing the hardware cost, thereby improving the flexibility of embedded device control and the speed of target content positioning without problems such as lag and slow buffering, and effectively improving the user interface interaction experience.

[0074] and Figure 1 Corresponding to the embodiment shown, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, any one of the method steps of gesture sliding screen based on embedded Linux in the above embodiments is implemented.

[0075] It can be seen from this embodiment that the application of the storage medium provided in the embodiment of the present invention can realize a graphical interface similar to the gesture sliding control in a mobile phone on the interactive interface of the embedded system without introducing the overhead brought by a large-scale graphics system with huge resource consumption and without increasing the hardware cost, thereby improving the flexibility of embedded device control and the speed of target content positioning without problems such as lag and slow buffering, and effectively improving the user interface interaction experience.

[0076] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for implementing gesture screen sliding based on embedded Linux, characterized in that: The following steps are involved: Creating a linked list data structure according to the number of rows and columns of the target data and applying for a piece of memory as a canvas according to the number of columns of the target data and the display list style of the screen; wherein the display list style at least includes the number of rows, the number of columns, the row height in pixels, and the column width in pixels of the display list; Obtain target data from the application layer, and store each row of target data into a row node corresponding to the linked list data structure in sequence starting from the start position of the linked list data structure in accordance with the row order of the target data, and store each column of data of each row of target data into a cell node corresponding to the row node in accordance with the column order of the target data; According to the received target data opening request, the canvas target data is drawn to the canvas from the starting position of the linked list data structure to complete the initialization of the canvas target data, and the current linked list reading position is recorded; Reading a frame of data from the start position of the canvas and copying it to the FrameBuffer, refreshing the display list on the screen and recording the current canvas reading position; wherein the frame of data is the canvas data that fills up all the useful FrameBuffer; the current canvas reading position includes the number of rows and columns read by the current canvas; Monitor the gesture sliding screen event, and calculate the sliding direction and sliding speed of the gesture sliding screen according to the continuously changing touch point coordinates in the gesture sliding screen event; According to the sliding speed, a display strategy corresponding to the calculated sliding speed is selected from a plurality of preset display strategies; wherein the display strategy includes a step distance; the step distance is the number of pixel rows or columns of newly added data in a frame of data written to the graphics card FrameBuffer for display each time compared with the previous time; After each timer overflows when the frame fetching timer started during gesture sliding, a frame of data is fetched from the canvas and written into the FrameBuffer according to the sliding direction, the current canvas reading position and the display strategy, and the current canvas reading position is recorded and refreshed and displayed on the display list of the display window until the frame fetching stop condition is met and frame fetching stops; Wherein, the linked list data structure is created according to the number of rows and columns of the target data; the number of rows of the created linked list data structure is equal to the number of rows of the target data, the number of cells in each row is equal to the number of columns of the target data, and each row is a row node, and two adjacent row nodes are bidirectionally linked; each row includes a plurality of cell nodes, and two adjacent cell nodes in each row are bidirectionally linked; A piece of memory is applied for as a canvas according to the number of columns of the target data and the display list style of the screen, the row height of each row in the applied canvas is equal to the row height pixel of the display list, and the column width of each column in the canvas is equal to the column width pixel of the display list; the width of the canvas is equal to the number of columns of the target data multiplied by the column width pixel of the display list, the height of the canvas is at least equal to the pixel height of the display list, and the canvas is provided with a boundary marker for identifying the boundary of the canvas; the boundary marker includes the top and / or bottom boundary markers of the canvas and the left and / or right boundary markers of the canvas.

2. The method according to claim 1, characterized in that According to the received target data opening request, the canvas target data is initialized by drawing the data to the canvas from the starting position of the linked list data structure, and the current linked list reading position is recorded, specifically: According to the received target data opening request, the data of each row node is read in sequence from the starting position of the linked list data structure, and the data in each cell node of the read row node is filled and drawn from the starting position of the canvas to the corresponding pixel coordinate position of the canvas, the initialization of the canvas target data is completed, and the current linked list reading position of the linked list data structure is recorded; wherein the data in each cell node of the read row node includes text information and picture information; Filling and drawing the text information to the corresponding pixel coordinate position of the canvas is to read the font information from the corresponding font library according to the set font, calculate the pixel coordinate position in the canvas, and fill the corresponding pixel coordinate position one by one in the canvas memory in the form of pixel points; Drawing the image information to the corresponding pixel coordinate position of the canvas is to read the image storage path information from the cell, open the image file, obtain the BMP bitmap data, and fill it in the corresponding pixel coordinate position of the canvas.

3. The method according to claim 1, characterized in that The monitoring of the screen sliding gesture event and calculating the sliding direction and sliding speed of the screen sliding gesture according to the continuously changing touch point coordinates in the screen sliding gesture event include the following steps: Take three continuously changing touch sampling point coordinates from the gesture sliding event and record the clock tick of each sampling point; According to the x and y coordinates of the three sampling points, calculate the displacements of the three sampling points in the x and y directions; Determine the sliding direction based on the displacement size and coordinates; The sliding speed of the gesture screen sliding is calculated based on the calculated displacement, sliding direction, and time information recorded by the clock tick of each sampling point.

4. The method according to claim 1, characterized in that: The frame fetching stop condition includes: The number of frames written to FrameBuffer by this gesture sliding reaches the preset total number of frames that need to be displayed; Detecting the end mark of the target data; and The left or right boundary marker is detected.

5. The method according to claim 1, characterized in that The canvas includes multiple sub-canvases, and a starting sub-canvas and a preset sub-canvas order are set. The three sub-canvases are used alternately in a loop according to the preset canvas order; each sub-canvas includes a boundary mark for identifying the boundary of the sub-canvas; when the canvas includes three sub-canvases, the initialization of the canvas target data is completed when the starting sub-canvas is filled.

6. The method according to claim 5, characterized in that The acquiring a frame of data from the canvas and writing it into FrameBuffer according to the sliding direction, the current canvas reading position and the display strategy includes: When the sliding direction is upward or downward, judging whether the remaining data height of the current sub-canvas is enough for a frame of data pixel height according to the stepping distance of the display strategy and the current canvas reading position; If yes, directly get a frame of data and write it into FrameBuffer; Otherwise, determine whether the end mark of the target data is detected. If the end mark is detected, obtain the last frame of data by reducing the current step distance and write it into FrameBuffer; otherwise, read the remaining data from the current sub-canvas, and then read new data from the linked list data structure according to the sliding direction and the current linked list reading position and draw it to the next sub-canvas, while recording the previous linked list reading position, and then read data from the starting position of the next sub-canvas to make up a frame of data and write it into FrameBuffer.

7. The method according to claim 4, characterized in that When the number of frames written into the FrameBuffer is less than the preset number of frames to reach the preset total number of frames to be displayed, the stepping distance is reduced by the preset distance each time a frame of data is taken.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method steps described in any one of claims 1 to 7 when executing the program stored in the memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method for realizing high-performance table rendering based on canvas

    CN116484815A

  • Table picture generation method and device

    CN117521614A