Layer synthesis method and electronic device

By pre-synthesis of the foreground layer, the number of foreground layers synthesized in real time is reduced, the lag caused by the large number of layers is solved, and the efficiency and user experience of layer synthesis are improved.

WO2025118987A1PCT designated stage expired Publication Date: 2025-06-12HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/133513
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-05
Filing Date
2024-11-21
Publication Date
2025-06-12

AI Technical Summary

Technical Problem

In painting or image processing scenes, when there are many layers, the calculation amount required for real-time layer synthesis is huge, resulting in display lag and affecting the user experience.

Method used

By pre-synthesising the foreground layer, the number of foreground layers participating in real-time synthesis is reduced, thereby improving the efficiency of real-time layer synthesis. The specific method includes determining the layer that meets the binding conditions according to the blending mode of the layer to perform pre-synthesis, and processing only the pre-synthesised intermediate image in the real-time synthesis stage.

Benefits of technology

It effectively improves the efficiency of real-time layer synthesis, reduces lag, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024133513_12062025_PF_FP_ABST
    Figure CN2024133513_12062025_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a layer synthesis method and an electronic device. By means of pre-synthesizing foreground layers, the present application can effectively reduce the number of foreground layers participating in real-time synthesis, thereby improving real-time layer synthesis efficiency. The method comprises: an electronic device acquires a background layer, an activation layer, a first foreground layer, a second foreground layer, and a third foreground layer which are arranged in sequence; the electronic device synthesizes the first foreground layer, the second foreground layer, and the third foreground layer, to generate a first intermediate image; and then, the electronic device synthesizes the background layer, the activation layer, and the first intermediate image, to generate a first target image.
Need to check novelty before this filing date? Find Prior Art

Description

Layer synthesis method and electronic device Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a layer synthesis method and electronic device. Background Art

[0002] With the development of terminal technology, multi-layer blending technology is widely used in painting or image processing scenarios. For example, in a painting scenario, the electronic device responds to the user's drawing operation and displays the user's drawn facial outline on layer 1. Then, in response to the user's operation to create a layer, it creates layer 2. In response to the user's drawing operation, the facial features drawn by the user are displayed on layer 2. Afterwards, using multi-layer blending technology, the electronic device can synthesize layer 1 and layer 2 to display the final entire face image. For another example, in an image processing scenario, the electronic device responds to the user's operation of inputting pictures, obtains multiple pictures, treats each picture as a layer, and synthesizes the multiple layers using multi-layer blending technology to display the final synthesized image.

[0003] Among them, during the layer synthesis process, the electronic device first applies for a texture for storing the blending result. Afterwards, the electronic device synthesizes multiple layers onto the texture in order from bottom to top, and the resulting texture obtained is the final synthesized image. However, in painting or image processing scenarios, electronic devices need to display the image change effects corresponding to user operations in real time for user confirmation. Therefore, electronic devices need to perform layer synthesis in real time. When there are a large number of layers, the amount of calculation required for layer blending is huge, and real-time layer synthesis will cause display freezes, affecting the user experience. Summary of the Invention

[0004] To solve the above technical problems, the present application provides a layer synthesis method and electronic device. The technical solution provided by the present application effectively reduces the number of foreground layers involved in real-time synthesis by pre-synthesizing the foreground layers, thereby improving the efficiency of real-time layer synthesis.

[0005] In order to achieve the above technical objectives, this application provides the following technical solutions:

[0006] In a first aspect, a layer synthesis method is provided for use in an electronic device. The method includes obtaining a background layer, an active layer, a first foreground layer, a second foreground layer, and a third foreground layer, which are sequentially arranged. Synthesizing the first foreground layer, the second foreground layer, and the third foreground layer to generate a first intermediate image. Synthesizing the background layer, the active layer, and the first intermediate image to generate a first target image.

[0007] In this way, in the preprocessing stage, the electronic device pre-synthesizes multiple foreground layers, effectively reducing the number of foreground layers involved in layer synthesis in the real-time processing stage, improving the efficiency of real-time layer synthesis, thereby improving image processing efficiency and avoiding freezes and abnormalities that affect the user experience.

[0008] According to the first aspect, before synthesizing the first foreground layer, the second foreground layer, and the third foreground layer to generate a first intermediate image, the method further includes: based on the blending modes of the first foreground layer, the second foreground layer, and the third foreground layer, determining that a combination condition is satisfied between the first foreground layer, the second foreground layer, and the third foreground layer; the combination condition indicates that the blending order between the plurality of adjacent layers can be changed.

[0009] For example, based on the combine condition, if the composite result of the layers is the same after the layer order is changed, then these layers meet the combine condition. For example, the blending algorithms of these layers are the same and meet the combine condition.

[0010] In this way, the electronic device pre-synthesizes the foreground layers that meet the combination conditions, thereby reducing the number of foreground layers that subsequently participate in the real-time layer synthesis process, thereby improving the layer synthesis efficiency.

[0011] In some examples, the multiple foreground layers included in the layer list may include multiple groups of adjacent foreground layers that meet the join criteria, thereby allowing for pre-compositing multiple sets of intermediate images. Optionally, the multiple foreground layers may also include foreground layers that do not meet the join criteria. Subsequently, these foreground layers that do not meet the join criteria participate in real-time layer compositing to ensure the final layer compositing effect.

[0012] According to the first aspect, or any implementation of the first aspect above, the method further includes: in response to a user operation, swapping the order of the second foreground layer and the third foreground layer without changing the active layer. Subsequently, the first foreground layer, the third foreground layer, and the second foreground layer can be synthesized to obtain a second intermediate image. Based on the aforementioned combination conditions, the second intermediate image is consistent with the previous first intermediate image. In this way, even if the user swaps the second foreground layer and the third foreground layer through operation of the electronic device, the electronic device can still pre-process the foreground layers, thereby improving image processing efficiency and avoiding lag anomalies.

[0013] In other examples, the electronic device can use the first intermediate image as the second intermediate image. Thus, after the user swaps the second foreground layer and the third foreground layer, since the three foreground layers still meet the combination conditions, the electronic device can use the previously obtained first intermediate image as the second intermediate image without having to pre-synthesize the first, third, and second foreground layers, thereby reducing synthesis costs.

[0014] According to the first aspect, or any implementation of the first aspect above, the conditions are specifically characterized as follows: the second foreground layer and the third foreground layer are synthesized to obtain a first transition image; the first transition image and the first foreground layer are synthesized to obtain a second transition image; the first foreground layer and the second foreground layer are synthesized to obtain a third transition image; and the third transition image and the third foreground layer are synthesized to obtain a fourth transition image. The second transition image and the fourth transition image are identical.

[0015] In some examples, from the perspective of image content, the second transition image may be consistent with the first intermediate image, and the fourth transition image may be consistent with the second intermediate image. Thus, by determining whether changing the layer order changes the layer compositing result, it is determined whether the layers meet the combination conditions.

[0016] According to the first aspect, or any implementation of the first aspect above, generating a first target image includes: determining, based on a blending mode of the first intermediate image and the active layer, that a swap condition is not satisfied between the first intermediate image and the active layer, and maintaining the hierarchical order of the background layer, the active layer, and the first intermediate image; the swap condition indicating that the hierarchical order of adjacent layers is interchangeable. Combining the background layer, the active layer, and the first intermediate image to generate the first target image.

[0017] According to the first aspect, or any implementation of the first aspect above, generating a first target image includes: determining, based on a blending mode of the first intermediate image and the activated layer, that a swap condition is satisfied between the first intermediate image and the activated layer; the swap condition indicating that the hierarchical order of adjacent layers is interchangeable; synthesizing the first intermediate image with the background layer to generate a second intermediate image; and synthesizing the second intermediate image with the activated layer to generate the first target image.

[0018] For example, based on the swap condition, swapping the active layer and the first intermediate image does not affect the final layer synthesis result. For example, the blending algorithm of the active layer and the first intermediate image meets the swap condition.

[0019] According to the first aspect, or any implementation of the first aspect above, the swap condition is specifically characterized as follows: the background layer, the activated layer, and the first intermediate image are synthesized in order from bottom to top to obtain a fifth transition image. The background layer, the first intermediate image, and the activated layer are synthesized in order from bottom to top to obtain a sixth transition image. The fifth transition image and the sixth transition image are identical.

[0020] In this way, if the electronic device determines that a foreground layer adjacent to the active layer meets the swap condition with the active layer, it can swap the hierarchical order of the adjacent foreground layer and the active layer, thereby transforming the foreground layer into a background layer and participating in pre-composition. This effectively reduces the number of foreground layers that subsequently participate in real-time layer composition. Optionally, the foreground layer that meets the swap condition can be a single layer or a pre-composite layer.

[0021] In a second aspect, a layer synthesis method is provided for use in an electronic device. The method includes obtaining a background layer set, an active layer, and a first foreground layer, which are sequentially arranged. Synthesizing the first foreground layer with the background layer set to generate a first intermediate image. Synthesizing the active layer with the first intermediate image to generate a first target image.

[0022] In this way, in the preprocessing stage, the electronic device exchanges the hierarchical order of the foreground layer and the activation layer, transforms the foreground layer into a background layer, and pre-synthesizes it with other background layers, effectively reducing the number of foreground layers participating in layer synthesis in the real-time processing stage, thereby improving the efficiency of real-time layer synthesis.

[0023] According to a second aspect, the background layer set includes a first background layer and a second background layer arranged in sequence.

[0024] In some examples, the background layer set may include a single layer that is a composite of a first background layer and a second background layer.

[0025] In this way, electronic devices can first swap the hierarchical order of the foreground layer and the active layer, and then pre-compose the background layer; electronic devices can also pre-compose the background layer first, and then swap the hierarchical order of the foreground layer and the active layer, thus flexibly implementing the layer pre-processing process.

[0026] According to the second aspect, or any implementation of the second aspect above, before synthesizing the first foreground layer and the background layer set to generate the first intermediate image, the method also includes: based on the blending mode of the first foreground layer and the activation layer, determining that the exchange condition is satisfied between the first foreground layer and the activation layer; the exchange condition indicates that the hierarchical order between adjacent layers is interchangeable.

[0027] For example, based on the swap condition, swapping the active layer and the first foreground layer does not affect the final layer composition result. For example, the blending algorithm of the active layer and the first foreground layer meets the swap condition.

[0028] According to the second aspect, or any implementation of the second aspect, the exchange condition is specifically characterized as follows: the first background layer, the second background layer, the active layer, and the first foreground layer are synthesized in order from bottom to top to obtain a first transition image. The first background layer, the second background layer, the first foreground layer, and the active layer are synthesized in order from bottom to top to obtain a second transition image. The first transition image and the second transition image are identical.

[0029] According to the second aspect, or any implementation of the second aspect, the first foreground layer is a composite layer, and the composite layer includes an associated mask layer and a foreground layer.

[0030] In this way, the composite layers in the foreground layer can also participate in and activate the hierarchical order exchange between layers, thereby effectively reducing the number of layers participating in layer synthesis in real time.

[0031] According to the second aspect, or any implementation of the second aspect above, the method also includes: determining the pixel parameter change of the activation layer, re-synthesizing the activation layer after the pixel parameter change and the first intermediate image, and generating a second target image.

[0032] In this way, the layers involved in real-time layer synthesis only include the active layer and the first intermediate image, effectively improving the efficiency of layer synthesis.

[0033] In a third aspect, a layer synthesis method is provided for use in an electronic device. The method includes: obtaining a first background layer, a second background layer, a third background layer, an active layer, and a first foreground layer, which are sequentially arranged; synthesizing the first background layer, the second background layer, and the third background layer to generate a first intermediate image; synthesizing the first foreground layer and the first intermediate image to generate a second intermediate image; and synthesizing the active layer and the second intermediate image to generate a first target image.

[0034] Thus, during the pre-processing phase, the electronic device pre-composites multiple background layers. Furthermore, the electronic device swaps the hierarchical order of the foreground layer and the active layer, transforming the foreground layer into a background layer, and then pre-compositing it with other background layers. This effectively reduces the number of foreground layers involved in layer compositing during the real-time processing phase, thereby improving the efficiency of real-time layer compositing.

[0035] According to the third aspect, before synthesizing the first foreground layer and the first intermediate image to generate the second intermediate image, the method also includes: based on the blending mode of the first foreground layer and the activation layer, determining that an exchange condition is satisfied between the first foreground layer and the activation layer; the exchange condition indicates that the hierarchical order between adjacent layers is interchangeable.

[0036] For example, based on the swap condition, swapping the active layer and the first foreground layer does not affect the final layer composition result. For example, the blending algorithm of the active layer and the first foreground layer meets the swap condition.

[0037] According to the third aspect, or any implementation of the third aspect, the swap condition is specifically characterized as follows: the first intermediate image, the activated layer, and the first foreground layer are synthesized in order from bottom to top to obtain a first transition image. The first intermediate image, the first foreground layer, and the activated layer are synthesized in order from bottom to top to obtain a second transition image. The first transition image and the second transition image are identical.

[0038] According to the third aspect, or any implementation of the third aspect above, before synthesizing the first background layer, the second background layer and the third background layer to generate the first intermediate image, the method also includes: based on the mixing mode of the first background layer, the second background layer and the third background layer, determining that the first background layer, the second background layer and the third background layer meet the combination condition; the combination condition indicates that the mixing order between multiple adjacent layers can be changed.

[0039] According to the third aspect, or any implementation of the third aspect above, specifically characterized by combining the conditions: the first background layer and the second background layer are synthesized to obtain a third transition image; the third transition image and the third background layer are synthesized to obtain a fourth transition image; the second background layer and the third background layer are synthesized to obtain a fifth transition image; and the fifth transition image and the first background layer are synthesized to obtain a sixth transition image. The fourth transition image and the sixth transition image are identical.

[0040] For example, based on the combine condition, if the composite result of the layers is the same after the layer order is changed, then these layers meet the combine condition. For example, the blending algorithms of these layers are the same and meet the combine condition.

[0041] In a fourth aspect, an electronic device is provided. The electronic device includes a processor and a memory, the memory being coupled to the processor and configured to store computer program code. The computer program code includes computer instructions. When the processor reads the computer instructions from the memory, the electronic device executes the following steps: obtaining a background layer, an active layer, a first foreground layer, a second foreground layer, and a third foreground layer, which are sequentially arranged; synthesizing the first foreground layer, the second foreground layer, and the third foreground layer to generate a first intermediate image; and synthesizing the background layer, the active layer, and the first intermediate image to generate a first target image.

[0042] According to the fourth aspect, when the processor reads computer instructions from the memory, it also causes the electronic device to execute: based on the mixing mode of the first foreground layer, the second foreground layer and the third foreground layer, determine that the first foreground layer, the second foreground layer and the third foreground layer meet the combination condition; the combination condition indicates that the mixing order between multiple adjacent layers can be changed.

[0043] According to the fourth aspect, or any implementation of the fourth aspect above, the conditions are specifically characterized as follows: the second foreground layer and the third foreground layer are synthesized to obtain a first transition image; the first transition image and the first foreground layer are synthesized to obtain a second transition image; the first foreground layer and the second foreground layer are synthesized to obtain a third transition image; and the third transition image and the third foreground layer are synthesized to obtain a fourth transition image. The second transition image and the fourth transition image are identical.

[0044] According to the fourth aspect, or any implementation of the fourth aspect above, generating the first target image includes: determining, based on a blending mode of the first intermediate image and the active layer, that a swap condition is not satisfied between the first intermediate image and the active layer, and maintaining the hierarchical order of the background layer, the active layer, and the first intermediate image; the swap condition indicating that the hierarchical order of adjacent layers is interchangeable. Combining the background layer, the active layer, and the first intermediate image to generate the first target image.

[0045] According to the fourth aspect, or any implementation of the fourth aspect above, generating the first target image includes: determining, based on a blending mode of the first intermediate image and the activated layer, that a swap condition is satisfied between the first intermediate image and the activated layer; the swap condition indicating that the hierarchical order of adjacent layers is interchangeable; synthesizing the first intermediate image with the background layer to generate a second intermediate image; and synthesizing the second intermediate image with the activated layer to generate the first target image.

[0046] According to the fourth aspect, or any implementation of the fourth aspect, the swap condition is specifically characterized as follows: the background layer, the activated layer, and the first intermediate image are synthesized in order from bottom to top to obtain a fifth transition image. The background layer, the first intermediate image, and the activated layer are synthesized in order from bottom to top to obtain a sixth transition image. The fifth transition image and the sixth transition image are identical.

[0047] In a fifth aspect, an electronic device is provided. The electronic device includes a processor and a memory, the memory being coupled to the processor and configured to store computer program code. The computer program code includes computer instructions. When the processor reads the computer instructions from the memory, the electronic device executes the following steps: obtaining a background layer set, an active layer, and a first foreground layer that are sequentially arranged; synthesizing the first foreground layer and the background layer set to generate a first intermediate image; and synthesizing the active layer and the first intermediate image to generate a first target image.

[0048] According to the fifth aspect, the background layer set includes a first background layer and a second background layer arranged in sequence; or, the background layer set may include a single layer obtained by synthesizing the first background layer and the second background layer.

[0049] According to the fifth aspect, or any implementation of the fifth aspect above, when the processor reads computer instructions from the memory, it also enables the electronic device to execute: based on the mixing mode of the first foreground layer and the activation layer, determine that the exchange condition is satisfied between the first foreground layer and the activation layer; the exchange condition indicates that the hierarchical order between adjacent layers is interchangeable.

[0050] According to the fifth aspect, or any implementation of the fifth aspect, the exchange condition is specifically characterized as follows: the first background layer, the second background layer, the active layer, and the first foreground layer are synthesized in order from bottom to top to obtain a first transition image. The first background layer, the second background layer, the first foreground layer, and the active layer are synthesized in order from bottom to top to obtain a second transition image. The first transition image and the second transition image are identical.

[0051] According to the fifth aspect, or any implementation of the fifth aspect, the first foreground layer is a composite layer, and the composite layer includes an associated mask layer and a foreground layer.

[0052] According to the fifth aspect, or any implementation of the above fifth aspect, when the processor reads computer instructions from the memory, it also enables the electronic device to execute: determining the pixel parameter change of the activated layer, re-synthesizing the activated layer after the pixel parameter change and the first intermediate image, and generating a second target image.

[0053] In a sixth aspect, an electronic device is provided. The electronic device includes: a processor and a memory, the memory being coupled to the processor, the memory being configured to store computer program code, the computer program code comprising computer instructions. When the processor reads the computer instructions from the memory, the electronic device executes the following steps: obtaining a first background layer, a second background layer, a third background layer, an activation layer, and a first foreground layer, which are sequentially arranged; synthesizing the first background layer, the second background layer, and the third background layer to generate a first intermediate image; synthesizing the first foreground layer and the first intermediate image to generate a second intermediate image; and synthesizing the activation layer and the second intermediate image to generate a first target image.

[0054] According to the sixth aspect, when the processor reads computer instructions from the memory, it also enables the electronic device to execute: based on the mixing mode of the first foreground layer and the activation layer, determine that the exchange condition is satisfied between the first foreground layer and the activation layer; the exchange condition indicates that the hierarchical order between adjacent layers is interchangeable.

[0055] According to the sixth aspect, or any implementation of the sixth aspect, the swap condition is specifically characterized as follows: the first intermediate image, the activated layer, and the first foreground layer are synthesized in order from bottom to top to obtain a first transition image. The first intermediate image, the first foreground layer, and the activated layer are synthesized in order from bottom to top to obtain a second transition image. The first transition image and the second transition image are identical.

[0056] According to the sixth aspect, or any implementation of the sixth aspect above, when the processor reads computer instructions from the memory, it also causes the electronic device to execute: based on the mixing mode of the first background layer, the second background layer and the third background layer, determine that the first background layer, the second background layer and the third background layer meet the combination condition; the combination condition indicates that the mixing order between multiple adjacent layers can be changed.

[0057] According to the sixth aspect, or any implementation of the sixth aspect above, specifically characterized by combining the conditions: the first background layer and the second background layer are synthesized to obtain a third transition image; the third transition image and the third background layer are synthesized to obtain a fourth transition image; the second background layer and the third background layer are synthesized to obtain a fifth transition image; and the fifth transition image and the first background layer are synthesized to obtain a sixth transition image. The fourth transition image and the sixth transition image are identical.

[0058] In a seventh aspect, an electronic device is provided, the electronic device having the function of implementing the layer composition method described in the first aspect and any possible implementation thereof; or the electronic device having the function of implementing the layer composition method described in the second aspect and any possible implementation thereof; or the electronic device having the function of implementing the layer composition method described in the third aspect and any possible implementation thereof. This function can be implemented in hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions.

[0059] In an eighth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program (also referred to as instructions or code). When the computer program is executed by an electronic device, the electronic device performs the method of the first aspect or any one of the embodiments of the first aspect; or performs the method of the second aspect or any one of the embodiments of the second aspect; or performs the method of the third aspect or any one of the embodiments of the third aspect.

[0060] In the ninth aspect, a computer program product is provided. When the computer program product is run on an electronic device, the electronic device executes the method of the first aspect or any one of the embodiments of the first aspect; or, the electronic device executes the method of the second aspect or any one of the embodiments of the second aspect; or, the electronic device executes the method of the third aspect or any one of the embodiments of the third aspect.

[0061] In a tenth aspect, a circuit system is provided, the circuit system including a processing circuit, the processing circuit being configured to execute the method of the first aspect or any one of the embodiments of the first aspect; or, the processing circuit being configured to execute the method of the second aspect or any one of the embodiments of the second aspect; or, the processing circuit being configured to execute the method of the third aspect or any one of the embodiments of the third aspect.

[0062] In the eleventh aspect, a chip system is provided, comprising at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to the at least one processor. When the at least one processor executes the instructions, the at least one processor executes the method of the first aspect or any one of the embodiments of the first aspect; or, the at least one processor executes the method of the second aspect or any one of the embodiments of the second aspect; or, the at least one processor executes the method of the third aspect or any one of the embodiments of the third aspect.

[0063] The technical effects of the aforementioned aspects can be referenced with each other and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] FIG1 is a schematic diagram of a layer display interface provided in an embodiment of the present application;

[0065] FIG2 is a schematic diagram of layer mixing provided in an embodiment of the present application;

[0066] FIG3 is a schematic diagram of pre-synthesis of a background layer according to an embodiment of the present application;

[0067] FIG4 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0068] FIG5 is a schematic diagram of a software structure block diagram of an electronic device provided in an embodiment of the present application;

[0069] FIG6 is a first flow chart of a layer synthesis method according to an embodiment of the present application;

[0070] FIG7 is a second flow chart of the layer synthesis method provided in an embodiment of the present application;

[0071] FIG8 is a schematic diagram of a composite layer pre-synthesis scene provided in an embodiment of the present application;

[0072] FIG9 is a schematic diagram of exchange conditions provided in an embodiment of the present application;

[0073] FIG10 is a schematic diagram of a scenario in which the hierarchical order of layers is exchanged based on exchange conditions according to an embodiment of the present application;

[0074] FIG11 is a schematic diagram of the combination conditions provided in an embodiment of the present application;

[0075] FIG12 is a schematic diagram of a scene for grouping and pre-compositing foreground layers based on a combination condition provided by an embodiment of the present application;

[0076] FIG13 is a schematic diagram of a scene of pre-synthesis of a background layer provided in an embodiment of the present application;

[0077] FIG14 is a first schematic diagram of a layer synthesis scene provided in an embodiment of the present application;

[0078] FIG15 is a second schematic diagram of a layer synthesis scene provided in an embodiment of the present application;

[0079] FIG16 is a third schematic diagram of a layer synthesis scene provided in an embodiment of the present application;

[0080] FIG17 is a fourth schematic diagram of a layer synthesis scene provided in an embodiment of the present application;

[0081] FIG18 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0082] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two).

[0083] References to "one embodiment" or "some embodiments" etc. described in this specification mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in another way. The term "connected" includes direct and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0084] In the embodiments of this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.

[0085] First, the technical terms involved in the embodiments of the present application are introduced:

[0086] 1) Pixel: The basic unit of image display, which cannot be divided any further. Each pixel is a small grid of a single color.

[0087] 2) Texture: A data object that contains image information. For example, this data object could be an array of pixels, where each pixel's data represents its color. The array of pixels could represent the entire image. For example, a texture could be the memory that stores a layer or image.

[0088] 3) Image Layer: In image processing or painting applications, a layer is a component of an artwork (or image). An artwork can be composed of multiple layers, each containing different visual elements. Layers can be stacked on top of each other and blended to create the final effect. Each layer can be modified independently without affecting the content of other layers.

[0089] 4) Blend: Take multiple layers as input and output a result image.

[0090] 5) Synthesize: Take multiple layers as input and output a result image.

[0091] 6) Blend Algorithm: The calculation method of layer blending usually takes the textures of two layers as input and outputs a texture as the blending result.

[0092] 7) Blend Mode: The way layers are blended. Each blend mode corresponds to a blending algorithm that determines the resulting blended layer. The art world has defined a set of common blend modes, including Normal, Multiply, Linear Burn, and Screen.

[0093] Among them, Normal mode is the default mode in the blending mode, which is used to indicate the display of the pixels of the blended color layer without any layer blending, which means that the base color layer (background layer) has no effect on the blended color layer. Multiply mode is used to indicate that the grayscale levels of the pixel colors of the upper and lower layers are multiplied to obtain a color with a lower grayscale level as the composite color. The effect after the layer synthesis is simply that the low-grayscale pixels appear and the high-grayscale pixels do not appear. Linear Burn mode is used to indicate that the background color is darkened to reflect the blended color by reducing the brightness. Screen mode is the opposite of Multiply mode. It is used to indicate that the grayscale levels of the pixel colors of the upper and lower layers are multiplied to obtain a color with a higher grayscale level as the composite color. The effect after the layer synthesis is simply that the high-grayscale pixels appear and the low-grayscale pixels do not appear.

[0094] In some examples, different blending modes and blending algorithms for implementing the blending modes are preconfigured in the electronic device. The electronic device detects a user's operation of setting a blending mode for a layer and determines the blending mode and blending algorithm for the layer.

[0095] 8) Mask: A special layer that acts on other layers to produce special effects.

[0096] 9) Compound Layer: A special layer group, usually composed of layers and masks, used to achieve specific combination effects.

[0097] 10) Layer List: The layers in the work are arranged in order from bottom to top.

[0098] 11) Active Layer: The layer that the user is currently modifying.

[0099] 12) Background Layer: The layer below the active layer in the layer list.

[0100] 13) Foreground Layer: The layer above the active layer in the layer list.

[0101] 14) Painting Latency: The delay between the pen tip drawing on the screen and the ink appearing on the screen.

[0102] 15) Exchange condition: For a hybrid algorithm f(A,B), if swapping its first input with its second input does not produce the same result, i.e., f(A,B) = f(B,A), then the hybrid algorithm is said to satisfy the exchange condition.

[0103] 16) Combination condition: For a hybrid algorithm f(A,B), when it appears on two consecutive layers, if the order of calculation is changed and the result remains unchanged, that is, f(f(A,B),C) = f(A,f(B,C)), then this hybrid algorithm is said to meet the combination condition.

[0104] In some embodiments, multi-layer blending technology is widely used in painting or image processing scenarios. For example, in a painting scenario, the electronic device responds to the user's drawing operation and displays the user's drawn facial outline on layer 1. Then, in response to the user's operation to create a layer, it creates layer 2. And in response to the user's drawing operation, the eyes of the person drawn by the user are displayed on layer 2. Afterwards, the aforementioned steps are repeated, and the electronic device creates more layers for drawing other facial features, hair, and other content of the person based on the user's operation. Afterwards, using multi-layer blending technology, the electronic device can synthesize the multiple created layers to display the final entire face image. For another example, in an image processing scenario, the electronic device responds to the user's operation of inputting pictures, obtains multiple pictures, treats each picture as a layer, and synthesizes the multiple layers using multi-layer blending technology to display the final synthesized image.

[0105] During the layer synthesis process, the electronic device first applies for a texture to store the blending result. Then, the electronic device synthesizes multiple layers onto this texture in order from bottom to top. The resulting texture is the final synthesized image.

[0106] Exemplarily, as shown in FIG1(a), in a drawing scene, the electronic device displays a menu bar 11, which can be used to display the layer information corresponding to the currently drawn image. The image includes at least one layer, and the electronic device manages the at least one layer through a layer management module. In some examples, a layer corresponds to a structure, which includes multiple member variables, and each member variable corresponds to a type of layer information. For example, as shown in the scene shown in FIG1(a), the currently drawn image includes 4 layers, and the layer list managed by the layer management module includes the layer information of these 4 layers, wherein the layer currently being edited by the user is layer 3. As shown in the menu bar 11, the member variables corresponding to layer 3 include layer name, blending mode, etc., that is, the layer information includes layer name, blending mode, etc.

[0107] In some examples, the electronic device may determine the active layer based on the user's operation, where the active layer is the layer operated by the user. For example, as shown in FIG1 (a), the current layer 3 is the active layer, and the layer information corresponding to layer 3 includes information indicating that layer 3 is the active layer. The electronic device may switch layers based on the user's operation, thereby determining a new active layer. For example, the electronic device detects the user's operation on layer option 12 and displays the interface shown in FIG1 (b). As shown in reference numeral 13, the electronic device displays multiple layers of the image currently being drawn, and the user can instruct the electronic device to switch to display the layer to be edited as needed. Afterwards, as shown in reference numeral 14 in FIG1 (c), the electronic device switches to display layer 2 based on the user's selection operation, and sets the layer information of layer 2 to include information indicating that layer 2 is the active layer, and modifies the layer information of layer 3. The modified layer information includes information indicating that layer 3 is the background layer.

[0108] It should be understood that the electronic device can also obtain the active layer through other methods. For example, after the electronic device launches a painting application (or other application such as an image processing application), it sets the top layer as the active layer and displays the active layer; or it sets the layer last edited after closing the painting application as the active layer and displays the active layer. Alternatively, the electronic device can also determine the active layer through other methods.

[0109] In some examples, the layer the user is editing is the active layer (or described as the focus layer), the layers below it are background layers, and the layers above it are foreground layers. When the active layer is the top layer, there is no foreground layer; when the active layer is the bottom layer, there is no background layer.

[0110] For example, as shown in the scene in Figure 1(b), the layer list includes four layers corresponding to the currently displayed image. Based on user operations, the electronic device can add or delete layers, or change the hierarchical order of the layers. In response to the user selecting layer 3, the electronic device determines that layer 3 is currently the active layer, layer 4 is the background layer, and layers 1 and 2 are the foreground layers.

[0111] In some examples, users can set a blending mode for each layer. Each blending mode corresponds to a blending algorithm. The blending algorithm for a layer defines the calculation method used to blend the layer onto the texture. In some examples, blending modes include Normal mode, Multiply mode, and so on.

[0112] For example, as shown in Figure 1 (a), the current blending mode of layer 3 is Multiply mode. In response to the user's operation on blending mode option 15, the electronic device determines that the user has instructed to set the blending mode of layer 3, and the electronic device may display the interface shown in Figure 1 (d). As shown in reference numeral 16, the user can select a blending mode to set for layer 3 as needed. For example, as shown in reference numeral 17 in Figure 1 (e), the electronic device sets the blending mode of layer 3 to Linear Burn mode based on the user's operation.

[0113] In some examples, as shown in Figure 2, the blending algorithm f(A, B) corresponding to the blending mode of layer X is a binary operation. Its first input is the composite result of the layers below layer X, and its second input is layer X itself. Its output C = f(A, B) is the blending result of layer X and the layers below it.

[0114] However, in painting or image processing scenarios, users typically manipulate a layer within an image, and the electronic device needs to display the corresponding image changes in real time for user confirmation. Therefore, the electronic device needs to perform real-time layer compositing. However, when there are many layers, the computational complexity required for layer blending is enormous, and real-time layer compositing can cause drawing delays, resulting in poor display responsiveness, lags, and inefficient drawing or image processing.

[0115] In some embodiments, the electronic device pre-synthesizes some layers by pre-compositing them. This reduces the number of layers to be synthesized during real-time layer synthesis, thereby improving synthesis efficiency and avoiding lags.

[0116] In some examples, during painting or image processing, users generally only operate the content on the active layer and do not change the content of the background layer. Then, as shown in Figure 3, after determining the active layer, the electronic device can perform a pre-processing stage, first apply for a temporary texture, and synthesize all background layers onto the temporary texture. Afterwards, in the real-time layer synthesis stage, the electronic device synthesizes the active layer directly onto the temporary texture according to the content changes on the active layer. After synthesizing the result texture, one or more foreground layers are sequentially synthesized onto the result texture in order from bottom to top to obtain the final synthesis result. Among them, in the pre-synthesis process, the synthesis of the background layer does not change the order of the layer synthesis from bottom to top, so the accuracy of the synthesis result can be guaranteed. In addition, the number of layers involved in real-time synthesis is reduced, and the performance of real-time layer synthesis is improved.

[0117] However, in scenes with many foreground layers, the above solution has limited effect on improving the efficiency of layer synthesis and may still cause lag and abnormality, affecting the user experience.

[0118] In some embodiments, the layer synthesis method provided in the embodiments of the present application can be applied to an electronic device 100. In some examples, the electronic device 100 can be, for example, a mobile phone, a tablet computer, a laptop computer, a smart screen, a wearable device, a vehicle terminal, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an artificial intelligence (AI) device, or other terminal device with a display function. The operating system installed on the electronic device 100 includes but is not limited to This application does not limit the specific type of the electronic device 100 or the installed operating system.

[0119] FIG4 shows a schematic structural diagram of the electronic device 100 .

[0120] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0121] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0122] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0123] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0124] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0125] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.

[0126] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C bus lines. The processor 110 may be coupled to a touch sensor, a charger, a flash, a camera 193, and the like via different I2C bus interfaces. For example, the processor 110 may be coupled to a touch sensor via an I2C interface, enabling communication between the processor 110 and the touch sensor via the I2C bus interface, thereby enabling touch functionality of the electronic device 100.

[0127] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and the camera 193. MIPI interfaces include the camera serial interface (CSI) and the display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the electronic device 100. The processor 110 and the display 194 communicate via the DSI interface to implement the display function of the electronic device 100.

[0128] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.

[0129] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0130] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device via the power management module 141.

[0131] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0132] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0133] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0134] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0135] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs the sound signal through the audio device or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.

[0136] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0137] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0138] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0139] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be manufactured using a liquid crystal display (LCD), for example, an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini-LED, a Micro-LED, a Micro-OLED, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 can include one or N display screens 194, where N is a positive integer greater than one.

[0140] In some embodiments, while displaying an image on display screen 194, electronic device 100 detects a user editing the image. Processor 110 determines the layer containing the image content currently being edited by the user and designates that layer as the active layer. Subsequently, electronic device 100, through processor 110, may perform a layer preprocessing phase on the foreground layer and / or background layer, effectively reducing the number of layers involved in real-time compositing. Electronic device 100 then displays the final real-time layer compositing results on display screen 194, allowing the user to confirm the editing effect.

[0141] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0142] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0143] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0144] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be set in the processor 110, or some functional modules of the audio module 170 can be set in the processor 110. The electronic device 100 can use the audio module 170, such as music playback and recording. The audio module 170 may include a speaker, a receiver, a microphone, a headphone jack, and an application processor to implement audio functions.

[0145] The sensor module 180 may include a pressure sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.

[0146] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0147] Motor 191 can generate vibration alerts. This can be used for incoming call vibration alerts or touch vibration feedback. Depending on the touch operation applied to different areas of the display 194, motor 191 can also generate different vibration feedback effects. Different application scenarios (e.g., time reminders, receiving messages, alarm clocks, gaming, etc.) can also correspond to different vibration feedback effects.

[0148] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0149] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and disconnected from the electronic device 100 by inserting or removing the SIM card into or from the SIM card interface 195. The electronic device 100 may support one or N SIM card interfaces, where N is a positive integer greater than one.

[0150] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present application, the Android system with a layered architecture is used as an example to illustrate the software structure of the electronic device 100.

[0151] FIG5 is a block diagram of the software structure of the electronic device 100 according to an embodiment of the present application.

[0152] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0153] The application layer can include a series of application packages.

[0154] As shown in FIG5 , the application package may include target application, contacts, memo, call, clipboard, gallery, map, camera, video and other applications.

[0155] In some examples, the target application is an image processing application, a drawing application, or other application with image display and processing functions. In some examples, the target application is configured with functional logic such as a user interface, artwork management, layer management, brushes, and filters.

[0156] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0157] As shown in FIG5 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.

[0158] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.

[0159] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0160] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.

[0161] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including answering, hanging up, etc.).

[0162] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0163] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.

[0164] The Android runtime includes the core library and the virtual machine. The Android runtime is responsible for scheduling and management of the Android system.

[0165] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0166] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0167] The system library may include a rendering engine. It may also include multiple other functional modules, such as a surface manager, media libraries, a 3D graphics library (e.g., OpenGL ES), and a 2D graphics engine (e.g., SGL).

[0168] In some embodiments, the drawing engine is used to implement the painting or image processing functions of the target application. The drawing engine includes, for example, modules such as layer synthesis, brush drawing, filters, and rendering pipelines. These modules can configure the rendering pipeline according to their own logical assembly, and the rendering pipeline is used to generate rendering instructions. For example, the layer synthesis module is used to perform the preprocessing process and the real-time synthesis process of the layers. During the preprocessing process, the layer synthesis module performs preprocessing such as adjusting the hierarchical order of the layers and pre-synthesizing some layers. Afterwards, in the real-time synthesis process of the layers, the layer synthesis module synthesizes the preprocessed layers (or textures). Moreover, before the layer synthesis, the layer synthesis module triggers the rendering pipeline to generate rendering instructions to instruct the electronic device 100 to synthesize the rendered layers.

[0169] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0170] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0171] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0172] The two-dimensional graphics engine is a drawing engine for 2D drawing. In some examples, the drawing engine includes a three-dimensional graphics processing library and a two-dimensional graphics engine.

[0173] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.

[0174] In some examples, the kernel layer and the system library include interfaces for the GPU to call GPU storage and computing functions, such as rendering hardware interfaces. In some examples, the rendering hardware interfaces include direct extension (DX) 12 interfaces, Metal interfaces, Vulkan interfaces, OpenGL interfaces, etc.

[0175] Figure 6 is a flow chart of a layer synthesis method provided in an embodiment of the present application. It should be noted that the method is not limited to the specific sequence shown in Figure 6 and below. It should be understood that in other embodiments, the order of some steps in the method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:

[0176] S601: The electronic device obtains layer information.

[0177] In some embodiments, the electronic device launches a target application and displays the target application's interface in response to a user operation. On the target application's interface, the electronic device determines the layer indicated by the user's operation based on the user operation and designates that layer as the active layer. Based on the positional relationship between the active layer and other layers in the layer list, the electronic device can obtain layer information for foreground layers above the active layer, layer information for the activated layer, and layer information for background layers below the activated layer.

[0178] Exemplarily, the target application is a painting application. The electronic device displays image A in the target application, and the layer list of image A includes three layers from top to bottom: layer 1, layer 2, and layer 3. The electronic device detects that the user clicks on layer 2 in the layer list, and determines that the user instructs to edit the content on layer 2. Then, the electronic device can determine that the layer information includes layer 2 as the active layer, layer 1 as the foreground layer, and layer 3 as the background layer. Alternatively, when the electronic device is displaying the editing interface corresponding to layer 3, it detects the user's operation of adding a new layer, and can add layer 4 below layer 3 and display the editing interface of layer 4. In addition, the electronic device can determine that the layer information includes layer 4 as the active layer, and layer 1, layer 2, and layer 3 as the foreground layers. In the scenario of editing layer 4, the layer information may not include the background layer.

[0179] In another exemplary embodiment, the target application is an image processing application. The electronic device receives user input of Picture 1, Picture 2, and Picture 3, and creates Layer 1 for editing Picture 1, Layer 2 for editing Picture 2, and Layer 3 for editing Picture 3. The electronic device detects the user's instruction to edit Picture 2 and determines that the layer information includes information that Layer 2 is the active layer, Layer 1 above Layer 2 is the foreground layer, and Layer 3 below Layer 2 is the background layer.

[0180] S602: The electronic device determines that there is a preprocessable layer in the foreground layer.

[0181] When there is a pre-processable layer in the foreground layer, step S603 is executed; when there is no pre-processable layer in the foreground layer, step S604 is executed.

[0182] In some embodiments, in order to reduce the number of layers synthesized in real time, the electronic device may process the foreground layer and / or the background layer in advance.

[0183] In some examples, electronic devices can reduce the number of layers in the foreground layer that participate in subsequent real-time synthesis through preprocessing, thereby effectively improving the efficiency of real-time synthesis. Therefore, when the electronic device determines that there are layers in the foreground layer that can be preprocessed, it can execute step S603 to preprocess the foreground layer. Alternatively, when the electronic device determines that there are no layers in the foreground layer that can be preprocessed, it can execute step S604 to preprocess the background layer, where preprocessing the background layer means presynthesizing the background layer.

[0184] Exemplarily, the electronic device determines that a layer satisfies any one of the composite layer combination condition, the exchange condition, and the combination condition, and may determine that there is a layer that can be preprocessed.

[0185] A composite layer includes associated mask layers and regular layers. For example, after obtaining a foreground layer, the electronic device may determine that adjacent foreground layers can be combined into a composite layer. The electronic device may then pre-combine these foreground layers into a composite layer, thereby reducing the number of foreground layers that subsequently participate in real-time layer composition. It should be understood that there is no limit to the number of foreground layers that can comprise a composite layer.

[0186] Among them, the exchange condition indicates that the hierarchical order between adjacent layers is interchangeable. For example, the electronic device obtains the background layer, activation layer, and first foreground layer that are set in sequence. The electronic device synthesizes the background layer, activation layer, and first foreground layer in order from bottom to top to obtain a first transition image. The background layer, first foreground layer, and activation layer are synthesized in order from bottom to top to obtain a second transition image. Among them, if the first transition image and the second transition image are consistent. Then the electronic device can determine that there is a first foreground layer and activation layer that meet the exchange condition. In some examples, the electronic device pre-processes the first foreground layer and activation layer that meet the exchange condition, such as exchanging the hierarchical order of the first foreground layer and the activation layer, and transforms the first foreground layer into a background layer, thereby reducing the number of foreground layers that subsequently participate in real-time synthesis and improving the efficiency of layer synthesis.

[0187] The combination condition indicates that the blending order between multiple adjacent layers can be changed. For example, an electronic device obtains a first foreground layer, a second foreground layer, and a third foreground layer, which are sequentially arranged. The electronic device synthesizes the second foreground layer and the third foreground layer to obtain a first transition image; synthesizes the first transition image and the first foreground layer to obtain a second transition image. The electronic device synthesizes the first foreground layer and the second foreground layer to obtain a third transition image; and synthesizes the third transition image and the third foreground layer to obtain a fourth transition image. If the second transition image and the fourth transition image are consistent, the electronic device can determine that the first foreground layer, the second foreground layer, and the third foreground layer meet the combination condition. In some examples, the electronic device preprocesses the first foreground layer, the second foreground layer, and the third foreground layer that meet the combination condition to generate an intermediate image. This effectively reduces the number of foreground layers involved in the subsequent real-time layer synthesis process, improving layer synthesis efficiency.

[0188] In some examples, the electronic device determines whether a layer is eligible for preprocessing by identifying whether a layer satisfies the aforementioned composite layer combination conditions, swap conditions, and join conditions. Details of the composite layer combination conditions, swap conditions, and join conditions are described below.

[0189] In some examples, electronic devices can use pre-processing to reduce the number of layers in the background layer that participate in subsequent real-time compositing, effectively improving the efficiency of real-time compositing. Therefore, electronic devices can perform pre-compositing on the background layer. Compositing the background layer does not change the order of layer compositing from bottom to top, thus ensuring the accuracy of the compositing result.

[0190] It should be understood that in some scenarios, the embodiments of the present application do not limit the execution order between step S602 and step S604. For example, the preprocessing of the foreground layer by the electronic device includes pre-synthesis of part of the foreground layer, and the pre-synthesis of the foreground layer does not affect the pre-synthesis of the background layer. Then, the electronic device may also execute step S604 first, and then execute step S602 and step S603; or, the electronic device executes step S604, and step S602 and step S603 at the same time. In other scenarios, the preprocessing of the foreground layer by the electronic device includes adjusting the hierarchical order of the layers and changing the foreground layer into the background layer, then the electronic device needs to execute these steps in the order of step S602, step S603 and step S604. Among them, the preprocessing method of the electronic device to adjust the hierarchical order of the layers is detailed in step S603 and will not be repeated here.

[0191] S603: The electronic device pre-processes the foreground layer.

[0192] In some embodiments, the electronic device's preprocessing of the foreground layer includes one or more of composite layer synthesis, layer order exchange, and foreground layer group pre-synthesis.

[0193] Exemplarily, as shown in FIG. 7 , step S603 includes steps S6031 to S6033 , and various pre-processing methods of the foreground layer are introduced through steps S6031 to S6033 .

[0194] S6031. The electronic device performs composite layer synthesis on the foreground layer.

[0195] Among them, a composite layer is a special layer group, usually composed of layers and masks, which is used to achieve a specific combination effect. Then, in some examples, when the electronic device determines that the foreground layer includes foreground layers that can be combined into a composite layer, it can first pre-synthesize these foreground layers to generate a composite layer. The composite layer can be stored in the electronic device in the form of a temporary texture, thereby reducing the number of foreground layers and further reducing the number of layers participating in the real-time layer synthesis. In some examples, a group of composite layers includes at least one layer and at least one mask. For example, a composite layer can include a foreground layer and a mask layer.

[0196] Among them, the combination effect of the composite layer is achieved by mixing the layers and masks included in the composite layer. Therefore, compositing the composite layer in advance will not affect the final result of the subsequent layer synthesis.

[0197] Exemplarily, as shown in FIG8 , the electronic device obtains a layer list, determines the activated layer A[m] in response to a user operation, and determines the foreground layer A[m+1]…A[n] located above the activated layer based on the layer position relationship in the layer list. Afterwards, the electronic device traverses the foreground layers A[m+1]…A[n]. If the electronic device determines that the layers from the i-th layer to the j-th layer form a composite layer, the electronic device pre-synthesizes A[i] to A[j] to generate a composite layer. Afterwards, the electronic device continues to traverse the foreground layers, and in the process of traversing the foreground layers, skips A[i+1] to A[j]. The electronic device repeats the aforementioned steps until the synthesis of all composite layers included in the foreground layer is completed. Wherein, m, i, j are positive integers.

[0198] In some examples, after an electronic device synthesizes foreground layers A[i] through A[j] to obtain a composite layer, it may determine the hierarchical order of the composite layer to be the hierarchical order of the composite foreground layers that is closest to the active layer. For example, as shown in Figure 8, after the electronic device pre-synthesizes foreground layers A[i] through A[j], it obtains composite layer A[i].

[0199] In some examples, the electronic device obtains a composite layer by pre-compositing a foreground layer. The composite layer can also be described as an intermediate image generated during the layer synthesis process.

[0200] In some examples, the electronic device may also traverse the background layer and obtain the composite layer included in the background layer during the process of pre-synthesizing the composite layer.

[0201] In this way, electronic devices can effectively reduce the number of foreground layers through pre-synthesis of composite layers, thereby reducing the number of layers involved in real-time synthesis during subsequent real-time layer synthesis, improving layer synthesis efficiency, reducing painting delays, and improving user experience.

[0202] S6032. The electronic device exchanges the layer order of the foreground layer.

[0203] In some embodiments, if the hierarchical order of the foreground layer and the active layer can be swapped, the foreground layer can be turned into a background layer, and the number of foreground layers that subsequently participate in real-time synthesis can be reduced.

[0204] In some examples, for a layer blending algorithm, if for a blending algorithm f(A,B), swapping its first input and second input does not change the result, that is, f(A,B) = f(B,A), then this blending algorithm is said to satisfy the exchange condition.

[0205] For example, as shown in Figure 9, a layer list includes layer A and layer B, where layer B is above layer A. Layer B's blending algorithm is f, and the blending result of layers A and B is layer C = f(A, B). If the electronic device swaps the positions of layers A and B, placing layer A above layer B, the blending result of layers B and A is C' = f(B, A). If C' is the same as C, the electronic device can determine that the blending algorithm f(A, B) meets the swap condition. In other words, even if the electronic device swaps the positions of layers A and B, it will not affect the final result of the layer synthesis.

[0206] For example, Table 1 shows some common mixing modes that meet the exchange condition and their corresponding mixing algorithms. It should be understood that the mixing algorithms of the mixing modes that meet the exchange condition are not limited to those shown in Table 1.

[0207] Table 1

[0208] In some embodiments, after determining the active layer, the electronic device may obtain a foreground layer adjacent to the active layer and determine whether the blending algorithm for the foreground layer and the active layer meets the swap condition. If so, the electronic device may swap the layer hierarchy between the foreground layer and the active layer, thereby turning the foreground layer into a background layer adjacent to the active layer.

[0209] The electronic device repeats the above steps until it determines that the blending algorithm of the foreground layer adjacent to the activated layer does not meet the exchange conditions, and stops exchanging the hierarchical order of the foreground layers. At this time, the electronic device has changed the hierarchical order of multiple consecutive layers above the activated layer whose blending algorithms meet the exchange conditions to become background layers.

[0210] In some examples, if the blending algorithm between the active layer and the adjacent foreground layer does not meet the swap condition, the electronic device may no longer perform a layer swap on the foreground layer. In other words, the electronic device no longer needs to determine whether the blending algorithm of the layer adjacent to the active layer meets the swap condition.

[0211] For example, as shown in Figure 10, the electronic device obtains a layer list and, in response to a user operation, determines the active layer A[m]. Based on the hierarchical relationship of the layers in the layer list, the electronic device can determine whether the blending algorithms for k consecutive foreground layers A[m+1]…A[m+k] located above and adjacent to the active layer satisfy the exchange condition with the blending algorithm for the active layer, where k is an integer. The electronic device can then move the k consecutive foreground layers A[m+1]…A[m+k] below the active layer A[m].

[0212] In some cases, as shown in Figure 10, the blending algorithm for foreground layer A[m+k+1] and the blending algorithm for the active layer do not meet the swap conditions. Therefore, the electronic device does not swap the foreground layer A[m+k+1] and the foreground layers above foreground layer A[m+k+1] with the background layer.

[0213] Among them, since the mixing algorithms of the activated layer and the activated layers participating in the exchange both meet the exchange conditions, the final result of the layer synthesis will not be affected after the hierarchical order of the foreground layer and the activated layer is exchanged. Therefore, the electronic device can exchange adjacent layers whose mixing algorithms meet the exchange conditions. In some examples, the layer synthesis result is not affected after the hierarchical order of the layers that meet the exchange conditions is exchanged. Therefore, after the electronic device moves k consecutive foreground layers A[m+1]…A[m+k] to the bottom of the activated layer A[m], it does not affect the synthesis result of the layers A[m+1]…A[m+k] and the activated layer A[m].

[0214] In some examples, after the electronic device moves k consecutive foreground layers A[m+1]…A[m+k] below the active layer A[m], it does not restrict the hierarchical order between the layers A[m+1]…A[m+k].

[0215] In some examples, after an electronic device moves k consecutive foreground layers A[m+1]…A[m+k] below the active layer A[m], if the layers in the new background layers A[m+1]…A[m+k] are adjacent to the original background layers, the electronic device can also determine whether the blending algorithms of the adjacent new background layers and the original background layers meet the exchange conditions. If the exchange conditions are met, the electronic device can also swap the hierarchical order between the adjacent new background layers and the original background layers again. Thereafter, the electronic device can repeat the above steps to complete the hierarchical order swap of all layers in the background layers whose blending algorithms meet the exchange conditions.

[0216] In this way, the electronic device effectively reduces the number of foreground layers by exchanging the hierarchical order of the foreground layers, thereby reducing the number of layers involved in real-time synthesis in the subsequent real-time layer synthesis process, improving layer synthesis efficiency, reducing drawing delays, and optimizing the display tracking performance, thereby improving the user experience.

[0217] S6033. The electronic device performs grouping and pre-synthesis of foreground layers.

[0218] In some embodiments, if some of the foreground layers can be pre-composited, the number of foreground layers subsequently involved in real-time compositing can be reduced. To avoid affecting the final result of layer compositing, the electronic device can group foreground layers that meet the combination criteria for pre-compositing.

[0219] In some examples, for a layer blending algorithm, if a blending algorithm f(A, B) appears on three consecutive layers and the calculation order remains unchanged, that is, f(f(A, B), C) = f(A, f(B, C)), then the blending algorithm is said to meet the join condition. For example, as shown in Figure 11, the layer list includes layers A, B, and C. The three layers are ordered from bottom to top: layer A, layer B, and layer C. The blending algorithms for layers B and C are both f. The electronic device first composites layers A and B to obtain intermediate image D, resulting in intermediate image D = f(A, B). The electronic device then composites layer C with intermediate image D, obtaining the final composite result E = f(D, C) = f(f(A, B), C). If the electronic device changes the layer composite order, first composites layers B and C to obtain intermediate image D', the resulting intermediate image D' = f(B, C). The electronic device then synthesizes layer A and intermediate image D', obtaining the final result of the layer synthesis: E' = f(A, D') = f(A, f(B, C)). If the results of E and E' are the same, the blending algorithm f is said to meet the combination condition.

[0220] In some examples, after determining that multiple layers meet the conditions for combining, the electronic device may request a temporary texture. After generating an intermediate image, the electronic device may save the intermediate image to the temporary texture. In some examples, during group pre-composition, the electronic device may also directly composite the multiple layers to be pre-composited onto the temporary texture.

[0221] For example, Table 2 shows some of the commonly used mixing modes that meet the combination conditions and the corresponding mixing algorithms. It should be understood that the mixing algorithms of the mixing modes that meet the combination conditions are not limited to those shown in Table 2.

[0222] Table 2

[0223] In some embodiments, after determining the foreground layers above the active layer, the electronic device may obtain one or more groups of foreground layers that meet the combination criteria. The electronic device then pre-synthesizes these one or more groups of foreground layers separately to obtain one or more intermediate images. Furthermore, during the grouped pre-synthesis of the foreground layers, the electronic device maintains the hierarchical order between the layers and the intermediate images. This effectively reduces the number of foreground layers without compromising the accuracy of the final layer synthesis result during the subsequent real-time layer synthesis process.

[0224] For example, as shown in Figure 12, the electronic device traverses the foreground layers A[m+1] to A[n]. If there are several consecutive layers with the same blending mode and satisfying the combination conditions, the several foreground layers can be divided into a group and the group of foreground layers can be synthesized into an intermediate image. In this way, the electronic device can obtain one or more intermediate images. Among them, the electronic device directly outputs the layers in the foreground layer that do not belong to any group (or outputs these layers as separate layers) and keeps the layer hierarchy order unchanged.

[0225] In this way, the electronic device pre-synthesizes the foreground layers into groups to generate an intermediate image. This method can effectively reduce the number of foreground layers, thereby reducing the number of layers involved in real-time layer synthesis during subsequent real-time layer synthesis, improving layer synthesis efficiency, reducing drawing latency, and enhancing the user experience.

[0226] In some scenarios, the embodiments of the present application do not limit the execution order of the above steps S6031-S6033. For example, the electronic device may first exchange the hierarchical order of the layers, then perform composite layer synthesis, and then perform foreground layer grouping pre-synthesis (that is, the electronic device executes in the order of steps S6032-step S6031-step S6033). For another example, the electronic device may first exchange the hierarchical order of the layers, then perform foreground layer grouping pre-synthesis, and then perform composite layer synthesis (that is, the electronic device executes in the order of steps S6032-step S6033-step S6031).

[0227] It should be understood that if the hierarchical order of the layers is swapped first, the multiple layers (or masks) corresponding to the composite layer will be combined together to swap the hierarchical order of the layers.

[0228] In some scenarios, the electronic device may choose to execute one or more of the above steps S6031 to S6033. For example, the electronic device reduces the number of foreground layers by exchanging the hierarchical order of the layers (i.e., the electronic device executes step S6032 alone). For another example, the electronic device reduces the number of foreground layers by grouping and pre-compositing the foreground layers (i.e., the electronic device executes step S6033 alone). For another example, the electronic device reduces the number of foreground layers by exchanging the hierarchical order of the layers and grouping and pre-compositing the foreground layers (i.e., the electronic device executes steps S6032 and S6033). For another example, the electronic device reduces the number of foreground layers by exchanging the hierarchical order of the layers and compounding the layers (i.e., the electronic device executes steps S6031 and S6032). For another example, the electronic device reduces the number of foreground layers by compounding the layers and grouping and pre-compositing the foreground layers (i.e., the electronic device executes steps S6031 and S6033). For another example, the electronic device reduces the number of foreground layers by synthesizing composite layers, exchanging the hierarchical order of layers, and pre-synthesizing foreground layers in groups (ie, the electronic device executes steps S6031, S6032, and S6033).

[0229] That is to say, the embodiment of the present application introduces three foreground layer preprocessing methods through the above steps S6031 to S6033. The embodiment of the present application does not limit the execution order and execution number of these three preprocessing methods.

[0230] S604: The electronic device pre-processes the background layer.

[0231] In some embodiments, during the painting or image processing process, the user generally only manipulates the content on the active layer and does not change the content of the background layer. Therefore, after determining the active layer, the electronic device can perform pre-synthesis on the background layer in a bottom-up synthesis order to generate an intermediate image. It can be seen that the electronic device does not change the layer synthesis order during the pre-synthesis process. Therefore, in the subsequent real-time layer synthesis process, the electronic device synthesizes the intermediate image and layers above the intermediate image in a bottom-up order, which can ensure the accuracy of the final synthesis result.

[0232] In some examples, the electronic device may request a temporary texture during preprocessing of the background layer. After generating an intermediate image, the electronic device may save the intermediate image to the temporary texture. In some examples, during preprocessing of the background layer, the electronic device may also directly composite the background layer onto the temporary texture.

[0233] In some embodiments, the electronic device executes step S6032 to swap the layers' hierarchical order, changing the hierarchical order of some foreground layers that meet the swap conditions and transforming them into background layers. Therefore, during the background layer pre-composition process, the electronic device pre-composites the background layer including these layers with the changed hierarchical order.

[0234] For example, as shown in Figure 10, after swapping the hierarchical order of some foreground layers that meet the swapping conditions with the active layer, the electronic device obtains a layer list. The background layers in this layer list include the layers that meet the swapping conditions in the hierarchical order of the swapped layers. The electronic device then performs a background layer preprocessing phase, compositing the current background layers from bottom to top into an intermediate image.

[0235] It should be understood that if, after pre-compositing the foreground layers in groups, the electronic device swaps the hierarchical order of intermediate image 1 generated after pre-compositing with the active layer, intermediate image 1 is transformed into a background layer. Then, during the process of pre-processing the background layer to generate the intermediate image, the electronic device pre-composites intermediate image 1 with other background layers to generate intermediate image 2.

[0236] In this way, the electronic device effectively reduces the number of foreground layers and background layers that subsequently participate in real-time layer synthesis by pre-synthesizing the background layer, thereby improving the performance of layer synthesis.

[0237] In this way, the electronic device can generate at least one intermediate image among the intermediate images that meet the composite layer combination conditions, the intermediate images that meet the combination conditions, the intermediate images corresponding to the background layer, etc. through the above-mentioned steps S603 and S604, and participate in subsequent real-time layer synthesis.

[0238] S605: The electronic device performs real-time layer synthesis.

[0239] In some embodiments, while the electronic device is preprocessing layers in a layer list, in response to a user operation, it can obtain user modifications to the content of the active layer. In response to the user's modification operation, the electronic device synthesizes the currently active layer, the unpreprocessed layer, and the intermediate image in real time to obtain and display the corresponding real-time synthesized layer, thereby providing the user with a real-time modification effect.

[0240] It should be understood that through the preprocessing process of steps S602 to S604 above, the layer list synthesized in real time by the electronic device may not include unprocessed layers, that is, all foreground layers and background layers have been synthesized into corresponding intermediate images through preprocessing.

[0241] For example, as shown in FIG13 , during the real-time processing phase, the electronic device obtains a layer list, which includes an intermediate image B[1] corresponding to a pre-synthesized background layer, an active layer B[2], and foreground layers A[m+1]-A[n], where the foreground layers A[m+1]-A[n] include intermediate images corresponding to grouped pre-synthesized background layers. The electronic device then blends the layers and intermediate images in the layer list in a bottom-up order to obtain the final blending result.

[0242] In some examples, the electronic device may allocate memory for storing the blending result. The electronic device then composites the obtained intermediate image corresponding to the background layer, the active layer, and the layer or intermediate image corresponding to the foreground layer into the allocated memory in ascending order to obtain the target image for the layer blending.

[0243] In other examples, after completing pre-compositing of the background layer, the electronic device may obtain an intermediate image corresponding to the background layer. The electronic device then composites the layers or intermediate images corresponding to the active layer and the foreground layer with the intermediate image corresponding to the background layer in a bottom-up order to obtain a target layer-blended image.

[0244] In this way, the electronic device reduces the number of layers involved in real-time layer synthesis through at least one layer preprocessing method including composite layer synthesis, layer hierarchical order exchange, foreground layer group pre-synthesis, and background layer pre-synthesis, effectively improving the performance of real-time synthesis, thereby reducing latency, avoiding display freezes, and improving the user experience.

[0245] The above describes in detail the various layer preprocessing implementation methods provided in the embodiments of the present application in combination with Figures 6 to 13. The layer processing process is introduced below through several specific example scenarios.

[0246] Scene 1: The layer list includes the background layer, the active layer, and multiple foreground layers.

[0247] For example, as shown in FIG14 , the electronic device obtains a background layer 141, an activation layer 142, a foreground layer 143, a foreground layer 144, and a foreground layer 145, which are arranged in sequence. The electronic device then synthesizes foreground layer 143, foreground layer 144, and foreground layer 145 to generate an intermediate image 146. The electronic device then synthesizes background layer 141, activation layer 142, and intermediate image 146 to generate a target image 147.

[0248] In this way, in the preprocessing stage, the electronic device pre-synthesizes multiple foreground layers, effectively reducing the number of foreground layers involved in layer synthesis in the real-time processing stage, thereby improving the efficiency of real-time layer synthesis.

[0249] In some embodiments, the electronic device determines whether foreground layer 143, foreground layer 144, and foreground layer 145 meet a combination condition based on the blending modes of foreground layer 143, foreground layer 144, and foreground layer 145. The electronic device then composites foreground layer 143, foreground layer 144, and foreground layer 145 to generate intermediate image 146.

[0250] In some examples, the combination condition indicates that the blending order between adjacent layers can be changed.

[0251] For example, the conditions are specifically characterized as follows: if the electronic device synthesizes foreground layer 144 and foreground layer 145 to obtain a first transition image, then synthesizes the first transition image with foreground layer 143 to obtain a second transition image. If the electronic device synthesizes foreground layer 143 and foreground layer 144 to obtain a third transition image, then synthesizes the third transition image with foreground layer 145 to obtain a fourth transition image, then the second transition image and the fourth transition image are identical.

[0252] For example, as shown in Figure 11, if the layers' order is changed and the resulting composite is the same, then these layers meet the join condition. For example, the blending algorithms used by these layers are the same and meet the join condition.

[0253] In some embodiments, based on the blending mode of intermediate image 146 and activated layer 142, the electronic device determines that the swap condition between intermediate image 146 and activated layer 142 is not met, and maintains the hierarchical order of background layer 141, activated layer 142, and intermediate image 146. The electronic device then composites background layer 141, activated layer 142, and intermediate image 146 to generate target image 147. The swap condition indicates that the hierarchical order of adjacent layers is interchangeable.

[0254] Exemplarily, as shown in FIG14 , in the real-time processing stage, the electronic device maintains the hierarchical order of the background layer 141 , the activation layer 142 , and the intermediate image 146 , and generates a target image 147 after synthesizing the background layer 141 , the activation layer 142 , and the intermediate image 146 .

[0255] In other embodiments, the electronic device determines that an exchange condition is satisfied between intermediate image 146 and activated layer 142 based on the blending mode of intermediate image 146 and activated layer 142. The electronic device then composites intermediate image 146 with background layer 141 to generate intermediate image 151. The electronic device then composites intermediate image 151 with activated layer 142 to generate target image 147.

[0256] For example, the swap condition specifically represents: background layer 141, active layer 142, and intermediate image 146 are synthesized sequentially from bottom to top to obtain the fifth transition image; background layer 141, intermediate image 146, and active layer 142 are synthesized sequentially from bottom to top to obtain the sixth transition image; wherein the fifth transition image and the sixth transition image are identical. For example, as shown in FIG9 , swapping active layer 142 and intermediate image 146 does not affect the final layer synthesis result. For example, the blending algorithm of active layer 142 and intermediate image 146 satisfies the swap condition.

[0257] For example, as shown in Figure 15, during the preprocessing phase, the electronic device first pre-synthesizes foreground layer 143, foreground layer 144, and foreground layer 145 into intermediate image 146. It then determines that intermediate image 146 and activation layer 142 meet the swap conditions, such as if the blending algorithm for intermediate image 146 and activation layer 142 meets the swap conditions. The electronic device then swaps the layer order of activation layer 142 and intermediate image 146, transforming intermediate image 146 into the background layer. The electronic device then pre-synthesizes intermediate image 146 and background layer 141 to generate intermediate image 151. This way, during the real-time processing phase, the electronic device only needs to synthesize activation layer 142 and intermediate image 151 to generate target image 152, effectively reducing the number of layers involved in real-time layer synthesis.

[0258] In some embodiments, other foreground layers may be included above foreground layer 145, but these other foreground layers do not meet the conditions for combining with foreground layer 143, foreground layer 144, and foreground layer 145, and thus cannot be preprocessed. In the subsequent real-time processing stage, these other foreground layers also participate in real-time layer synthesis.

[0259] In some embodiments, in the current scene, foreground layer 143, foreground layer 144, and foreground layer 145 are adjacent to active layer 142. After determining that foreground layer 143 and active layer 142 meet the swap condition, the electronic device may first swap the hierarchical order of foreground layer 143 and active layer 142. Subsequently, after determining that foreground layer 144 and active layer 142 meet the swap condition, the electronic device may swap the hierarchical order of foreground layer 144 and active layer 142. Subsequently, after determining that foreground layer 145 and active layer 142 meet the swap condition, the electronic device may swap the hierarchical order of foreground layer 145 and active layer 142. In other words, the electronic device may not pre-composite the foreground layers first, but may directly swap the foreground layers that meet the swap condition with the background layers. It should be understood that other foreground layers may be included above foreground layer 145, but these other foreground layers and active layer 142 do not meet the swap condition and cannot be pre-processed. In the subsequent real-time processing stage, these other foreground layers also participate in real-time layer composition.

[0260] In some embodiments, as shown in FIG14 , the electronic device determines that the pixel parameters of the activation layer 142 have changed, and re-synthesizes the background layer 141 , the activation layer 142 after the pixel parameters have changed, and the intermediate image 146 to generate another target image.

[0261] In this way, the layers involved in real-time layer synthesis only include the background layer 141 , the active layer 142 , and the intermediate image 146 , effectively improving the efficiency of layer synthesis.

[0262] In some embodiments, as shown in FIG15 , the electronic device determines that pixel parameters of the activation layer 142 have changed, and re-synthesizes the activation layer 142 after the pixel parameters have changed and the intermediate image 151 to generate another target image.

[0263] In this way, the layers involved in real-time layer synthesis only include the active layer 142 and the intermediate image 151, which effectively improves the efficiency of layer synthesis.

[0264] Scene 2: The layer list includes the background layer set, the active layer, and the foreground layer.

[0265] For example, as shown in FIG16 , the electronic device obtains a background layer set 161, an active layer 162, and a foreground layer 163, which are sequentially arranged. The electronic device then composites the foreground layer 163 with the background layer set 161 to generate an intermediate image 164. The electronic device then composites the active layer 162 with the intermediate image 164 to generate a target image 165.

[0266] In this way, in the preprocessing stage, the electronic device exchanges the hierarchical order of the foreground layer and the activation layer, transforms the foreground layer into a background layer, and pre-synthesizes it with other background layers, effectively reducing the number of foreground layers participating in layer synthesis in the real-time processing stage, thereby improving the efficiency of real-time layer synthesis.

[0267] In some examples, the background layer set 161 includes a first background layer and a second background layer arranged in sequence. Alternatively, the background layer set 161 may include a single layer obtained by synthesizing the first background layer and the second background layer.

[0268] In this way, electronic devices can first swap the hierarchical order of the foreground layer and the active layer, and then pre-compose the background layer; electronic devices can also pre-compose the background layer first, and then swap the hierarchical order of the foreground layer and the active layer, thus flexibly implementing the layer pre-processing process.

[0269] In some examples, the foreground layer 163 is a composite layer including an associated mask layer and a foreground layer.

[0270] In this way, the composite layers in the foreground layer can also participate in and activate the hierarchical order exchange between layers, thereby effectively reducing the number of layers participating in layer synthesis in real time.

[0271] In some embodiments, as shown in FIG16 , during the preprocessing phase, the electronic device determines whether a swap condition is satisfied between foreground layer 163 and activation layer 162 based on their blending modes. The electronic device then composites foreground layer 163 with background layer set 161 to generate intermediate image 164.

[0272] In some examples, the swap condition indicates that the hierarchical order of adjacent layers can be interchanged.

[0273] Exemplarily, the background layer set 161 includes a first background layer and a second background layer arranged in sequence. The exchange condition is specifically characterized as follows: the first background layer, the second background layer, the activation layer 162 and the foreground layer 163 are synthesized in sequence from bottom to top to obtain a first transition image. The first background layer, the second background layer, the foreground layer 163 and the activation layer 162 are synthesized in sequence from bottom to top to obtain a second transition image. The first transition image and the second transition image are consistent. For example, as shown in the exchange condition in FIG9 , after exchanging the activation layer 162 and the foreground layer 163, the final layer synthesis result is not affected. For example, the mixing algorithm of the activation layer 162 and the foreground layer 163 meets the exchange condition.

[0274] In some embodiments, the electronic device determines that pixel parameters of the activation layer 162 have changed, and re-synthesizes the activation layer 162 after the pixel parameters have changed and the intermediate image 164 to generate another target image.

[0275] In this way, the layers involved in real-time layer synthesis only include the active layer 162 and the intermediate image 164 , effectively improving the efficiency of layer synthesis.

[0276] In some embodiments, other foreground layers may be included above the foreground layer 163, but these other foreground layers do not meet the exchange conditions with the active layer 162 and cannot be pre-processed. In the subsequent real-time processing stage, these other foreground layers also participate in the real-time layer synthesis.

[0277] Scene 3: The layer list includes multiple background layers, active layers, and foreground layers.

[0278] In some embodiments, as shown in FIG17 , the electronic device obtains a background layer 171, a background layer 172, a background layer 173, an activation layer 174, and a foreground layer 175, which are sequentially arranged. The electronic device then composites the background layer 171, the background layer 172, and the background layer 173 to generate an intermediate image 176. The electronic device then composites the foreground layer 175 with the intermediate image 176 to generate an intermediate image 177. The electronic device then composites the activation layer 174 with the intermediate image 177 to generate a target image 178.

[0279] Thus, during the pre-processing phase, the electronic device pre-composites multiple background layers. Furthermore, the electronic device swaps the hierarchical order of the foreground layer and the active layer, transforming the foreground layer into a background layer, and then pre-compositing it with other background layers. This effectively reduces the number of foreground layers involved in layer compositing during the real-time processing phase, thereby improving the efficiency of real-time layer compositing.

[0280] In some embodiments, as shown in FIG17 , during the preprocessing phase, the electronic device determines whether a swap condition is satisfied between foreground layer 175 and activation layer 174 based on the blending modes of foreground layer 175 and activation layer 174. The electronic device then composites foreground layer 175 with intermediate image 176 to generate intermediate image 177.

[0281] In some examples, the swap condition indicates that the hierarchical order of adjacent layers can be interchanged.

[0282] Exemplarily, the swap condition specifically represents: intermediate image 176, active layer 174, and foreground layer 175 are synthesized sequentially from bottom to top to obtain a first transition image; intermediate image 176, foreground layer 175, and active layer 174 are synthesized sequentially from bottom to top to obtain a second transition image. The first transition image and the second transition image are identical. For example, as shown in FIG9 , swapping active layer 174 and foreground layer 175 does not affect the final layer synthesis result. For example, the blending algorithm for active layer 174 and foreground layer 175 satisfies the swap condition.

[0283] In some embodiments, as shown in FIG17 , during the preprocessing phase, the electronic device determines whether background layers 171, 172, and 173 meet a combination condition based on the blending modes of the background layers 171, 172, and 173. The electronic device then composites the background layers 171, 172, and 173 to generate an intermediate image 176.

[0284] In some examples, the combination condition indicates that the blending order between adjacent layers can be changed.

[0285] For example, the combination of conditions specifically represents: background layer 171 and background layer 172 are synthesized to obtain a third transition image; the third transition image is synthesized with background layer 173 to obtain a fourth transition image. Background layer 172 and background layer 173 are synthesized to obtain a fifth transition image; and the fifth transition image is synthesized with background layer 171 to obtain a sixth transition image. The fourth transition image and the sixth transition image are identical.

[0286] For example, as shown in Figure 11, if the layers' order is changed and the resulting composite is the same, then these layers meet the join condition. For example, the blending algorithms used by these layers are the same and meet the join condition.

[0287] In some embodiments, other foreground layers may be included above the foreground layer 175, but these other foreground layers do not meet the exchange conditions with the active layer 174 and cannot be pre-processed. In the subsequent real-time processing stage, these other foreground layers also participate in the real-time layer synthesis.

[0288] In some scenarios, the electronic device displays a 4K canvas, and in response to user operations, the layer at the bottom is determined as the active layer. Then, the current layer list does not include the background layer, but only includes the active layer and the foreground layer above the active layer. Taking the layer blending mode as Multiply as an example, as shown in Table 3, when the number of layers included in the layer list is different, if the layers are mixed according to the original scheme of all layers participating in the real-time synthesis of the layers, as the number of layers increases, the number of frames per second (FPS) transmitted by the electronic device, that is, the frame rate, decreases, resulting in abnormal freezing of the electronic device display. Moreover, when the number of layers is small, a good frame rate display effect cannot be obtained. If the electronic device pre-processes the layers, the number of layers participating in the real-time synthesis can be at least 2 layers, then the frame rate of the electronic device can be maintained at a higher frame rate display effect, thereby improving the user experience.

[0289] Table 3

[0290] The above describes in detail the layer synthesis method provided by the embodiment of the present application in conjunction with Figures 6 to 17. The following describes in detail the electronic device provided by the embodiment of the present application in conjunction with Figure 18.

[0291] In one possible design, Figure 18 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in Figure 18, electronic device 1800 may include: a transceiver unit 1801 and a processing unit 1802. Electronic device 1800 may be used to implement the functions of the electronic device involved in the above method embodiment.

[0292] In some examples, the transceiver unit 1801 is used to support the electronic device 1800 to execute S601 in Figure 6.

[0293] In some examples, the processing unit 1802 is used to support the electronic device 1800 to execute S602, S603, S604 and S605 in Figure 6; and / or to support the electronic device 1800 to execute S6031, S6032 and S6033 in Figure 7.

[0294] The transceiver unit may include a receiving unit and a transmitting unit, and may be implemented by a transceiver or transceiver-related circuit components, and may be a transceiver or a transceiver module. The operations and / or functions of each unit in the electronic device 1800 are respectively for implementing the corresponding processes of the layer synthesis method described in the above method embodiment. All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional unit. For the sake of brevity, they are not repeated here.

[0295] In some examples, the electronic device 1800 shown in FIG18 may further include a storage unit (not shown in FIG18 ) storing a program or instruction. When the transceiver unit 1801 and the processing unit 1802 execute the program or instruction, the electronic device 1800 shown in FIG18 may perform the layer composition method described in the above method embodiment.

[0296] The technical effects of the electronic device 1800 shown in FIG18 may refer to the technical effects of the layer synthesis method described in the above method embodiment, and will not be repeated here.

[0297] In addition to being in the form of the electronic device 1800, the technical solution provided in this application may also be a functional unit or chip in the electronic device, or a device used in conjunction with the electronic device.

[0298] An embodiment of the present application also provides a chip system, including: a processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instructions are executed by the processor, the chip system implements the method in any of the above method embodiments.

[0299] In some examples, there may be one or more processors in the chip system. The processor may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented in software, the processor may be a general-purpose processor that is implemented by reading software code stored in a memory.

[0300] In some examples, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be provided separately from the processor, which is not limited in the embodiments of the present application. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or provided on different chips. The embodiments of the present application do not specifically limit the type of memory or the configuration of the memory and the processor.

[0301] Exemplarily, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.

[0302] It should be understood that each step in the above method embodiment can be completed by hardware integrated logic circuits in a processor or by software instructions. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.

[0303] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer, the computer executes the above-mentioned related steps to implement the layer synthesis method in the above-mentioned embodiment.

[0304] An embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute the above-mentioned related steps to implement the layer synthesis method in the above-mentioned embodiment.

[0305] In addition, embodiments of the present application also provide a device. This device can be a component or module, and can include one or more processors and a memory connected together. The memory is used to store a computer program. When the computer program is executed by one or more processors, the device performs the layer composition method described in each of the above method embodiments.

[0306] The apparatus, computer-readable storage medium, computer program product, or chip provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding methods provided above, and will not be repeated here.

[0307] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner or can be implemented by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory (RAM), a flash memory, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disc (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC).

[0308] Through the description of the above embodiments, those skilled in the art will clearly understand that for the sake of convenience and brevity, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed; that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working processes of the above-mentioned systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0309] In the several embodiments provided in this application, it should be understood that the disclosed methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of modules or units, which can be electrical, mechanical or other forms.

[0310] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0311] Computer-readable storage media include, but are not limited to, any of the following: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media that can store program code.

[0312] The above is only a specific embodiment of the present application, but the scope of protection of this application is not limited to this. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A layer synthesis method, applied to electronic equipment, characterized in that: The method comprises: Get the background layer, active layer, first foreground layer, second foreground layer and third foreground layer set in sequence; synthesizing the first foreground layer, the second foreground layer and the third foreground layer to generate a first intermediate image; The background layer, the activation layer and the first intermediate image are synthesized to generate a first target image.

2. The method according to claim 1, characterized in that Before synthesizing the first foreground layer, the second foreground layer and the third foreground layer to generate a first intermediate image, the method further includes: Based on the blending modes of the first foreground layer, the second foreground layer and the third foreground layer, it is determined that the first foreground layer, the second foreground layer and the third foreground layer satisfy a combination condition; the combination condition indicates that a blending order between the adjacent multiple layers can be changed.

3. The method according to claim 2, characterized in that The method further comprises: In response to a user operation, without changing the activated layer, swapping the order of the second foreground layer and the third foreground layer; The first foreground layer, the third foreground layer, and the second foreground layer are synthesized to obtain a second intermediate image; wherein the second intermediate image is consistent with the first intermediate image.

4. The method according to claim 2 or 3, characterized in that: The binding conditions are specifically characterized by: synthesizing the second foreground layer and the third foreground layer to obtain a first transition image; synthesizing the first transition image and the first foreground layer to obtain the second transition image; synthesizing the first foreground layer and the second foreground layer to obtain a third transition image; synthesizing the third transition image and the third foreground layer to obtain a fourth transition image; The second transition image is consistent with the fourth transition image.

5. The method according to any one of claims 1 to 4, characterized in that: Generating the first target image comprises: Based on the blending mode of the first intermediate image and the activation layer, determining that the first intermediate image and the activation layer do not satisfy an exchange condition, and maintaining the hierarchical order of the background layer, the activation layer, and the first intermediate image; the exchange condition indicates that the hierarchical order of adjacent layers is interchangeable; The background layer, the activation layer and the first intermediate image are synthesized to generate the first target image.

6. The method according to any one of claims 1 to 4, characterized in that: Generating the first target image comprises: Based on a blending mode of the first intermediate image and the activated layer, determining that an exchange condition is satisfied between the first intermediate image and the activated layer; the exchange condition indicates that the hierarchical order of adjacent layers is interchangeable; synthesizing the first intermediate image and the background layer to generate a second intermediate image; The second intermediate image and the activated layer are synthesized to generate the first target image.

7. The method according to claim 5 or 6, characterized in that: The exchange conditions are specifically characterized by: The background layer, the active layer, and the first intermediate image are synthesized in order from bottom to top to obtain a fifth transition image; The background layer, the first intermediate image, and the activation layer are synthesized in sequence from bottom to top to obtain a sixth transition image; The fifth transition image and the sixth transition image are consistent.

8. A layer synthesis method, applied to electronic equipment, characterized in that: The method comprises: Get the background layer set, the active layer and the first foreground layer set in order; Combining the first foreground layer and the background layer set to generate a first intermediate image; The activated layer and the first intermediate image are synthesized to generate a first target image.

9. The method according to claim 8, characterized in that The background layer set includes a first background layer and a second background layer which are arranged in sequence.

10. The method according to claim 9, characterized in that Before synthesizing the first foreground layer and the background layer set to generate a first intermediate image, the method further includes: Based on the blending mode of the first foreground layer and the activation layer, it is determined that the first foreground layer and the activation layer satisfy an exchange condition; the exchange condition indicates that the hierarchical order between adjacent layers is interchangeable.

11. The method according to claim 10, characterized in that The exchange conditions are specifically characterized by: The first background layer, the second background layer, the activation layer and the first foreground layer are synthesized in sequence from bottom to top to obtain a first transition image; The first background layer, the second background layer, the first foreground layer and the activation layer are synthesized in sequence from bottom to top to obtain a second transition image; The first transition image and the second transition image are consistent.

12. The method according to any one of claims 8 to 11, characterized in that: The first foreground layer is a composite layer, and the composite layer includes an associated mask layer and a foreground layer.

13. The method according to any one of claims 8 to 12, characterized in that: The method further comprises: Determine the pixel parameter change of the activation layer, re-synthesize the activation layer after the pixel parameter change and the first intermediate image, and generate a second target image.

14. A layer synthesis method, applied to electronic equipment, characterized in that: The method comprises: Get the first background layer, the second background layer, the third background layer, the active layer and the first foreground layer which are set in sequence; The first background layer, the second background layer and the third background layer are synthesized to generate a first intermediate image; synthesizing the first foreground layer and the first intermediate image to generate a second intermediate image; The activated layer and the second intermediate image are synthesized to generate a first target image.

15. The method according to claim 14, characterized in that Before synthesizing the first foreground layer and the first intermediate image to generate a second intermediate image, the method further includes: Based on the blending mode of the first foreground layer and the activation layer, it is determined that the first foreground layer and the activation layer satisfy an exchange condition; the exchange condition indicates that the hierarchical order between adjacent layers is interchangeable.

16. The method according to claim 15, characterized in that The exchange conditions are specifically characterized by: The first intermediate image, the activation layer, and the first foreground layer are synthesized in sequence from bottom to top to obtain a first transition image; The first intermediate image, the first foreground layer and the activated layer are synthesized in sequence from bottom to top to obtain a second transition image; The first transition image and the second transition image are consistent.

17. The method according to any one of claims 14 to 16, characterized in that: Before synthesizing the first background layer, the second background layer and the third background layer to generate the first intermediate image, the method further includes: Based on the blending modes of the first background layer, the second background layer and the third background layer, it is determined that the first background layer, the second background layer and the third background layer satisfy a combination condition; the combination condition indicates that the blending order between the adjacent multiple layers can be changed.

18. The method according to claim 17, characterized in that The binding conditions are specifically characterized by: The first background layer and the second background layer are synthesized to obtain a third transition image; the third transition image and the third background layer are synthesized to obtain a fourth transition image; The second background layer and the third background layer are synthesized to obtain a fifth transition image; the fifth transition image and the first background layer are synthesized to obtain a sixth transition image; The fourth transition image is consistent with the sixth transition image.

19. An electronic device, characterized in that: include: A processor and a memory, wherein the memory is coupled to the processor, the memory is used to store computer program code, the computer program code includes computer instructions, and when the processor reads the computer instructions from the memory, the electronic device executes the method as described in any one of claims 1 to 7; or, the electronic device executes the method as described in any one of claims 8 to 13; or, the electronic device executes the method as described in any one of claims 14 to 18.

20. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a computer program, which, when executed on an electronic device, enables the electronic device to execute a method as described in any one of claims 1 to 7; or enables the electronic device to execute a method as described in any one of claims 8 to 13; or enables the electronic device to execute a method as described in any one of claims 14 to 18.

Citation Information

Patent Citations

  • Layer rendering processing method of video image and system thereof

    CN107292945A

  • Multi-layer superimposed display method and device in application program, storage medium and terminal

    CN109165013A

  • Layer synthesis method and device and computer readable storage medium

    CN113986162A

  • Image enhancement implementation method and device

    CN115345804A