Method, system, device and storage medium for realizing multi-layer effect
The method of using OpenGL and inter-process file handle communication enables multi-layer graphical effects in embedded systems with single-layer hardware, offering flexibility and cost-effective solutions for enhanced user experiences.
Patent Information
- Application Number
- CN202311295679.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-08
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2043-10-08
AI Technical Summary
Existing embedded systems often face limitations in achieving multi-layer graphical effects due to hardware design flaws or resource constraints, leading to restricted user interface and graphical creativity, especially when only single-layer support is provided by the driver programs.
A method involving OpenGL initialization, rendering of content for each layer into a shared display cache, inter-process communication using file handles to prioritize and render data, and final rendering on the display screen, allowing for multi-layer effects even in single-layer hardware environments.
This approach enables flexible and customizable multi-layer effects, enhancing user experience with creative and interactive visuals, suitable for various embedded systems without requiring hardware modifications, thus reducing maintenance costs and adapting to changing market demands.
Smart Images

Figure CN117608717B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software, and in particular to a method, system, device and storage medium for realizing multi-layer effects. Background Art
[0002] In the context of current technological development, embedded systems have become an indispensable part of daily life and industrial applications. These embedded systems are often used in a variety of applications, including but not limited to mobile devices, home appliances, automotive control systems, medical devices, and industrial automation. As these systems continue to gain popularity, the demand for graphics and visual effects is also increasing.
[0003] Multi-layer mechanism has become one of the core elements of graphics and user interface presentation in modern embedded systems. Through the multi-layer mechanism, multiple image layers can be presented on a screen at the same time, and these layers can be superimposed to achieve various visual effects, such as transparency, blending mode and layered user interface. This multi-layer technology provides users with a richer and more interactive user experience and provides a higher degree of freedom in terms of graphics effects.
[0004] However, although most modern embedded systems already have support for multi-layer mechanisms, in some special cases, due to hardware design defects or resource constraints, the driver may only provide support for a single layer. This limitation may make it impossible to achieve the required multi-layer effects in actual applications, thereby limiting the creativity and interactivity of user interfaces and graphic effects. Therefore, it is necessary to provide an innovative solution to achieve the display of multi-layer effects in a single-layer hardware environment. Summary of the invention
[0005] In order to solve the above problems, the present invention provides a method, system, device and storage medium for realizing a multi-layer effect.
[0006] To this end, one aspect of the present invention provides a method for achieving a multi-layer effect, comprising the following steps:
[0007] Step S1, initialize openGl;
[0008] Step S2, corresponding to the application of each layer, rendering the content to be displayed to the display cache through openGl;
[0009] Step S3, sending the file handle corresponding to the rendered display cache to the main application through the inter-process shared file handle communication method;
[0010] Step S4, the main application renders the data corresponding to the received file handle to the corresponding position according to the layer priority corresponding to the application;
[0011] Step S5, sending the final rendering result to the display screen for display.
[0012] Furthermore, the method of sharing the file handle communication between processes is sending and receiving the file handle.
[0013] Furthermore, the multi-layer effect is achieved by sending the data rendered by each application to the main application, and then the main application renders the data to the corresponding position according to the priority corresponding to each application.
[0014] Furthermore, the display cache is a cache used to store rendered content.
[0015] Furthermore, the layer refers to the display content corresponding to each application.
[0016] Furthermore, the multi-layer effect refers to displaying the contents corresponding to multiple applications on the display screen at the same time.
[0017] The second aspect of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of realizing a multi-layer effect as described in any one of claims 1-6.
[0018] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the method for realizing a multi-layer effect as described in any one of claims 1-6 are implemented.
[0019] A fourth aspect of the present invention provides a system for realizing a multi-layer effect, characterized in that it comprises:
[0020] OpenGl initialization module, used to initialize openGl;
[0021] The rendering module is used to render the content of each layer application to the display cache through openGl;
[0022] Inter-process communication module, used to realize inter-process communication through shared file handles;
[0023] The main application module is used to receive and render the rendered data to the corresponding position according to the priority;
[0024] The display module is used to send the final rendering result to the display screen for display.
[0025] Furthermore, the multi-layer effect refers to displaying the contents corresponding to multiple applications on the display screen at the same time.
[0026] Compared with the prior art, the above technical solution has the following beneficial effects:
[0027] 1. The present invention has high flexibility and applicability, and can realize various complex visual effects under the condition of limited hardware resources.
[0028] 2. The present invention is highly customizable. By adjusting the parameters of the intelligent image synthesis and processing algorithm, different multi-layer effects can be achieved according to the needs of specific applications and the availability of hardware resources. This makes the present invention suitable for a variety of embedded systems and application fields, thereby providing users with a more creative and interactive visual experience.
[0029] 3. The present invention can also be easily applied to existing embedded systems by means of software upgrades without hardware modifications. This reduces the cost of system maintenance and updates and enables it to quickly adapt to changing market demands. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A schematic diagram of a method for achieving a multi-layer effect.
[0031] Figure 2 Schematic diagram of rendering method for a single application
[0032] Figure 3 A diagram showing the sharing of file handles between processes. DETAILED DESCRIPTION
[0033] The advantages of the present invention are further described below in conjunction with the accompanying drawings and specific embodiments. Those skilled in the art should understand that the following specific description is illustrative rather than restrictive, and should not be used to limit the scope of protection of the present invention.
[0034] The system for realizing multi-layer effects of the present invention includes the following components:
[0035] OpenGl initialization module, used to initialize openGl;
[0036] The rendering module is used to render the content of each layer application to the display cache through openGl;
[0037] The inter-process communication module is used to realize inter-process communication through a shared file handle (filedescriptor, abbreviated as fd);
[0038] The main application module is used to receive and render the rendered data to the corresponding position according to the priority;
[0039] The display module is used to send the final rendering result to the display screen for display.
[0040] like Figure 1 As shown in the figure, the steps for realizing multi-layer display in this system are as follows:
[0041] First initialize openGl.
[0042] like Figure 2 As shown in the figure, after openGl is initialized, each application data and logic are processed, and the rendered data is sent to the main application through the send_fd() function. Figure 3 As shown, 001 represents the rendered data sent by application 1 to the main application, 002 represents the rendered data sent by application 2 to the main application, and so on. 00n represents the rendered data sent by application n to the main application.
[0043] The content of the file handle received by the main application through the recv_fd() function is consistent with the content corresponding to the file handle of the same value in the process where each application is located, thereby realizing data sharing.
[0044] Then, the main application renders the data corresponding to the received file handle to the corresponding position according to the priority corresponding to each application, and finally sends it to the display screen for display. That is, 100 in the figure indicates sending to the display screen for display operation.
[0045] The present invention implements two key technologies: 1. rendering content to cache; 2. sharing and transferring file handles between processes. Through the multi-layer display system and implementation method of the present invention, a virtual multi-layer effect of multiple applications is achieved, while reducing hardware costs and improving display efficiency.
[0046] The following is the implementation code for sharing file handles between processes:
[0047]
[0048]
[0049]
[0050] It should be noted that the embodiments of the present invention have better practicability and do not impose any form of limitation on the present invention. Any technician familiar with the field may use the technical content disclosed above to change or modify it into an equivalent effective embodiment. However, any modification or equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.
Claims
1. A method for achieving a multi-layer effect, characterized in that: The following steps are involved: Step S1, initialize openGl; Step S2, corresponding to the application of each layer, rendering the content to be displayed to the display cache through openGl; Step S3, sending the file handle corresponding to the rendered display cache to the main application through the inter-process shared file handle communication method, and the content of the file handle received by the main application is consistent with the content corresponding to the file handle of the same data in the process where each application is located, thereby realizing data sharing; Step S4, the main application renders the data corresponding to the received file handle to the corresponding position according to the layer priority corresponding to the application; Step S5, sending the final rendering result to the display screen for display.
2. The method for realizing a multi-layer effect according to claim 1, characterized in that: The method of sharing the file handle between processes is to send and receive the file handle.
3. The method for achieving a multi-layer effect according to claim 1, characterized in that: The multi-layer effect is achieved by sending the data rendered by each application to the main application, and then the main application renders the data to the corresponding position according to the priority corresponding to each application.
4. The method for achieving a multi-layer effect according to claim 1, characterized in that: The display buffer is a buffer used to store rendered content.
5. The method for realizing a multi-layer effect according to claim 1, characterized in that: The layer refers to the display content corresponding to each application.
6. The method for achieving a multi-layer effect according to claim 1, characterized in that: The multi-layer effect refers to displaying the contents corresponding to multiple applications on the display screen at the same time.
7. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps in the method for realizing a multi-layer effect as described in any one of claims 1-6.
8. 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 steps in the method for realizing a multi-layer effect as described in any one of claims 1-6 are implemented.
9. A system for achieving a multi-layer effect, characterized in that: include: OpenGl initialization module, used to initialize openGl; The rendering module is used to render the content of each layer application to the display cache through openGl; The inter-process communication module is used to send the file handle corresponding to the rendered display cache to the main application through the inter-process shared file handle communication. The content of the file handle received by the main application is consistent with the content corresponding to the file handle of the same data in the process where each application is located, thereby realizing data sharing; The main application module is used to receive and render the rendered data to the corresponding position according to the priority; The display module is used to send the final rendering result to the display screen for display.
10. The system for realizing multi-layer effect according to claim 9, characterized in that: The multi-layer effect refers to displaying the contents corresponding to multiple applications on the display screen at the same time.
Citation Information
Patent Citations
Methods and apparatus to reduce memory requirements for process control system software applications
CN103294023A
Method for extending JavaCard application functions
CN104102507A