General implementation method and system for geometric special effects in the Wayland environment
By building a unified special effects framework in the Wayland environment, the repeated construction and operation problems of geometric special effects are solved, and efficient integrated development of geometric special effects and performance optimization are achieved.
Patent Information
- Application Number
- CN202510578951.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-05-07
AI Technical Summary
The geometric effect implementation in the existing Wayland environment has problems such as repeated element construction, many repeated operations, poor scalability and insufficient performance.
The general configuration structure is used to store geometric special effects information, create transform structures to describe geometric transformations, generate thumbnails, and realize rendering and resource management of geometric special effects through standardized interfaces, and build a unified special effects framework for integrated maximization/minimization of scaling, fading, drawer special effects, etc.
It realizes integrated development of geometric special effects, improves development efficiency by 70%, optimizes GPU/CPU computing and rendering, and reduces the peak memory footprint.
Smart Images

Figure CN120107443B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of desktop rendering under the Linux system, and particularly relates to a general implementation method and system for geometric special effects in a Wayland environment. Background Art
[0002] Wayland is an open-source project aiming to create a new display server architecture under Linux. The goal of Wayland is to replace X and provide a simple, efficient, lightweight display server architecture that meets the requirements of modern desktops. An important feature of modern desktops is window composition. Wayland directly communicates with application programs and video hardware through a compositor and forwards events to them. Among them, the application program renders graphics into the buffer of the application program, and then the compositor, that is, the display server, composes these graphics and displays them on the screen (which is the window of the application program).
[0003] Currently, for special effects such as zooming special effects, drawer special effects, fade-in and fade-out special effects, etc. in the Wayland environment that involve changes in three elements: alpha (transparency), position, and angle, each special effect is implemented independently, and there is no linkage between special effects. Therefore, how to provide a general implementation of geometric special effects in the Wayland environment to reduce the repetitive operations in the development of geometric special effects in the Wayland environment and improve scalability and performance has become a key technical problem to be solved urgently. Summary of the Invention
[0004] The technical problem to be solved by the present invention: Aiming at the above problems of the prior art, the present invention provides a general implementation method and system for geometric special effects in a Wayland environment. The present invention aims to solve the problems of repeated construction of elements, many repeated operations, poor scalability, and insufficient performance among various geometric special effects caused by the independent implementation of geometric special effects in the existing Wayland environment.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is as follows:
[0006] A general implementation method for geometric special effects in a Wayland environment, comprising the following steps:
[0007] S1, create a general configuration structure to store information of the current geometric special effect, register a general interface for the current geometric special effect and specify a corresponding hook function. The implementations of hook functions corresponding to different geometric special effects are different, and fill parameters in the general configuration structure according to the attributes of the current geometric special effect. The attributes of the geometric special effect include special effect priority;
[0008] S2, create a transform structure for describing the geometric transformation of the current geometric special effect;
[0009] S3. Create an animation curve for the current geometric effect;
[0010] S4. Generate a thumbnail required for the current geometric effect;
[0011] S5. Attach the current geometric effect to the node representing the display content in the Wayland environment;
[0012] S6. Call the general interface registered for the current geometric effect based on the effect priority to complete the rendering output of the current geometric effect and recycle resources after the rendering is completed.
[0013] Optionally, the general interfaces registered in step S1 include: the pre-stage interface frame_render_pre, the window boundary interface entity_bounding_box, the node rendering interface node_render, the push damage area interface node_push_damage, the post-processing interface frame_render_post, and the effect destruction interface entity_destroy; step S6 includes:
[0014] S6.1. Trigger the registered pre-stage interface frame_render_pre based on the effect priority, start timing through the hook function corresponding to the pre-stage interface frame_render_pre, and adjust and reset the parameters according to the parameter status in the configuration structure of the current geometric effect;
[0015] S6.2. Calculate the real-time position, real-time transparency, and damage area according to the animation curve and push them as damage areas that need to be re-rendered, and obtain the effect size of the node to which the current geometric effect is attached in the Wayland environment through the hook function corresponding to the registered window boundary interface entity_bounding_box;
[0016] S6.3. Render the thumbnail to the real-time position through the registered node rendering interface node_render, and perform geometric transformation along the animation curve through the transform structure and render it to the calculated real-time position;
[0017] S6.4. Push the damage area to the parent node through the registered push damage area interface node_push_damage and correct the damage area through the post-processing interface frame_render_post, and the hook function of the pre-stage interface frame_render_pre detects whether the timing time has expired. If the timing time has expired, end the current geometric effect, and recycle the resources of the current geometric effect through the registered effect destruction interface entity_destroy.
[0018] Optionally, the current geometric effect is the maximize / minimize scaling effect. The maximize / minimize scaling effect is the maximization, maximize restoration, minimization, or minimization restoration of the application window. The above maximize / minimize scaling effect is the change process of window scaling formed after superimposing the size scaling effect on the initial application window. Step S1 includes: S1.1A, registering the hook function for updating the parameters of the maximize / minimize scaling effect and the hook function for calculating the rendering position; S1.2A, creating an entity structure of the maximize / minimize scaling effect, and this entity structure defines a data structure to store the configuration information of the maximize / minimize scaling effect; S1.3A, setting the effect curve of the maximize / minimize scaling effect and calculating the position; S1.4A, filling the parameters in the configuration structure according to the attributes of the maximize / minimize scaling effect.
[0019] Optionally, the current geometric effect is the fade-in or fade-out effect of the application window. The above effect is the change process of the window transparency and position formed after superimposing the transparency change and position change effects on the initial application window; Step S1 includes: S1.1B, registering the hook function for updating the parameters of the fade-in / fade-out effect and the hook function for calculating the rendering position; S1.2B, creating an entity structure of the fade-in / fade-out effect, and this entity structure defines a data structure to store the configuration information of the fade-in / fade-out effect; S1.3B, setting the transparency change curve and position change curve of the fade-in / fade-out effect; S1.4B, setting the start time, the duration of the effect, setting the transparency at the start and end, calculating the positions at the start and end, and filling the parameters in the configuration structure according to the attributes of the fade-in / fade-out effect.
[0020] Optionally, the current geometric effect is the drawer effect of the application window. The above effect is the change process of the window translation movement and transparency adjustment formed after superimposing the translation movement and transparency effect on the initial application window; Step S1 includes: S1.1C, registering the hook function for updating the parameters of the drawer effect and the hook function for calculating the rendering position; S1.2C, creating an entity structure of the drawer effect, and this entity structure defines a data structure to store the configuration information of the drawer effect operation; S1.3C, setting the transparency curve and position curve of the drawer effect; S1.4C, filling the parameters in the configuration structure according to the attributes of the drawer effect.
[0021] Optionally, rendering to the calculated real-time position in step S6 means the position calculated by the animator_value function according to the effect time.
[0022] Optionally, the expression of the transform structure for describing the geometric transformation of the current geometric effect created in step S2 is:
[0023] struct transform_effect {
[0024] struct effect effect;
[0025] const struct transform_effect_interface impl;
[0026] struct effect_manager manager;
[0027] struct wlr_renderer renderer;
[0028] bool is_opengl_renderer;
[0029] struct wl_listener enable;
[0030] struct wl_listener disable;
[0031] struct wl_listener destroy;
[0032] void user_data;
[0033] int priority;
[0034] };
[0035] Among them, struct effect effect is a pointer to the special effect structure effect, and the special effect structure effect is the base class of the special effect interface in the Wayland environment; const struct transform_effect_interface impl is a pointer to a transform_effect_interface structure, which defines the specific implementation interface of the transformation effect, where the impl pointer is used to specify the corresponding dynamic algorithm; struct effect_manager manager is a pointer to an effect_manager structure, which is responsible for creating, destroying, and managing the life cycle of special effects; struct wlr_renderer The renderer is a pointer to a wlr_renderer structure, where the wlr_renderer structure is a renderer interface for Wayland and is the rendering backend of the renderer; bool is_opengl_renderer is a boolean value indicating whether the current renderer supports the OpenGL backend; struct wl_listener enable is a wl_listener structure used to listen for enable events. When the transformation effect is enabled, the wl_listener structure will trigger a callback function to notify the transform_effect structure to perform corresponding initialization or update operations; struct wl_listener disable is a wl_listener structure used to listen for disable events. When the transformation effect is disabled, the wl_listener structure will trigger a callback function to notify the transform_effect structure to perform corresponding cleanup or update operations; struct wl_listener destroy is a wl_listener structure used to listen for destroy events. When the transformation effect is destroyed, the wl_listener structure triggers a callback function to notify transform_effect to release resources or perform other necessary cleanup operations; void user_data is a pointer to user-defined data, which is used for users to store custom data related to the transformation effect; int priority is the special effect priority.
[0036] In addition, this embodiment also provides a general implementation system for geometric special effects in a Wayland environment, including a microprocessor and a memory connected to each other. The microprocessor is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment.
[0037] In addition, this embodiment also provides a computer-readable storage medium, in which a computer program or instruction is stored. The computer program or instruction is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment through a processor.
[0038] In addition, this embodiment also provides a computer program product, including a computer program or instruction, which is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment through a processor.
[0039] Compared with the prior art, the present invention can mainly achieve the following beneficial effects: 1. The present invention breaks through the traditional paradigm of independent development of special effects, constructs a unified special effects framework, and realizes the integrated implementation of geometric special effects such as maximizing / minimizing zoom, fade-in / fade-out, and drawer special effects. 2. The present invention establishes a parameterized configuration model, defines special effect attributes (such as animation curves, durations, etc.) through standardized interfaces, and improves the development efficiency of new special effects by 70%. 3. The present invention can adjust GPU / CPU computing and rendering according to the special effect priority. 4. By constructing a unified special effects framework, the present invention can achieve the reuse of cross-special effect states, eliminate the overhead of repeated initialization, and reduce the peak memory occupancy. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a schematic diagram of the basic process of the method according to an embodiment of the present invention.
[0041] Figure 2 It is a schematic diagram of the process of step S6 in an embodiment of the present invention.
[0042] Figure 3 It is a schematic diagram of the initialization and parameter filling process of the maximizing / minimizing zoom special effect in an embodiment of the present invention.
[0043] Figure 4 It is a schematic diagram of the initialization and parameter filling process of the fade-in / fade-out special effect in an embodiment of the present invention.
[0044] Figure 5 It is a schematic diagram of the initialization and parameter filling process of the drawer special effect in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0045] In order to enable those skilled in the art to better understand the technical solutions of the present invention, the technical solutions of the present invention will be further described in detail below with reference to the accompanying drawings in the embodiments of the present invention.
[0046] As Figure 1 shown, the general implementation method of geometric special effects in the Wayland environment of this embodiment includes the following steps:
[0047] S1. Create a general configuration structure to store information about the current geometric effect, register a general interface for the current geometric effect, and specify the corresponding hook function. The implementations of the hook functions corresponding to different geometric effects are different. Fill the parameters in the general configuration structure according to the attributes of the current geometric effect. The attributes of the geometric effect include the effect priority. The interface registered for the current geometric effect is mainly used to render and correct the damaged area that needs to be re-rendered (damage). When filling the parameters in the configuration structure (options) according to the attributes of the current geometric effect, different geometric effects can initialize the variables in the configuration structure according to their own attributes. Some effects only change the position information, such as the drawer effect, and some effects need to change both the position and the transparency (alpha) at the same time, such as the fade-in / fade-out effect, etc.;
[0048] S2. Create a transform structure for describing the geometric transformation of the current geometric effect;
[0049] S3. Create the animation curve of the current geometric effect;
[0050] S4. Generate the thumbnail required for the current geometric effect;
[0051] S5. Attach the current geometric effect to the node used to represent the display content in the Wayland environment;
[0052] S6. Call the general interface registered for the current geometric effect based on the effect priority to complete the rendering output of the current geometric effect and recycle resources after the rendering is completed.
[0053] In step S1 of this embodiment, the variables in the configuration structure (options) include struct animation_type_grouptype, the curve type; struct animation_data start, end, the start and end positions of the effect; int64_t start_time, the start time of the effect; int duration, the duration period of the effect. Some effects only change the position information, such as the drawer effect, and some effects need to change both the position and the alpha at the same time, such as the fade-in / fade-out effect. The expression of the transform structure for describing the geometric transformation of the current geometric effect created in step S2 of this embodiment is:
[0054] struct transform_effect {
[0055] struct effect effect;
[0056] const struct transform_effect_interface impl;
[0057] struct effect_manager manager;
[0058] struct wlr_renderer renderer;
[0059] bool is_opengl_renderer;
[0060] struct wl_listener enable;
[0061] struct wl_listener disable;
[0062] struct wl_listener destroy;
[0063] void user_data;
[0064] int priority;
[0065] };
[0066] Among them, struct effect effect is a pointer to the special effect structure effect, and the special effect structure effect is the base class of the special effect interface in the Wayland environment; const struct transform_effect_interface impl is a pointer to a transform_effect_interface structure, which defines the specific implementation interface of the transformation effect, where the impl pointer is used to specify the selection of the corresponding dynamic algorithm; struct effect_manager manager is a pointer to an effect_manager structure, which is responsible for creating, destroying, and managing the life cycle of the special effect; struct wlr_renderer The `renderer` is a pointer to a `wlr_renderer` structure, where the `wlr_renderer` structure is a renderer interface in Wayland and is the rendering backend of the renderer; the `bool is_opengl_renderer` is a boolean value indicating whether the current renderer supports the OpenGL backend; the `struct wl_listener enable` is a `wl_listener` structure used to listen for enable events. When the transformation effect is enabled, the `wl_listener` structure will trigger a callback function to notify the `transform_effect` structure to perform corresponding initialization or update operations; the `struct wl_listener disable` is a `wl_listener` structure used to listen for disable events. When the transformation effect is disabled, the `wl_listener` structure will trigger a callback function to notify the `transform_effect` structure to perform corresponding cleanup or update operations; the `struct wl_listener destroy` is a `wl_listener` structure used to listen for destroy events. When the transformation effect is destroyed, the `wl_listener` structure triggers a callback function to notify the `transform_effect` to release resources or perform other necessary cleanup operations; `void` `user_data` is a pointer to user-defined data, which is used for the user to store custom data related to the transformation effect; `int priority` is the special effect priority. For example, if the value of `priority` is 5, it means to create a `transform` structure with a special effect priority of 5. The general interfaces registered in step S1 include: the pre-stage interface `frame_render_pre`, the window boundary interface `entity_bounding_box`, the node rendering interface `node_render`, the push damage area interface `node_push_damage`, the post-processing interface `frame_render_post`, and the special effect destruction interface `entity_destroy`.
[0067] In step S3 of this embodiment, the created animation curve refers to an irregular curve of position change or transparency change during the special effect process (similar to a parabola). If only the position needs to be changed during the special effect process, then create a position change curve. If both the position and transparency are changed during the special effect process, then a transparency change curve needs to be created. And set the final position, angle, and transparency of the curve, and the position, transparency, and angle of the special effect change according to the curve.
[0068] In step S4 of this embodiment, the thumbnail is generated based on the node used to represent the display content. Different nodes used to represent the display content result in different generated thumbnails.
[0069] In step S5 of this embodiment, the current geometric effect is attached to the node used to represent the display content in the Wayland environment. The current geometric effect can be attached to the node used to represent the display content in the Wayland environment through the ky_scene_node_add_effect function.
[0070] After initializing all variables in the transform structure, step S1 has registered the following general interfaces, including: the pre-stage interface frame_render_pre, the window boundary interface entity_bounding_box, the node rendering interface node_render, the interface for pushing the damaged area node_push_damage, the post-processing interface frame_render_post, and the special effect destruction interface entity_destroy. The hook functions of the above interfaces registered for different special effects are different. Among them, the pre-stage interface frame_render_pre is equivalent to preprocessing and is an intervention in the damaged area stage, which can be used to change the damaged area; the post-processing interface frame_render_post is a rendering post-processing interface and is also used to correct the damaged area. The pre-stage interface frame_render_pre is called before rendering, and the post-processing interface frame_render_post is called after rendering; pushing the damaged area (node_push_damage) means pushing the area that needs to be redrawn. Each node pushes the damaged area to its parent node; the node rendering interface node_render refers to rendering, rendering the texture and pasting it to the position where it should be pasted. During the rendering process, the hook function transform_effect_frame_pre of the pre-stage interface frame_render_pre will be called. In this stage, the timing of the special effect will start, and the configuration structure parameters will be updated and adjusted. If the parameters are updated, the curve and parameters will be reset.
[0071] In this embodiment, the real-time position rendered in step S6 refers to the position calculated according to the special effect time by the animator_value function. According to the curve and time, calculate the real-time position of the rendering, and push the damaged area that needs to be redrawn (damage) to the parent node through the node_push_damage interface. The parent node refers to the node's father. A window can be understood as a node. The scene tree of a desktop is like a tree trunk. The tree trunk has many branches, which can be regarded as nodes. There are parent-child relationships and sibling nodes among the nodes. As Figure 2 shown, step S6 of this embodiment includes:
[0072] S6.1, trigger the registered pre-stage interface frame_render_pre based on the special effect priority, start timing through the hook function corresponding to the pre-stage interface frame_render_pre, and adjust and reset the parameters according to the parameter status in the configuration structure of the current geometric special effect;
[0073] S6.2, calculate the real-time position, real-time transparency, and damaged area according to the animation curve and push them as the damaged area that needs to be redrawn. Obtain the special effect size of the current geometric special effect attached to the node representing the display content in the Wayland environment through the hook function corresponding to the registered window boundary interface entity_bounding_box;
[0074] S6.3, render the thumbnail to the real-time position through the registered node rendering interface node_render, and perform geometric transformation along the animation curve through the transform structure and render it to the calculated real-time position;
[0075] S6.4, push the damaged area to the parent node through the registered interface for pushing the damaged area node_push_damage and correct the damaged area through the post-processing interface frame_render_post. And the hook function of the pre-stage interface frame_render_pre detects whether the timing time has timed out. If the timing time has timed out, end the current geometric special effect, and recycle the resources of the current geometric special effect through the registered special effect destruction interface entity_destroy.
[0076] In one embodiment, the current geometric special effect is the maximize / minimize scaling effect (collectively referred to as the scale effect). The maximize / minimize scaling effect is the maximization, maximize restoration, minimization, or minimization restoration of the application window. The above maximize / minimize scaling effect is the change process of window scaling formed after superimposing the size scaling effect on the initial application window. The scale effect is a geometric special effect for two key frames (the head frame and the tail frame) of the application window, where the head frame is the initial application window and the tail frame is the application window finally displayed after scaling. The scale effect forms the animation special effect of the application window by adding special effect animation frames of maximization, maximize restoration, minimization, or minimization restoration between the head frame and the tail frame. Before applying the scale effect, when the user maximizes or minimizes the application window through the mouse or shortcut, the human eye can only see two key frames (the head frame and the tail frame). The whole process is very fast, making people feel very abrupt and the experience is poor. To improve the user experience, the scale effect is added here to make the maximization, maximize restoration, minimization, or minimization restoration process visual and the visual effect is better. Add the entity of the scaling effect to the corresponding node of the application window. According to the design document provided by the interface, set the position animation curve, the duration of the special effect, calculate the starting display position, calculate the final display position, intervene in the rendering composition of the node through the interface of the special effect framework, and then finally achieve the scaling effect by calculating and modifying the damaged area damage or alternative rendering, etc. As Figure 3As shown below, step S1 of this embodiment includes: Step S1 includes: S1.1A, registering a hook function for updating the maximum-minimum zoom effect parameters and a hook function for calculating the rendering position; S1.2A, creating an entity structure for the maximum-minimum zoom effect, and this entity structure defines a data structure to store the configuration information of the maximum-minimum zoom effect; S1.3A, setting the effect curve of the maximum-minimum zoom effect and calculating the position; S1.4A, filling the parameters in the configuration structure according to the attributes of the maximum-minimum zoom effect. For the four operations of maximizing, restoring maximization, minimizing, and restoring minimization of the maximum-minimum effect, the corresponding animation curves are set first at the beginning, the effect duration is set, and the start position, end position are calculated. Depending on the operation, these corresponding parameters are different. Taking the maximize effect as an example, according to whether there is shadow state data (ssd) in the window, the shadow area is calculated, and the start position and end position of maximization are calculated. The transparency at the start and end is set to 1.0, and the effect duration is 300ms. The setting and calculation of the above initial values are calculated separately during the maximize effect. The transform framework is to solve a series of special effects related to the changes of the three elements of position, angle, and transparency. Special effects such as fade-in and fade-out effects and drawer effects also share the transform structure, so there is no need to write a set of interfaces for each special effect separately. The transform structure can be understood as extracting the common part of the interfaces. In the maximize effect, a transform structure is created. This structure is used to describe the maximize effect and contains all the information of the maximize effect, such as the current position, thumbnail information, curve, node and other information. According to the pre-filled curve method, an animation curve is created. The thumbnail is obtained. At this time, the maximized thumbnail is obtained, and changes are made based on this image. The maximize effect implements its own transform interface. The transform will register the common interface to the maximize effect interface into the effect framework. This flowchart is for the scale effect to create a structure and fill the configuration structure options. The hook function registered by the scale effect will be called in the pre-stage interface frame_render_pre of the effect framework to update the parameters of the configuration structure and calculate the final rendering coordinate position.
[0077] In another embodiment, the current geometric special effect is the fade-in or fade-out special effect (fade effect) of the application window. The above special effect is the change process of the window transparency (i.e., alpha value) and position formed after superimposing the transparency change and position change special effects on the initial application window. The fade effect can also be understood as a geometric special effect based on two key frames (the head frame and the tail frame) of the application window, where the head frame is the initial application window and the tail frame is the application window after fade-in or fade-out. The fade effect is an animation special effect of the application window formed by adding fade-in or fade-out transition special effect frames between the head frame and the tail frame. In the absence of the fade effect, when the user opens the application, right-clicks the mouse to pop up the menu bar, and the mouse triggers the text tooltip, it appears immediately, and when performing the opposite operations such as closing the application, it disappears immediately. This gives the user a very poor experience. To improve the experience, after adding the fade-in and fade-out special effects, the user can see the process of the application appearing and disappearing when performing these operations. Add a fade-in and fade-out special effect entity to the corresponding application window or node. According to the user interface design document, the position change animation curve, the special effect duration, the transparency change animation curve, the starting position, the final display position, the starting and final transparencies can be set. According to the characteristics of the fade-in and fade-out special effects, the special effect interfaces to be implemented are registered in the special effect framework, and finally, the special effect is realized by modifying the damaged area, modifying the rendering, etc. The fade-in and fade-out special effects are mainly applied to the opening and closing of the application window, tooltips, the appearance and disappearance of the right-click menu bar. The processes and algorithms are almost the same. First, create the fade effect, set the transparency change curve and position change curve of the fade effect according to the requirements of the design document, and calculate the starting and ending coordinate positions. Set the start time and duration of the fade effect. Register two hook functions of transform_effect_interface according to the characteristics of the fade effect, namely update_transform_options and destroy. In the prehook stage of the special effect framework, the update_transform_options function will be called to update the configuration parameters according to the real-time state. Then, create the transform structure corresponding to the fade effect through the public interface of transform and connect it to the transform framework. As Figure 4As shown in the figure, step S1 of this embodiment includes: S1.1B, registering a hook function for updating the fade-in and fade-out effect parameters and a hook function for calculating the rendering position; S1.2B, creating an entity structure for the fade-in and fade-out effect, and this entity structure defines a data structure to store the configuration information of the fade-in and fade-out effect; S1.3B, setting the transparency change curve and the position change curve of the fade-in and fade-out effect; S1.4B, setting the start time, the duration of the effect, setting the transparency at the start and end, calculating the positions at the start and end, and filling the parameters in the configuration structure according to the attributes of the fade-in and fade-out effect.
[0078] In another embodiment, the current geometric effect is the drawer effect (slide effect) of the application window. The above effect is the change process of window translation movement and transparency adjustment formed after superimposing a translation movement and a transparency effect on the initial application window. The slide effect can also be understood as a geometric effect based on two key frames (the head frame and the tail frame) of the application window. The head frame is the initial application window, and the tail frame is the application window after being opened or closed. The drawer effect (slide effect) adds an animation frame of window translation movement and transparency adjustment to the head frame and finally transitions to the tail frame. According to the design requirements, some applications are required to slide out from a certain position on the task bar and also slide away when disappearing, similar to pulling a drawer and closing the drawer process. For example, the start menu requires a drawer effect. This kind of effect can vividly show the process of opening an application in front of the user, improving the user's perception and experience. Add the drawer effect entity to the corresponding node, set the position change animation curve of the drawer effect, the duration of the effect according to the design document, calculate the starting position of the slide and the final position of the slide, and register the required effect interfaces to the effect framework according to the characteristics of the drawer effect. Finally, the drawer effect is realized by adjusting the damaged area and rendering. Such as Figure 5As shown in the figure, step S1 of this embodiment includes: S1.1C, registering hook functions for updating parameters of the drawer special effect and calculating the rendering position; S1.2C, creating an entity structure of the drawer special effect, and this entity structure defines a data structure to store configuration information for drawer special effect operations; S1.3C, setting the transparency curve and position curve of the drawer special effect; S1.4C, filling parameters in the configuration structure according to the attributes of the drawer special effect. The direct perception of the drawer special effect is that a smooth sliding effect will be generated when the application is opened and closed. Currently, a common scenario is that there is a drawer effect when clicking on the start menu or a quick operation on the task bar. Where it slides out from and where it retracts are closely related to the position of the task bar. Currently, the task bar supports four positions at the bottom, top, left, and right of the desktop. First, obtain relevant data of the slide structure (mainly the sliding direction and deviation) according to the surface position, then create a slide entity special effect structure, and calculate the start position and end position according to the sliding direction and deviation. Register the update_transform_options and get_render_src_box hook functions according to the characteristics of the drawer special effect. These two functions are mainly used to update the options parameters and calculate the value of src (source). Create a transform of the drawer special effect through the transform common interface and connect it to the transform framework.
[0079] In summary, to solve the problems of repetitive construction of a class of effects based on the three elements of transparency, position, and angle, such as maximize-minimize scaling effects, fade-in / fade-out effects, and drawer effects, reduce redundant operations and code, and improve performance, the general implementation of geometric effects in the Wayland environment in this embodiment is mainly divided into two parts: The first part is that external specific effects (such as scaling effects, fade-in / fade-out effects, drawer effects) fill the configuration structure, which describes the geometric parameters of the effects, such as time, transparency, position information, nodes, etc. Then the external specific implementation of their respective interface functions. The second part is the internal transform common framework part. This part mainly creates the transform_effect structure and the transform structure for each effect. The transform_effect structure mainly contains common general interfaces, etc. The transform structure mainly contains information related to textures, buffers, animation curves, nodes, etc. It mainly includes the following functions: ① Create a transform_effect structure for each type of geometric effect and register the interface to the effect framework (the concept of the effect framework is different from that of the transform framework. The transform mainly focuses on geometric effects, and the effect framework is for all effects); ② The external specific effects fill various parameters (time, transparency, position, and angle) of the configuration structure according to the design document; ③ The transform framework part creates a transform structure based on the incoming configuration structure and initializes some parameters. ④ Create an animation curve according to the configuration structure, and the operation of the effect process changes according to the trend of the animation curve; ⑤ Create a thumbnail according to the configuration, and the subsequent rendering of the effect is based on the thumbnail; ⑥ Add the external specific effect to the configured node through a function; ⑦ Since the interface has been registered into the effect framework, during the rendering process, the pre-stage function of the effect framework is called, and the effect time starts to be timed. In this stage, various function pointers will be called, and finally the options parameter is adjusted, and the position, transparency, angle, and animation curve of the effect are reset according to the adjustment of the parameter; ⑧ Calculate the real-time position information and push the damaged area (damage) to the parent node; ⑨ According to the previous options parameter and thumbnail information, through the transform_effect_node_render function, paste the thumbnail to the calculated position and render the texture; ⑩ When the effect time arrives, end the rendering and end the effect. By adopting the method of this embodiment, only the common parts of a class of effects constructed based on the three elements of alpha, position, and angle, such as maximize-minimize scaling effects, fade-in / fade-out effects, and drawer effects, need to be extracted to form a common transform framework. The effect only needs to fill in variable parameters such as transparency, position information, angle, and some specific interfaces according to the attributes of the effect to complete the implementation of the effect, without caring about others.Compared with the prior art, the advantages of the method in this embodiment are as follows: 1. This embodiment breaks through the traditional paradigm of independent special effect development, constructs a unified special effect framework, and realizes the integrated implementation of geometric special effects such as maximizing / minimizing zooming, fading in and out, and drawer special effects. 2. This embodiment establishes a parametric configuration model, defines special effect attributes (such as animation curves, durations, etc.) through standardized interfaces, and improves the development efficiency of new special effects by 70%. 3. This embodiment can adjust GPU / CPU computing and rendering according to the special effect priority. 4. By constructing a unified special effect framework, this embodiment can achieve the reuse of cross-special effect states, eliminate the overhead of repeated initialization, and reduce the peak memory occupancy.
[0080] In addition, this embodiment also provides a general implementation system for geometric special effects in a Wayland environment, including a microprocessor and a memory connected to each other. The microprocessor is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment. This embodiment also provides a computer-readable storage medium, in which a computer program or instruction is stored. The computer program or instruction is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment through a processor. This embodiment also provides a computer program product, including a computer program or instruction, which is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment through a processor.
[0081] Those skilled in the art should understand that the technical solution provided by the present invention can be in the form of a method, a system, or a computer program product. Therefore, the present invention can be implemented in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can be implemented in the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes. The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate for implementing in the process Figure 1 one process or multiple processes and / or blocks Figure 1means for the functions specified in one or more boxes. These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured article including an instruction means that implements the process Figure 1 one process or multiple processes and / or boxes Figure 1 means for the functions specified in one or more boxes. These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one process or multiple processes and / or boxes Figure 1 means for the functions specified in one or more boxes.
[0082] The above is only the preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions within the idea of the present invention belong to the protection scope of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A general implementation method for geometric special effects in the Wayland environment, characterized in that, It includes the following steps: S1. Create a general configuration structure to store information about the current geometric effect, register a general interface for the current geometric effect and specify the corresponding hook function. The implementations of the hook functions corresponding to different geometric effects are different. Fill the parameters in the general configuration structure according to the attributes of the current geometric effect. The attributes of the geometric effect include the effect priority; S2. Create a transform structure for describing the geometric transformation of the current geometric effect; S3. Create the animation curve of the current geometric effect; S4. Generate the thumbnail required for the current geometric effect; S5. Attach the current geometric effect to the node representing the display content in the Wayland environment; S6. Call the general interface registered for the current geometric effect based on the effect priority to complete the rendering output of the current geometric effect and recycle resources after the rendering is completed.
2. The general implementation method of geometric special effects in the Wayland environment according to claim 1, wherein, The general interfaces registered in step S1 include: the pre-stage interface frame_render_pre, the window boundary interface entity_bounding_box, the node rendering interface node_render, the push damage area interface node_push_damage, the post-processing interface frame_render_post, and the effect destruction interface entity_destroy. Step S6 includes: S6.
1. Trigger the registered pre-stage interface frame_render_pre based on the effect priority, start timing through the hook function corresponding to the pre-stage interface frame_render_pre, and adjust and reset the parameters according to the parameter status in the configuration structure of the current geometric effect; S6.
2. Calculate the real-time position, real-time transparency, and damage area according to the animation curve and push them as the damage area that needs to be re-rendered. Obtain the effect size of the node to which the current geometric effect is attached in the Wayland environment for representing the display content through the hook function corresponding to the registered window boundary interface entity_bounding_box; S6.
3. Render the thumbnail to the real-time position through the registered node rendering interface node_render, and perform geometric transformation along the animation curve through the transform structure and render it to the calculated real-time position; S6.
4. Push the damage area to the parent node through the registered push damage area interface node_push_damage and correct the damage area through the post-processing interface frame_render_post. And the hook function of the pre-stage interface frame_render_pre detects whether the timing time has timed out. If the timing time has timed out, end the current geometric effect, and recycle the resources of the current geometric effect through the registered effect destruction interface entity_destroy.
3. The general implementation method of geometric special effects in the Wayland environment according to claim 1, characterized in that The current geometric effect is the maximize / minimize scaling effect. The maximize / minimize scaling effect refers to the maximization, maximize restoration, minimization, or minimization restoration of the application window. The above maximize / minimize scaling effect is the window scaling change process formed after superimposing the size scaling effect on the initial application window. Step S1 includes: S1.1A, registering the hook function for updating the parameters of the maximize / minimize scaling effect and the hook function for calculating the rendering position; S1.2A, creating the entity structure of the maximize / minimize scaling effect. This entity structure defines a data structure to store the configuration information of the maximize / minimize scaling effect; S1.3A, setting the effect curve of the maximize / minimize scaling effect and calculating the position; S1.4A, filling the parameters in the configuration structure according to the attributes of the maximize / minimize scaling effect.
4. The general implementation method of geometric special effects in the Wayland environment according to claim 1, characterized in that The current geometric effect is the fade-in or fade-out effect of the application window. The above effect is the change process of the window transparency and position formed after superimposing the transparency change and position change effects on the initial application window; Step S1 includes: S1.1B, registering the hook function for updating the parameters of the fade-in / fade-out effect and the hook function for calculating the rendering position; S1.2B, creating the entity structure of the fade-in / fade-out effect. This entity structure defines a data structure to store the configuration information of the fade-in / fade-out effect; S1.3B, setting the transparency change curve and position change curve of the fade-in / fade-out effect; S1.4B, setting the start time, the duration period of the effect, setting the transparency at the start and end, calculating the positions at the start and end, and filling the parameters in the configuration structure according to the attributes of the fade-in / fade-out effect.
5. The general implementation method of geometric special effects in the Wayland environment according to claim 1, characterized in that The current geometric effect is the drawer effect of the application window. The above effect is the change process of the window translation movement and transparency adjustment formed after superimposing the translation movement and transparency effects on the initial application window; Step S1 includes: S1.1C, registering the hook function for updating the parameters of the drawer effect and the hook function for calculating the rendering position; S1.2C, creating the entity structure of the drawer effect. This entity structure defines a data structure to store the configuration information of the drawer effect operation; S1.3C, setting the transparency curve and position curve of the drawer effect; S1.4C, filling the parameters in the configuration structure according to the attributes of the drawer effect.
6. The general implementation method of geometric special effects in the Wayland environment according to claim 2, characterized in that, Calculating the real-time position in step S6.2 means calculating the position obtained through the animator_value function according to the effect time.
7. The general implementation method of geometric special effects in the Wayland environment according to claim 1, characterized in that, The expression of the transform structure for describing the geometric transformation of the current geometric effect created in step S2 is: struct transform_effect { struct effect effect; const struct transform_effect_interface impl; struct effect_manager manager; struct wlr_renderer renderer; bool is_opengl_renderer; struct wl_listener enable; struct wl_listener disable; struct wl_listener destroy; void user_data; int priority; }; Among them, struct effect effect is a pointer to the special effect structure effect, and the special effect structure effect is the base class of the special effect interface in the Wayland environment; const struct transform_effect_interface impl is a pointer to a transform_effect_interface structure, which defines the specific implementation interface of the transformation effect. Among them the impl pointer is used to specify and select the corresponding dynamic algorithm; struct effect_manager manager is a pointer to an effect_manager structure, which is responsible for creating, destroying, and managing the life cycle of special effects; struct wlr_renderer renderer is a pointer to a wlr_renderer structure. The wlr_renderer structure is a renderer interface of Wayland and is the rendering backend of the renderer; bool is_opengl_renderer is a boolean value indicating whether the current renderer supports the OpenGL backend; struct wl_listener enable is a wl_listener structure used to listen for enable events. When the transformation effect is enabled, the wl_listener structure will trigger a callback function to notify the transform_effect structure to perform corresponding initialization or update operations; struct wl_listener disable is a wl_listener structure used to listen for disable events. When the transformation effect is disabled, the wl_listener structure will trigger a callback function to notify the transform_effect structure to perform corresponding cleanup or update operations; struct wl_listener destroy is a wl_listener structure used to listen for destroy events. When the transformation effect is destroyed, the wl_listener structure triggers a callback function to notify transform_effect to release or clean up resources; void user_data is a pointer to user-defined data, which is used for users to store custom data related to the transformation effect; int priority is the special effect priority.
8. A general implementation system for geometric special effects in a Wayland environment, including a microprocessor and a memory connected to each other, characterized in that, The microprocessor is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment according to any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program or instructions, characterized in that, The computer program or instruction is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment according to any one of claims 1 to 7 through a processor.
10. A computer program product, comprising a computer program or instructions, characterized in that, The computer program or instruction is programmed or configured to execute the general implementation method of geometric special effects in the Wayland environment according to any one of claims 1 to 7 through a processor.
Citation Information
Patent Citations
Wlots-based synthetic rendering implementation method
CN115686727A
Wayland synthesizer
CN115809047A